-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Player stalls on stream with audio gaps #2922
Comments
It is expected behavior for the player to stall on buffer gaps (even if only momentarily before pushing through small gaps). Is the actual expected behavior here that we fill those gaps with silence? Could you re-title this issue as "Audio gaps caused by segments missing audio filled with silence"? |
Thanks @robwalch, yes, the expected behavior is that the player would be silent during this period (this is what iPhone does). I'm not familiar with hls.js internals, but I guess there are 2 approaches to solving this -
Note that the m3u8 has EXT-X-DISCONTINUITY at the point where audio stops, this is required for smooth playback on iPhone - if I run a test live stream with audio gaps without discontinuity, the iPhone player will stall at the point where the audio is lost - it keeps loading more and more segments in the hope to find some audio in them. When I use discontinuity, it understands no audio is going to arrive, and just plays video-only. When the audio comes back, there is no need for discontinuity, it plays fine without it as well. Regarding the title of the issue, maybe I should change it to 'audio/video gaps', because the behavior on iPhone is completely symmetrical for missing audio/video. If we can have a solution that solves both, that would be great. One last note - when I ran my tests on iPhone, I also tested separate playlists for audio/video (using EXT-X-MEDIA). This changes things a bit, because instead of moving from video+audio segments to video-only segments, what happens is that some audio segments are just missing. I checked with Apple about this, and the recommendation is to mark the missing segments with EXT-X-GAP. According to them, all Apple operating systems release since late 2017 are "gap-aware" and will not even try to load these segments. |
Hi @erankor, hls.js can fill audio gaps within a segment that is supposed to contain audio, but it does not for video-only segments in this scenario (with discontinuity). It should - it needs to - to avoid stalling during playback. There's no option that I know of that will simply play over MSE source buffered AV where one of the tracks contains (large) gaps. Thanks for the sample stream and detailed explanation. Have a look at the mp4-remuxer. That is where audio silence is inserted (or in this case, not being inserted). |
"There's no option that I know of that will simply play over MSE source buffered AV where one of the tracks contains (large) gaps." - my thought was that maybe it can somehow reinitialize in 'video-only' mode, but I'm not familiar with MSE enough... Thanks! |
Hi @erankor, While I'm no longer able to access the stream, if I recall, this kind of situation would require the use of GAP tags to be properly supported and to adhere to the HLS spec. If you'd like us to reopen, please provide another test stream and use case. If you are interested in EXT-X-GAP tag support please +1 #2940. |
What version of Hls.js are you using?
demo v0.14.5
What browser and OS are you using?
Chrome 84.0.4147.89
Test stream:
https://lbd.kaltura.com:8001/audio-gaps/index-s1.m3u8
Checklist
Steps to reproduce
Play the test stream pasted above
Expected behavior
What you expected to happen
The stream has 20 sec of video+audio, 20 sec video-only, 12 sec video+audio, the expected behavior is that the video will play smoothly till the end, audio will of course become silent during the 20 sec video-only part.
This is the behavior seen when playing the stream on iPhone/Safari.
Actual behavior
What actually happened
The player stalls once it reaches the video-only part (slightly before 20 sec)
Console output
For media errors reported on Chrome browser, please also paste the output of chrome:https://media-internals
The text was updated successfully, but these errors were encountered: