# 嵌入mp4视频的直接链接导致大量数据传输

**URL:** <https://meta.discourse.org/t/embed-mp4-video-direct-link-causes-huge-data-transfer/287817>\
**Category:** Bug\
**Created:** [2023年十二月7日 04:16 UTC](https://meta.discourse.org/t/embed-mp4-video-direct-link-causes-huge-data-transfer/287817 "2023-12-07T04:16:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hawm](https://avatars.discourse-cdn.com/v4/letter/h/f07891/32.png) [@hawm](https://meta.discourse.org/u/hawm)\
**Post date:** [2023年十二月7日 04:16 UTC](https://meta.discourse.org/t/embed-mp4-video-direct-link-causes-huge-data-transfer/287817/1 "2023-12-07T04:16:04Z")

</div>

将 mp4 视频直接链接粘贴到编辑器中，它将作为视频进行 onebox，然后发布。

然后播放视频，检查 devtools 中的网络，将看到大量数据传输。例如，一个 100MB 的视频将传输约 1GB 的数据。似乎是服务工作线程引起的。

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2023年十二月7日 04:28 UTC](https://meta.discourse.org/t/embed-mp4-video-direct-link-causes-huge-data-transfer/287817/2 "2023-12-07T04:28:49Z")

</div>

请在 [try.discourse.org](http://try.discourse.org) 上放一个示例好吗？

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2023年十二月7日 05:41 UTC](https://meta.discourse.org/t/embed-mp4-video-direct-link-causes-huge-data-transfer/287817/3 "2023-12-07T05:41:36Z")

</div>

我看到了这个：

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/9/c/f9ca623c6dd42bcf15d3bff31a8cf36b68c0f767.jpeg)

请注意，这个 31,539,436B 的视频在几次请求中_大部分_内容已被多次请求：

```plaintext
Content-Length: 31539436
Content-Range: bytes 0-31539435/31539436

Content-Length: 180460
Content-Range: bytes 31358976-31539435/31539436

Content-Length: 31506668
Content-Range: bytes 32768-31539435/31539436

Content-Length: 31375596
Content-Range: bytes 163840-31539435/31539436

```

这与所请求的内容相符。

我知道这是我们最近一直在积极努力改进的事情；我会确保相关团队知晓此事。

---

<div class="post-metadata">

**Author:** ![hawm](https://avatars.discourse-cdn.com/v4/letter/h/f07891/32.png) [@hawm](https://meta.discourse.org/u/hawm)\
**Post date:** [2023年十二月7日 05:54 UTC](https://meta.discourse.org/t/embed-mp4-video-direct-link-causes-huge-data-transfer/287817/4 "2023-12-07T05:54:38Z")

</div>

请测试我在同一主题上删除的回复？查看历史记录，播放已删除的嵌入式视频，并尝试操作进度条。

这确实消耗了我大量云存储的数据传输

 ![image](https://global.discourse-cdn.com/meta/original/4X/1/2/d/12d952ef0872e9d1a77cfa227dd76f35e6d50aa5.png)

---

<div class="post-metadata">

**Author:** ![zengyunsi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zengyunsi/32/265722_2.png) [@zengyunsi](https://meta.discourse.org/u/zengyunsi)\
**Post date:** [2023年十二月8日 04:35 UTC](https://meta.discourse.org/t/embed-mp4-video-direct-link-causes-huge-data-transfer/287817/5 "2023-12-08T04:35:40Z")

</div>

🥲 希望能修复此问题

---

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [2023年十二月18日 13:29 UTC](https://meta.discourse.org/t/embed-mp4-video-direct-link-causes-huge-data-transfer/287817/6 "2023-12-18T13:29:01Z")

</div>

已发布此问题的修复程序。感谢您的报告@hawm。

> <https://github.com/discourse/discourse/pull/24924>
>
> This bug appears to only be on Chrome due to the service worker fetching
> the vid…eo content on page load instead of on play. For some reason
> though the service worker would fetch around 4x more than the size of
> the video resulting in excessive data being downloaded especially for
> larger videos.
> 
> meta https://meta.discourse.org/t/287817
> internal /t/111387/52

---

<div class="post-metadata">

**Author:** ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)\
**Post date:** [2023年十二月21日 15:00 UTC](https://meta.discourse.org/t/embed-mp4-video-direct-link-causes-huge-data-transfer/287817/7 "2023-12-21T15:00:38Z")

</div>

此主题已在 3 天后自动关闭。不允许回复。
