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
Once checking out this resource, it highlights the fact that:
It is a good idea to check out Lines 175 and 176 of this script file here showing the 8 times of
maxBufferSizeto act as themaxBufLen. You might think about changing this.