Skip to content
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

Getting BufferStalledError on Safari #5274

Closed
5 tasks done
leaofelipe opened this issue Mar 5, 2023 · 2 comments · Fixed by #6141
Closed
5 tasks done

Getting BufferStalledError on Safari #5274

leaofelipe opened this issue Mar 5, 2023 · 2 comments · Fixed by #6141

Comments

@leaofelipe
Copy link

leaofelipe commented Mar 5, 2023

What version of Hls.js are you using?

v1.3.4

What browser (including version) are you using?

Safari Version 16.2 (18614.3.7.1.5)

What OS (including version) are you using?

Mac OS Ventura 13.1

Test stream

https://hls-js.netlify.app/demo/?src=https%3A%2F%2Ftest-streams.mux.dev%2Fx36xhzz%2Fx36xhzz.m3u8&demoConfig=eyJlbmFibGVTdHJlYW1pbmciOnRydWUsImF1dG9SZWNvdmVyRXJyb3IiOnRydWUsInN0b3BPblN0YWxsIjpmYWxzZSwiZHVtcGZNUDQiOmZhbHNlLCJsZXZlbENhcHBpbmciOi0xLCJsaW1pdE1ldHJpY3MiOi0xfQ==

Configuration

{
  "debug": true,
  "enableWorker": true,
  "lowLatencyMode": true,
  "backBufferLength": 90
}

Additional player setup steps

No response

Checklist

Steps to reproduce

  1. Just Run HLS.JS demo page on Safari
  2. Wait for the end of the video, or navigate by the media control.
  3. When the video ends, or when I navigate to any part of the video on the media control, a Buffer stalled error is shown.

Expected behaviour

Is expected to not receive an error.

What actually happened?

Received a Buffer stalled error.

Console output

[Log] Using Hls.js config: – {debug: true, enableWorker: true, lowLatencyMode: true, …} (hls-demo.js, line 40582)
{debug: true, enableWorker: true, lowLatencyMode: true, backBufferLength: 90}Object
[Log] [log] >"Debug logs enabled for \"Hls instance\"" (hls.js, line 23651)
[Log] [log] >"stopLoad" (hls.js, line 15617)
[Log] [log] >"loadSource:https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8" (hls.js, line 15585)
[Log] [log] >"[stream-controller]:""Trigger BUFFER_RESET" (hls.js, line 8485)
[Log] [log] >"attachMedia" (hls.js, line 15558)
[Log] [log] >"[level-controller]:""manifest loaded, 5 level(s) found, first bitrate: 2149280" (hls.js, line 7197)
[Log] [log] >"1 bufferCodec event(s) expected" (hls.js, line 3174)
[Log] [log] >"startLoad(-1)" (hls.js, line 15607)
[Log] [log] >"[level-controller]:""switching to level 3 from -1" (hls.js, line 7536)
[Log] [log] >"[level-controller]:""Attempt loading level index 3 with URL-id 0 https://test-streams.mux.dev/x36xhzz/url_0/193039199_mp4_h264_aac_hd_7.m3u8" (hls.js, line 7445)
[Log] [log] >"[stream-controller]:""STOPPED->IDLE" (hls.js, line 3002)
[Log] [log] >"[subtitle-stream-controller]:""STOPPED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Level 3 loaded [0,63], cc [0, 0] duration:634.584" (hls.js, line 8536)
[Log] [log] >"[buffer-controller]: Media source opened" (hls.js, line 3085)
[Log] [log] >"[buffer-controller]: Updating Media Source duration to 634.584" (hls.js, line 3627)
[Log] [log] >"[stream-controller]:""Loading fragment 0 cc: 0 of [0-63] level: 3, target: 0" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"demuxing in webworker" (hls.js, line 13083)
[Log] [log] >"[transmuxer-interface, main]: Starting new transmux session for sn: 0 p: -1 level: 3 id: 1↵        discontinuity: true↵        trackSwitch…" (hls.js, line 13173)
"[transmuxer-interface, main]: Starting new transmux session for sn: 0 p: -1 level: 3 id: 1
        discontinuity: true
        trackSwitch: true
        contiguous: false
        accurateTimeOffset: true
        timeOffset: 0
        initSegmentChange: true"
[Log] [log] >"[stream-controller]:""Loaded fragment 0 of level 3" (hls.js, line 2180)
[Log] [log] >"Debug logs enabled for \"main\"" (76b2171e-12f3-494d-b89c-d564a969e395, line 633)
[Log] [log] >"[mp4-remuxer]: ISGenerated flag reset" (hls.js, line 13278)
[Log] [log] >"[mp4-remuxer]: initPTS & initDTS reset" (hls.js, line 13278)
[Log] [log] >"[mp4-remuxer]: reset next timestamp" (hls.js, line 13278)
[Log] [log] >"manifest codec:mp4a.40.2, ADTS type:2, samplingIndex:4" (hls.js, line 13278)
[Log] [log] >"parsed codec:mp4a.40.5, rate:44100, channels:2" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Init audio buffer, container:audio/mp4, codecs[selected/level/parsed]=[mp4a.40.2/mp4a.40.2/mp4a.40.5]" (hls.js, line 9045)
[Log] [log] >"[stream-controller]:""Init video buffer, container:video/mp4, codecs[level/parsed]=[avc1.64001f/avc1.64001f]" (hls.js, line 9050)
[Log] [log] >"[buffer-controller]: creating sourceBuffer(audio/mp4;codecs=mp4a.40.2)" (hls.js, line 3687)
[Log] [log] >"[buffer-controller]: creating sourceBuffer(video/mp4;codecs=avc1.64001f)" (hls.js, line 3687)
[Log] [log] >"[audio-stream-controller]:""InitPTS for cc: 0 found from main: 900909" (hls.js, line 784)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 0 of level 3" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 0 of level 3 (frag:[0.000-10.023] > buffer:[0.023-10.008])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[level-controller]:""switching to level 4 from 3" (hls.js, line 7536)
[Log] [log] >"[level-controller]:""Attempt loading level index 4 with URL-id 0 https://test-streams.mux.dev/x36xhzz/url_8/193039199_mp4_h264_aac_fhd_7.m3u8" (hls.js, line 7445)
[Log] [log] >"[stream-controller]:""IDLE->WAITING_LEVEL" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Level 4 loaded [0,63], cc [0, 0] duration:634.567" (hls.js, line 8536)
[Log] [log] >"[stream-controller]:""WAITING_LEVEL->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 1 cc: 0 of [0-63] level: 4, target: 10.008" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[transmuxer-interface, main]: Starting new transmux session for sn: 1 p: -1 level: 4 id: 1↵        discontinuity: false↵      …" (hls.js, line 13173)
"[transmuxer-interface, main]: Starting new transmux session for sn: 1 p: -1 level: 4 id: 1
        discontinuity: false
        trackSwitch: true
        contiguous: false
        accurateTimeOffset: true
        timeOffset: 10
        initSegmentChange: false"
