videojs / http-streaming

HLS, DASH, and future HTTP streaming protocols library for video.js
https://videojs-http-streaming.netlify.app/
Other
2.53k stars 425 forks source link

Adaptive Streaming + Looped Video: Initially loaded segments don't update to most recent rendition #1366

Open jgcaruso opened 1 year ago

jgcaruso commented 1 year ago

Description

When using an adaptive streaming playlist, the player appears to re-use cached video segments from before the most recent rendition was decided, so looping video keeps playing low quality initial segments instead of the same high quality for the entire loop on subsequent loops.

I'm not sure if the issue itself is in http-streaming or video.js itself, but since its comes up with adaptive streaming I'm reporting it here.

Sources

This is an example playlist https://videos.files.wordpress.com/ycTJj4dc/accueil_2_mp4.adaptive_4.m3u8

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. Use an adaptive streaming playlist as a source
  2. set the video player to loop and autoplay
  3. limitRenditionByPlayerDimensions: false helps reproduce if your test player is small, but with it on or off it still exhibits the same behaviour
  4. load the player, watch the video. If the quality level increases part way through the video, it will return to low quality video when the video loops until it reaches the section that it jumped to higher quality which will then return to high quality. As it loops, the initial segments will always be stuck at a lower quality

Results

Expected

I would expect the player to re-download segments that were already downloaded if the player decides that the client can handle higher quality video.

Error output

If there are any errors in the console, from the player, or anywhere else please include them here: none noticed

Additional Information

Please include any additional information necessary here. Including the following:

videojs-http-streaming version

what version of videojs-http-streaming does this occur with? videojs-http-streaming 2.15.1

videojs version

what version of videojs does this occur with? video.js 7.21.1

Browsers

what browsers are affected? please include browser and version for each

Platforms

what platforms are affected? please include operating system and version or device and version for each

Other Plugins

are any other videojs plugins being used on the page? If so, please list them with version below.

Other JavaScript

are you using any other javascript libraries or frameworks on the page? if so please list them below. *

video-archivist-bot commented 1 year ago

Hey! We've detected some video files in a comment on this issue. If you'd like to permanently archive these videos and tie them to this project, a maintainer of the project can reply to this issue with the following commands:

welcome[bot] commented 1 year ago

πŸ‘‹ Thanks for opening your first issue here! πŸ‘‹

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

misteroneill commented 1 year ago

Thanks for the report, that sounds unexpected. I think it should be clearing buffered segments. Someone would have to investigate this issue.

devenjahnke commented 1 year ago

I am also experiencing this issue.

adrums86 commented 1 year ago

This seems to be because we're not trimming the buffers for shorter media. Because we aren't trimming the buffer, the source buffers will play the content that was originally buffered (in this case the lower bitrate) on loop. This would require some work with the buffer trimming logic to properly fix. For now, as a workaround I would suggest locking the rendition to the desired quality https://github.com/videojs/http-streaming#vhsrepresentations

marten-wirelab commented 11 months ago

I'm having this same issue. @adrums86 can you give any indication about how long videos need to be for buffer trimming to kick in?