bluesky-social / atproto

Social networking technology created by Bluesky
Other
6.89k stars 486 forks source link

HLS/m3u8 (Chunked) video downloading to the client #2983

Open J-Stuff opened 1 week ago

J-Stuff commented 1 week ago

Is your feature request related to a problem? Please describe. Yes

When watching a video on the iOS app, or in the desktop. Especally on slower connections, scrubbing thorugh a video seems to either force the entire video to preload up to that point or even clears the entire video from the device cache. Forcing a complete download up to the point in where the user has scrubbed to. Even on a 1gpbs connection this is a noticable issue.

Describe the solution you'd like

When a video is uploaded, the server (or this responsibilty could be handed off to client, if possible (probably only on native apps like iOS or Android)) should chunk the video into x-second (or x-MB) chunks for the server. When someone watches the video, the server can send the client the video chunks. This helps avoid bandwidth wastage if the user doesn't watch all the way through the video, it can allow clients to pre-load a few seconds of a video to make playback feel more responsive and if a user scrubbs through a video it can allow it to load faster, and again save bandwidth from the server by only loading from the point where a user has scrubbed to.

Describe alternatives you've considered

N/A, other than staying with the current video system which again feels slow a lot of the time.

Additional context Additionally, this would also likely create a flow, usable in the future for video transcoding if bsky wanted to add any kind of monetisation feature restricting video bitrate, resolution, etc. Also this allows for dynamic resolution scaling for people on slower connections

Most of the inspiration for this feature requests came from previous expericnce using hls.js with m3u8 playlists.

I should also note that this issue doesn't really occour on smaller or lower quality videos, but is very common on higher bitrate/quality ones.

jonnyawsom3 commented 6 days ago

This could also be done using partial content requests without file splitting https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206