Monday, 19 July 2021

How to restrict fetching hls segment files on pause in Safari (MacOS and iOS)

We generate hls files with segment size of 3 seconds. We use hlsjs for non Safari browsers and Safari has native hls support.

In hlsjs world we were able to restrict how much ahead we should be in terms of buffer using maxMaxBufferLength, where as we are unable to find similar solution for Safari. In Safari, after loading video m3u8, even if I pause after a second, in the network tab I can see that all the segments are being fetched which I would like to restrict.

I'll not be able to share our examples due to company polices. But, a public example file by hls.js is attached below:

https://test-streams.mux.dev/x36xhzz/url_6/193039199_mp4_h264_aac_hq_7.m3u8 try opening this url in Safari, and try pausing the video, you'll see that it continues to download. Where as if you open same one using https://hls-js.netlify.app/demo/ with maxMaxBufferLength: 5 it won't happen.

Is there an option at ffmpeg to make it controlled buffer or some solution that we should do for Safari by listening to events?

Found the same question here -> https://developer.apple.com/forums/thread/121074



from How to restrict fetching hls segment files on pause in Safari (MacOS and iOS)

No comments:

Post a Comment