[Log] [log] >"[stream-controller]:""Loaded fragment 1 of level 4" (hls.js, line 2180)
[Log] [log] >"[mp4-remuxer]: ISGenerated flag reset" (hls.js, line 13278)
[Log] [log] >"[mp4-remuxer]: initPTS & initDTS reset" (hls.js, line 13278)
[Log] [log] >"[mp4-remuxer]: reset next timestamp" (hls.js, line 13278)
[Log] [log] >"manifest codec:mp4a.40.2, ADTS type:2, samplingIndex:4" (hls.js, line 13278)
[Log] [log] >"parsed codec:mp4a.40.5, rate:44100, channels:2" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Init audio buffer, container:audio/mp4, codecs[selected/level/parsed]=[mp4a.40.2/mp4a.40.2/mp4a.40.5]" (hls.js, line 9045)
[Log] [log] >"[stream-controller]:""Init video buffer, container:video/mp4, codecs[level/parsed]=[avc1.640028/avc1.640028]" (hls.js, line 9050)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 1 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 1 of level 4 (frag:[10.008-20.023] > buffer:[0.023-19.992])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 2 cc: 0 of [0-63] level: 4, target: 19.992" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 2 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 2 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 2 of level 4 (frag:[19.992-30.023] > buffer:[0.023-30.000])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 3 cc: 0 of [0-63] level: 4, target: 30" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 3 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 3 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 3 of level 4 (frag:[30.000-40.023] > buffer:[0.023-40.008])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 4 cc: 0 of [0-63] level: 4, target: 40.008" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 4 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 4 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 4 of level 4 (frag:[40.008-50.023] > buffer:[0.023-49.993])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 5 cc: 0 of [0-63] level: 4, target: 49.993" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 5 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 5 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 5 of level 4 (frag:[49.993-60.023] > buffer:[0.023-60.000])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 6 cc: 0 of [0-63] level: 4, target: 60" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 6 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 6 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 6 of level 4 (frag:[60.000-70.023] > buffer:[0.023-70.008])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 7 cc: 0 of [0-63] level: 4, target: 70.008" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 7 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 7 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 7 of level 4 (frag:[70.008-79.957] > buffer:[0.023-79.946])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Warning] [warn] >"skipping hole, adjusting currentTime from 0 to 0.1" (hls.js, line 6409)
[Log] [log] >"[stream-controller]:""media seeking to 0.100, state: IDLE" (hls.js, line 2092)
[Log] [log] >"[audio-stream-controller]:""media seeking to 0.100, state: STOPPED" (hls.js, line 2092)
[Log] [log] >"[subtitle-stream-controller]:""media seeking to 0.100, state: IDLE" (hls.js, line 2092)
[Log] [log] >"[stream-controller]:""Media seeked to 0.100" (hls.js, line 8477)
[Log] [log] >"[stream-controller]:""media seeking to 226.546, state: IDLE" (hls.js, line 2092)
[Log] [log] >"[stream-controller]:""Reset loading state" (hls.js, line 2927)
[Log] [log] >"[audio-stream-controller]:""media seeking to 226.546, state: STOPPED" (hls.js, line 2092)
[Log] [log] >"[subtitle-stream-controller]:""media seeking to 226.546, state: IDLE" (hls.js, line 2092)
[Log] [log] >"[stream-controller]:""Loading fragment 22 cc: 0 of [0-63] level: 4, target: 226.546" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""media seeking to 226.546, state: FRAG_LOADING" (hls.js, line 2092)
[Log] [log] >"[audio-stream-controller]:""media seeking to 226.546, state: STOPPED" (hls.js, line 2092)
[Log] [log] >"[subtitle-stream-controller]:""media seeking to 226.546, state: IDLE" (hls.js, line 2092)
[Log] [log] >"[stream-controller]:""Media seeked to 226.546" (hls.js, line 8477)
[Log] [log] >"[transmuxer-interface, main]: Starting new transmux session for sn: 22 p: -1 level: 4 id: 1↵        discontinuity: false↵      …" (hls.js, line 13173)
"[transmuxer-interface, main]: Starting new transmux session for sn: 22 p: -1 level: 4 id: 1
        discontinuity: false
        trackSwitch: false
        contiguous: false
        accurateTimeOffset: true
        timeOffset: 220.01330385488237
        initSegmentChange: false"
