Skip to content

hls.js stalls shortly on audio buffer gap #6169

Closed
@ghouet

Description

@ghouet

What version of Hls.js are you using?

v1.5.3,v1.4.14,v1.3.5

What browser (including version) are you using?

Chrome Version 121.0.6167.85 (Official Build) (x86_64)

What OS (including version) are you using?

Mac OS Sonoma 14.3

Test stream

https://storage.googleapis.com/trumantest-public/audio_gap/index.m3u8

Configuration

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

Additional player setup steps

No response

Checklist

Steps to reproduce

  1. Got to https://hlsjs.video-dev.org/demo/?src=https://storage.googleapis.com/trumantest-public/audio_gap/index.m3u8
  2. Wait for the end of the ad and notice the loading spinner before returning to content

Expected behaviour

No loading spinner before returning to content, smooth playback.
Other players like safari shows no issue.

What actually happened?

Ad the end of the ad before returning to content, the player shows a loading spinner.
Console shows the folowing error:
type: 'mediaError', details: 'bufferStalledError', fatal: false, error: Error: Playback stalling at @31.719066 due to low buffer ({"len":0.05159999999999698,"start":0.12,"…, buffer: 0.05159999999999698, …}
Then bufferNudgeOnStall makes the player resume playing normally.

A gap in audio content shouldn't cause a bufferStalledError, in fact the next media content is there it's just that there is no audio to play for a brief amount of time (<0.07s) before playing the next segment.

Console output

bufferNudgeOnStall', error: Error: Nudging 'currentTime' from 31.719066 to 31.819066000000003
    at GapController._tryNudgeBuf…, fatal: false, errorAction: {…}}details: "bufferNudgeOnStall"error: Error: Nudging 'currentTime' from 31.719066 to 31.819066000000003
    at GapController._tryNudgeBuffer (https://hlsjs.video-dev.org/dist/hls.js:27158:21)
    at GapController._tryFixBufferStall (https://hlsjs.video-dev.org/dist/hls.js:27039:14)
    at GapController.poll (https://hlsjs.video-dev.org/dist/hls.js:27000:12)
    at StreamController.checkBuffer (https://hlsjs.video-dev.org/dist/hls.js:27877:23)
    at StreamController.onTickEnd (https://hlsjs.video-dev.org/dist/hls.js:27326:12)
    at StreamController.doTick (https://hlsjs.video-dev.org/dist/hls.js:27322:12)
    at StreamController.tick (https://hlsjs.video-dev.org/dist/hls.js:7870:14)errorAction: {action: 0, flags: 0}fatal: falsetype: "mediaError"[[Prototype]]: Object
(anonymous) @ main.js:734
emit @ index.js:203
emit @ hls.ts:310
trigger @ hls.ts:318
_tryNudgeBuffer @ gap-controller.ts:353
_tryFixBufferStall @ gap-controller.ts:214
poll @ gap-controller.ts:168
checkBuffer @ stream-controller.ts:945
onTickEnd @ stream-controller.ts:217
doTick @ stream-controller.ts:212
tick @ task-loop.ts:106
setInterval (async)
setInterval @ task-loop.ts:68
startLoad @ stream-controller.ts:127
(anonymous) @ hls.ts:434
startLoad @ hls.ts:433
filterAndSortMediaOptions @ level-controller.ts:376
onManifestLoaded @ level-controller.ts:200
emit @ index.js:203
emit @ hls.ts:310
trigger @ hls.ts:318
handleMasterPlaylist @ playlist-loader.ts:429
onSuccess @ playlist-loader.ts:327
readystatechange @ xhr-loader.ts:239
XMLHttpRequest.send (async)
openAndSendXhr @ xhr-loader.ts:166
loadInternal @ xhr-loader.ts:125
load @ xhr-loader.ts:84
load @ playlist-loader.ts:352
onManifestLoading @ playlist-loader.ts:154
emit @ index.js:203
emit @ hls.ts:310
trigger @ hls.ts:318
loadSource @ hls.ts:420
loadSelectedStream @ main.js:372
(anonymous) @ main.js:130
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
Show 3 more frames
Show less
base-stream-controller.ts:241 [log] > [stream-controller]: media seeking to 31.819, state: ENDED
base-stream-controller.ts:1639 [log] > [stream-controller]: Reset loading state
base-stream-controller.ts:1781 [log] > [stream-controller]: ENDED->IDLE
base-stream-controller.ts:241 [log] > [audio-stream-controller]: media seeking to 31.819, state: ENDED
base-stream-controller.ts:1639 [log] > [audio-stream-controller]: Reset loading state
base-stream-controller.ts:1781 [log] > [audio-stream-controller]: ENDED->IDLE
base-stream-controller.ts:241 [log] > [subtitle-stream-controller]: media seeking to 31.819, state: IDLE
buffer-controller.ts:632 [log] > [buffer-controller] Queueing mediaSource.endOfStream()
base-stream-controller.ts:1781 [log] > [stream-controller]: IDLE->ENDED
buffer-controller.ts:643 [log] > [buffer-controller] Could not call mediaSource.endOfStream(). mediaSource.readyState: ended
buffer-controller.ts:632 [log] > [buffer-controller] Queueing mediaSource.endOfStream()
base-stream-controller.ts:1781 [log] > [audio-stream-controller]: IDLE->ENDED
buffer-controller.ts:643 [log] > [buffer-controller] Could not call mediaSource.endOfStream(). mediaSource.readyState: ended
stream-controller.ts:555 [log] > [stream-controller]: Media seeked to 31.819

Chrome media internals output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      Top priorities

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions