-
I'm wondering how the presence of cached fragments interacts with a level change in HLS. One behavior I have noticed is that my video begins at a high level, then switches to a lower level, and maybe stays at this lower level until the end of the video. Then, when the video loops, it uses all of the same fragments it has already cached (high level at the beginning, low level at the end). Would HLS automatically switch to a higher level if there is enough bandwidth, or does the presence of cached fragments preclude it from switching levels? Is there a way to tell HLS to try to load the higher level fragments instead of using the cached lower level ones (e.g. if there's now more available bandwidth)? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
HLS.js does not cache fragments per se. Not to be confused with content cached by the browser, I think you are referring to buffered fragments. That is, fragments appended via MSE to the media SourceBuffer(s). HLS.js does not reload or rebuffer media that is already buffered. You can flush sections of the buffer if you want HLS.js to reload those parts of the timeline. Look at API.md for details on configuring back and forward buffer length Calling Since you are looping, you might want to keep an eye on this issue, and give it thumbs up to up vote it. |
Beta Was this translation helpful? Give feedback.
-
Related issue #5826 |
Beta Was this translation helpful? Give feedback.
HLS.js does not cache fragments per se. Not to be confused with content cached by the browser, I think you are referring to buffered fragments. That is, fragments appended via MSE to the media SourceBuffer(s). HLS.js does not reload or rebuffer media that is already buffered. You can flush sections of the buffer if you want HLS.js to reload those parts of the timeline.
Look at API.md for details on configuring back and forward buffer length
backBufferLength
. There are several settings that control how far ahead HLS.js buffers, and how far back the player should flush content.Calling
hls.trigger(Events.BUFFER_FLUSHING, { startOffset: 0, endOffset: 30} );
flushes content from start to end …