Skip to content

Flush backbuffer of lower quality segments for looped video's #4553

@AndreasFurster

Description

@AndreasFurster

Is your feature request related to a problem? Please describe.

This is a feature request based on issue #4315.

If hls.js switches to higher quality levels, the previous segments are never refetched in better quality, which is crucial if video is on a loop.

For example:

  1. Quality level is estimated on 720p
  2. Segment 1 is buffered in 720p
  3. Quality level is upgraded to 1080p
  4. Segment 2 is buffered in 1080p
  5. The video loops
  6. Segment 1 is played in 720p again while we have the juice to buffer at 1080p level

As mentioned by @cjpillsbury, hls.bufferController.flushBackBuffer() on Hls.Events.LEVEL_SWITCHED could also flush segments of higher quality.

I'm also not sure if buffered segments later on in the video are considered backbuffer. So if we are for example on segment 4. Would it also flush segment 6?

Another thing is that it should wait flushing before the new segment has been buffered. Because when the connection decreases again and the higher quality segment cannot be buffered, we should fall back on the lower quality buffered segment that has already been buffered.

Describe the solution you'd like

An additional Hls option that magickly fixes the mentioned issues 😬

Additional context

No response

Metadata

Metadata

Type

No type

Projects

Status

To do

Status

Top priorities

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions