http-streaming icon indicating copy to clipboard operation
http-streaming copied to clipboard

Clear previously player buffer on quality changes

Open tzarebczan opened this issue 2 years ago • 1 comments

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.

tzarebczan avatar Apr 01 '22 16:04 tzarebczan

This might be possible, if the SourceBuffers 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.

philipp-doblhofer avatar Sep 21 '23 06:09 philipp-doblhofer