What do you want to do with Hls.js?
I'm playing a live audio stream that keeps the last few hours of the stream available. When seeking, I often get bufferSeekOverHole and the cursor jumps back to the previously playing time. How do I prevent this?
What have you tried so far?
I'm seeking by setting audio.currentTime = value;
Using hls.js 0.14.16
As is visible in the log, I seek to 16304 but it jumps back to the previous play position 17931. How can I enforce playing from the given play position?
Initialization:
let hls = new Hls({
// required so we can seek in the past
liveDurationInfinity: true,
// we want to set the start position manually to liveSyncPosition,
// otherwise it starts at beginning of stream
autoStartLoad: false,
});
Relevant log excerpt:
[log] > media source opened hls.js:21507:12
hls Media Attached https://mcdn.br.de/br/hf/brklassik/master.m3u8 hls.ts:30:13
[log] > loadSource:https://mcdn.br.de/br/hf/brklassik/master.m3u8 hls.js:21507:12
[debug] > Loading playlist of type manifest, level: 0, id: null hls.js:21507:12
[debug] > Calling internal loader delegate for URL: https://mcdn.br.de/br/hf/brklassik/master.m3u8 hls.js:21507:12
[log] > trigger BUFFER_RESET hls.js:21507:12
[log] > manifest loaded,3 level(s) found, first bitrate:106240 hls.js:21507:12
[log] > 1 bufferCodec event(s) expected hls.js:21507:12
[log] > audio tracks updated hls.js:21507:12
manifest loaded, found 3 quality level hls.ts:33:15
[log] > startLoad(-1) hls.js:21507:12
[log] > switching to level 0 hls.js:21507:12
[debug] > Loading playlist of type level, level: 0, id: 0 hls.js:21507:12
[debug] > Calling internal loader delegate for URL: https://mcdn.br.de/br/hf/brklassik/master-96000.m3u8 hls.js:21507:12
[log] > main stream-controller: STOPPED->IDLE hls.js:21507:12
[log] > audio stream:STOPPED->STARTING hls.js:21507:12
[log] > audio stream:STARTING->WAITING_TRACK hls.js:21507:12
[log] > subtitle tracks updated hls.js:21507:12
[log] > live playlist, reload in 2851 ms hls.js:21507:12
[log] > level 0 loaded [4103997,4109996],duration:17939.999999999793 hls.js:21507:12
[log] > live playlist - first load, unknown sliding hls.js:21507:12
[log] > configure startPosition to 17930.999999999793 hls.js:21507:12
...
[log] > Media Source duration is set to Infinity hls.js:21507:12
[log] > Loading 4109449 of [4103999-4109998], level 2, currentTime: 16304.99, bufferEnd: 16304.99 hls.js:21507:12
[log] > main stream-controller: IDLE->FRAG_LOADING hls.js:21507:12
seeking store.ts:175:26
[log] > media seeking to 16304.990 hls.js:21507:12
[log] > seeking outside of buffer but within currently loaded fragment range hls.js:21507:12
[log] > media seeking to 16304.990 hls.js:21507:12
waiting store.ts:181:26
seeking store.ts:175:26
[log] > media seeking to 16304.990 hls.js:21507:12
[log] > seeking outside of buffer but within currently loaded fragment range hls.js:21507:12
[log] > media seeking to 16304.990 hls.js:21507:12
[log] > Loaded 4109449 of [4103999 ,4109998],level 2 hls.js:21507:12
[log] > Parsing 4109449 of [4103999 ,4109998],level 2, cc 0 hls.js:21507:12
[log] > main stream-controller: FRAG_LOADING->PARSING hls.js:21507:12
[log] > Parsed audio,PTS:[28233.761,28236.748],DTS:[28233.761/28236.748],nb:140,dropped:0 hls.js:21507:12
[log] > main stream-controller: PARSING->PARSED hls.js:21507:12
[log] > main buffered : [17931.030,17945.963][28233.761,28236.748] hls.js:21507:12
[log] > latency/loading/parsing/append/kbps:82/2/5/1/6868 hls.js:21507:12
[log] > main stream-controller: PARSED->IDLE hls.js:21507:12
[log] > Re-loading fragment with SN: 4109450 hls.js:21507:12
[log] > Loading 4109450 of [4103999-4109998], level 2, currentTime: 16304.99, bufferEnd: 16304.99 hls.js:21507:12
[log] > main stream-controller: IDLE->FRAG_LOADING hls.js:21507:12
[log] > Media Source duration is set to Infinity hls.js:21507:12
[warn] > skipping hole, adjusting currentTime from 16304.990000000005 to 17931.079999999998 react_devtools_backend.js:2430:23
Hls.Events.ERROR hlsError
Object { type: "mediaError", details: "bufferSeekOverHole", fatal: false, reason: "fragment loaded with buffer holes, seeking from 16304.990000000005 to 17931.079999999998", frag: {鈥 }
react_devtools_backend.js:2430:23
bufferSeekOverHole hls.ts:56:17
seeking store.ts:175:26
[log] > media seeking to 17931.080 2 hls.js:21507:12
seeked store.ts:178:26
[log] > media seeked to 17931.080 hls.js:21507:12
[log] > Loaded 4109450 of [4103999 ,4109998],level 2 hls.js:21507:12
[log] > Parsing 4109450 of [4103999 ,4109998],level 2, cc 0 hls.js:21507:12
Hi @eteubert,
Configuring maxBufferHole and highBufferWatchdogPeriod will change when the gap-controller tries to nudge out of a stall. It can even prevent that behavior completely by increasing highBufferWatchdogPeriod indefinitely.
Reporting a stall while seeking and media is still loading is a bug. I hope to fix this after v1.0. For now, I hope this info helps.
For details on these and other config options see https://github.com/video-dev/hls.js/blob/master/docs/API.md
Playing with the mentioned configs did not do anything for me.
However I can see that the beta build on https://hls-js-dev.netlify.app/demo/ does not seem to have this issue any more, so I'll give the beta a try and/or wait for 1.0 馃憤
OK. Please give a mention here or file a new issue if you run into a problem with v1.0.0 or the release candidates.