[Log] [log] >"[stream-controller]:""Loaded fragment 22 of level 4" (hls.js, line 2180)
[Log] [log] >"[mp4-remuxer]: reset next timestamp" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 22 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 22 of level 4 (frag:[220.009-230.023] > buffer:[0.023-79.946][220.023-229.994])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 23 cc: 0 of [0-63] level: 4, target: 229.994" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 23 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 23 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 23 of level 4 (frag:[229.994-240.023] > buffer:[0.023-79.946][220.023-240.001])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 24 cc: 0 of [0-63] level: 4, target: 240.001" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 24 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 24 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 24 of level 4 (frag:[240.001-250.023] > buffer:[0.023-79.946][220.023-250.009])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 25 cc: 0 of [0-63] level: 4, target: 250.009" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Warning] [warn] >"Playback stalling at @226.546488 due to low buffer ({\"len\":23.462763700680256,\"start\":220.02322222222222,\"end\":250.00925170068027})" (hls.js, line 6379)
[Warning] [warn] >"[playback-rate-controller]: Stall detected, adjusting target latency" (hls.js, line 6877)
[Warning] Error event: – {type: "mediaError", details: "bufferStalledError", fatal: false, …} (hls-demo.js, line 40911)
{type: "mediaError", details: "bufferStalledError", fatal: false, buffer: 23.462763700680256}Object
[Log] [log] >"[stream-controller]:""Loaded fragment 25 of level 4" (hls.js, line 2180)
[Log] [log] >"[buffer-controller]: Removing [0,128.13240625] from the audio SourceBuffer" (hls.js, line 3770)
[Log] [log] >"[buffer-controller]: Removing [0,128.13240625] from the video SourceBuffer" (hls.js, line 3770)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 25 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Warning] [warn] >"playback not stuck anymore @307.13865599999997, after 405ms" (hls.js, line 6252)
[Log] [log] >"[stream-controller]:""media seeking to 307.139, state: PARSED" (hls.js, line 2092)
[Log] [log] >"[stream-controller]:""Reset loading state" (hls.js, line 2927)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[audio-stream-controller]:""media seeking to 307.139, state: STOPPED" (hls.js, line 2092)
[Log] [log] >"[subtitle-stream-controller]:""media seeking to 307.139, state: IDLE" (hls.js, line 2092)
[Log] [log] >"[stream-controller]:""Loading fragment 30 cc: 0 of [0-63] level: 4, target: 307.139" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Warning] [warn] >"[stream-controller]:""Fragment 25 of level 4 finished buffering, but was aborted. state: FRAG_LOADING" (hls.js, line 8704)
[Log] [log] >"[stream-controller]:""media seeking to 307.139, state: FRAG_LOADING" (hls.js, line 2092)
[Log] [log] >"[audio-stream-controller]:""media seeking to 307.139, state: STOPPED" (hls.js, line 2092)
[Log] [log] >"[subtitle-stream-controller]:""media seeking to 307.139, state: IDLE" (hls.js, line 2092)
[Log] [log] >"[transmuxer-interface, main]: Starting new transmux session for sn: 30 p: -1 level: 4 id: 1↵        discontinuity: false↵      …" (hls.js, line 13173)
"[transmuxer-interface, main]: Starting new transmux session for sn: 30 p: -1 level: 4 id: 1
        discontinuity: false
        trackSwitch: false
        contiguous: false
        accurateTimeOffset: true
        timeOffset: 299.9268396825484
        initSegmentChange: false"
[Log] [log] >"[stream-controller]:""Loaded fragment 30 of level 4" (hls.js, line 2180)
[Log] [log] >"[mp4-remuxer]: reset next timestamp" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 30 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 30 of level 4 (frag:[299.932-310.023] > buffer:[220.023-259.994][299.957-310.010])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 31 cc: 0 of [0-63] level: 4, target: 310.01" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Media seeked to 307.139" (hls.js, line 8477)
[Log] [log] >"[stream-controller]:""Loaded fragment 31 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 31 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 31 of level 4 (frag:[310.010-320.023] > buffer:[220.023-259.994][299.957-319.994])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 32 cc: 0 of [0-63] level: 4, target: 319.994" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 32 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 32 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 32 of level 4 (frag:[319.994-330.023] > buffer:[220.023-259.994][299.957-330.002])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 33 cc: 0 of [0-63] level: 4, target: 330.002" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 33 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 33 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 33 of level 4 (frag:[330.002-340.023] > buffer:[220.023-259.994][299.957-340.010])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 34 cc: 0 of [0-63] level: 4, target: 340.01" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 34 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 34 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 34 of level 4 (frag:[340.010-350.023] > buffer:[220.023-259.994][299.957-349.994])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 35 cc: 0 of [0-63] level: 4, target: 349.994" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 35 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 35 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 35 of level 4 (frag:[349.994-360.023] > buffer:[220.023-259.994][299.957-360.002])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 36 cc: 0 of [0-63] level: 4, target: 360.002" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 36 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 36 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 36 of level 4 (frag:[360.002-370.023] > buffer:[220.023-259.994][299.957-370.010])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 37 cc: 0 of [0-63] level: 4, target: 370.01" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 37 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 37 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 37 of level 4 (frag:[370.010-380.023] > buffer:[220.023-259.994][299.957-379.995])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loading fragment 38 cc: 0 of [0-63] level: 4, target: 379.995" (hls.js, line 2383)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Loaded fragment 38 of level 4" (hls.js, line 2180)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.js, line 3002)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 38 of level 4" (hls.js, line 13278)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.js, line 3002)
[Log] [log] >"[stream-controller]:""Buffered main sn: 38 of level 4 (frag:[379.995-390.023] > buffer:[220.023-259.994][299.957-390.002])" (hls.js, line 2284)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.js, line 3002)

Chrome media internals output

No response

@leaofelipe leaofelipe added Bug Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Mar 5, 2023
@robwalch
Copy link
Collaborator

robwalch commented Mar 6, 2023

It looks like after the MediaSource is put in the "ended" state, when seeking outside of the buffered ranges, Safari issues "seeked" events without waiting for media in the buffer to be able to play. This leads to these seeking being treated as stalls as the player buffers media.

@robwalch robwalch added Confirmed and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Mar 6, 2023
@robwalch
Copy link
Collaborator

robwalch commented Mar 6, 2023

I'm finding the behavior in Safari is intermittent, and not directly related to the MediaSource ended state.

When seeking in a "bad session", Safari will emit:
"seeking"
"seeked" (with buffer empty)
"waiting" (this is considered a stall)
"canplay" (this is where HLS.js has waited too long for currentTime to advance and reports a stall just before playback recovers)
This is pretty consistent for every seek issued after playback has started after refreshing the page without pausing the player.

In a good session, the seek related events match the expected behavior observed in other browsers:
"seeking"
"waiting"
"seeked" (media is buffered)
"canplay" (currentTime is advancing normally)

HLS.js doesn't depend on these events. It depends on changes to the .seeking state and .currentTime of the media element to determine if playback has stalled during normal playback, or after coming out of a seek (but not while seeking). Part of looking into this behavior was to see if using "waiting" and "canplay" would help track stalls more reliably, but that doesn't seem to be the case. I'll keep digging, but so far I don't have an answer as to why this behavior is inconsistent, and I don't yet have a workaround for it.

It's worth noting that in the "bad session" scenario, currentTime does not advance for at least 1/4s after canplay is issued (and media has been buffered) which is why HLS.js reports a stall.

robwalch added a commit that referenced this issue Mar 8, 2023
robwalch added a commit that referenced this issue Mar 11, 2023
robwalch added a commit that referenced this issue Mar 23, 2023
robwalch added a commit that referenced this issue Mar 23, 2023
* Handle fragments and parts with a GAP tag/attribute
* Improve GAP fragment picking, post gap buffering, and level switching error resolution
* Cleanup FRAG_GAP error creation and inlcude current buffer length in forward gap buffer limit
* Fix gap jump over waiting for data stall when buffer length is larger than maxBufferHole but less than one second
* Warn when observing "seeked" event with empty buffer (Related to #5274)
* Handle forward buffering past GAP tags in alt audio Playlists
* Fix GAP tag handling with Redundant Streams
* Implement penalty box for Redundant Streams
@leaofelipe leaofelipe changed the title Getting BufferStalledError on Safari when i Getting BufferStalledError on Safari Apr 25, 2023
@robwalch robwalch added this to the 1.6.0 milestone Jan 24, 2024
@robwalch robwalch mentioned this issue Jan 24, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants