Embed mp4 video direct link causes huge data transfer

AI-generated summary

A discussion about a data transfer issue when embedding mp4 videos in Discourse was initiated by hawm. They explained that pasting a direct link to an mp4 video and posting it resulted in huge data transfer, even when the video was only 100MB. supermathie investigated and found that the service worker was causing the issue, with the same content being requested multiple times. hawm further demonstrated the issue with a deleted reply, showing the significant data transfer costs from their cloud storage. Fortunately, blake announced that a fix had been released, thanking hawm for reporting the issue: https://github.com/discourse/discourse/pull/24924.

Paste an mp4 video direct link into the composer and then will be onebox as video, and post it.

Then play the video, check the network on devtools, will see huge data transfer. For example, a 100MB video will transfer about 1GB of data. Seems the service worker caused it.

1 Like

Can you please put an example on try.discourse.org?

1 Like

I do see this:

Note this 31,539,436B video has had most of the content requested multiple times in several requests:

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

which match what was requested.

I know this is something we’ve been actively working on improving lately; I’ll ensure the right team is aware.

2 Likes

can you please test my deleted reply on the same topic? view the history play the deleted embedded video and try to manipulate the progress bar.

which really cost a lot of data transfer from my cloud storage

:smiling_face_with_tear: Hope to fix this issue

A fix for this has been released. Thanks for reporting @hawm.

https://github.com/discourse/discourse/pull/24924

7 Likes

This topic was automatically closed after 3 days. New replies are no longer allowed.