http-streaming
http-streaming copied to clipboard
Clear previously player buffer on quality changes
Similar to https://github.com/videojs/http-streaming/issues/127 which was solved, but still allow someone who seeks back to use the newly selected quality vs what was already loaded at the auto quality. You'd still want the smooth quality feature overall, but also take into account already played segments to reflect the new setting.
This might be possible, if the SourceBuffer
s are accessed during the quality change in tech().vhs.masterPlaylistController_.mediaSource.sourceBuffers
. These objects have a method in order to remove timeranges in the saved buffer: https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/remove.
One naive method would be, that the buffer from the beginning to the current time is flushed, if the quality is changed to a better one. The optimal solution might probably be, to keep track of the information which quality was used for which timerange and only remove the lower quality time ranges.