http-streaming
http-streaming copied to clipboard
Video.js fails to re-buffer after a switch from alternate to main HLS audio tracks (ts), but only when the video is fully buffered
Description
When playing back content with an alternate audio tracks in HLS, users can switch freely between audio tracks during playback using the headphones menu in the corner.
In general this works as expected, and the user can swap back and forth.
However, if the stream is fully buffered, switching from a secondary audio track (unmuxed ts), back to a primary audio track (muxed ts) will cause playback to stall permanently.
Switching back from the secondary to primary muxed audio prints the following logs when the stall happens:
VIDEOJS: DEBUG: VHS: SourceUpdater > Removing 0 to 300 from audioBuffer
VIDEOJS: DEBUG: VHS: SourceUpdater > Removing 0 to 300 from videoBuffer
Here's a video demonstrating the issue: https://stream.new/v/OQksRvTDOb3bpOtGfoKKu00D8nu3fTLuoIrC00c2rrTJY
This is also reproducible with Apple's Bipbop stream, if you seek right to the end: https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8
Unfortunately this means that for short TS packaged HLS videos with multiple audio tracks it's possible to reliably stall playback.
Reduced test case
https://stream.mux.com/LBLes3TWmz8KLRZgDOwU01WTzcag8l3lR.m3u8
Steps to reproduce
- Load Video.js latest, for example use https://philcluff.co.uk/players/videojs-latest.html
- Play this stream:
https://stream.mux.com/LBLes3TWmz8KLRZgDOwU01WTzcag8l3lR.m3u8 - Seek to ~4:45, and make sure the video has finished buffering to the end of the stream
- Switch to alternate language (French)
- Switch to back to the main audio
- Observe the video re-buffers and stops playing
Errors
None
What version of Video.js are you using?
8.5.2
Video.js plugins used.
No response
What browser(s) including version(s) does this occur with?
Chrome 115.0.5790.170
What OS(es) and version(s) does this occur with?
MacOS
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:
- for https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8: say
@video-archivist-bot save nwRNmw - for https://stream.mux.com/LBLes3TWmz8KLRZgDOwU01WTzcag8l3lR.m3u8: say
@video-archivist-bot save 5wqBOA
Thanks for the detailed report, Phil!
+1 to what @misteroneill said. This is interesting one. It seems perhaps we have a race condition here, I noticed we're engaging some endOfStream logic here that appears to be getting into a bad state when we switch languages and clear the audio buffer around the same time. Will keep digging.
Moving this to VHS.
👋 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.