video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.97k stars 2.59k forks source link

HLS interstitials freezes while playing #6765

Open acris5 opened 1 month ago

acris5 commented 1 month ago

What version of Hls.js are you using?

c8ee777226212008e21e73e1da8a2569d0cf1849

What browser (including version) are you using?

Chrome

What OS (including version) are you using?

Ubuntu 24.04

Test stream

No response

Configuration

USE_INTERSTITALS=true INTERSTITALS=true npm run build

Additional player setup steps

 cat video.m3u8 
#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/shaka-project/shaka-packager version 1d478935ae-release
#EXT-X-TARGETDURATION:3
#EXT-X-MEDIA-SEQUENCE:898
#EXT-X-PROGRAM-DATE-TIME:2024-10-08T15:46:59.807Z
#EXT-X-MAP:URI="video_init.mp4"
#EXTINF:2.000,
video_899.m4s
#EXTINF:2.000,
video_900.m4s
#EXTINF:2.000,
video_901.m4s
#EXT-X-DATERANGE:ID="id3",CLASS="com.apple.hls.interstitial",START-DATE="2024-10-08T15:47:06.391Z",DURATION=215.000,X-RESUME-OFFSET=215,X-ASSET-URI="http://127.0.0.1/advert/index.m3u8",X-TIMELINE-OCCUPIES="RANGE"
#EXTINF:2.000,
video_902.m4s
#EXTINF:2.000,
video_903.m4s
#EXTINF:2.000,
video_904.m4s
#EXTINF:2.000,
video_905.m4s

Checklist

Steps to reproduce

  1. I generate Live Hls playlist
  2. Insert Ext-x-datetime tag when scte35 comes

Expected behaviour

Interstitial loads and plays while duration of Ext-x-datetime, then video playback resumes

What actually happened?

Interstitial loads and plays first 5 seconds then I see grey screen only, no video resume In browser log "interstitials-controller.ts:1427 [warn] > [interstitials]: Interstitial "1" removed while playing"

Console output

[1-1-2633930073] [log] > [stream-controller]: PARSED->IDLE
base-stream-controller.ts:896 [1-1-2633930073] [log] > [stream-controller]: Loading main sn: 91 of level 0 (frag:[182.165-184.165]) cc: 0 [0-97], target: 182.165
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: IDLE->FRAG_LOADING
base-stream-controller.ts:517 [1-1-2633930073] [log] > [stream-controller]: Loaded main sn: 91 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: FRAG_LOADING->PARSING
transmuxer-interface.ts:394 [1-1-2633930073] [log] > [transmuxer.ts]: Flushed main sn: 91 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSING->PARSED
base-stream-controller.ts:1945 [1-1-2633930073] [log] > [stream-controller]: Parsed main sn: 91 of level 0 (frag:[182.165-184.226])
base-stream-controller.ts:703 [1-1-2633930073] [log] > [stream-controller]: Buffered main sn: 91 of level 0 (frag:[182.165-184.226] > buffer:[0.226-184.149])
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSED->IDLE
base-stream-controller.ts:896 [1-1-2633930073] [log] > [stream-controller]: Loading main sn: 92 of level 0 (frag:[184.149-186.149]) cc: 0 [0-97], target: 184.149
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: IDLE->FRAG_LOADING
base-stream-controller.ts:517 [1-1-2633930073] [log] > [stream-controller]: Loaded main sn: 92 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: FRAG_LOADING->PARSING
transmuxer-interface.ts:394 [1-1-2633930073] [log] > [transmuxer.ts]: Flushed main sn: 92 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSING->PARSED
base-stream-controller.ts:1945 [1-1-2633930073] [log] > [stream-controller]: Parsed main sn: 92 of level 0 (frag:[184.149-186.226])
base-stream-controller.ts:703 [1-1-2633930073] [log] > [stream-controller]: Buffered main sn: 92 of level 0 (frag:[184.149-186.226] > buffer:[0.226-186.155])
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSED->IDLE
base-stream-controller.ts:896 [1-1-2633930073] [log] > [stream-controller]: Loading main sn: 93 of level 0 (frag:[186.155-188.155]) cc: 0 [0-97], target: 186.155
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: IDLE->FRAG_LOADING
base-stream-controller.ts:517 [1-1-2633930073] [log] > [stream-controller]: Loaded main sn: 93 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: FRAG_LOADING->PARSING
transmuxer-interface.ts:394 [1-1-2633930073] [log] > [transmuxer.ts]: Flushed main sn: 93 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSING->PARSED
base-stream-controller.ts:1945 [1-1-2633930073] [log] > [stream-controller]: Parsed main sn: 93 of level 0 (frag:[186.155-188.226])
base-stream-controller.ts:703 [1-1-2633930073] [log] > [stream-controller]: Buffered main sn: 93 of level 0 (frag:[186.155-188.226] > buffer:[0.226-188.160])
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSED->IDLE
base-stream-controller.ts:896 [1-1-2633930073] [log] > [stream-controller]: Loading main sn: 94 of level 0 (frag:[188.160-190.160]) cc: 0 [0-97], target: 188.16
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: IDLE->FRAG_LOADING
base-stream-controller.ts:517 [1-1-2633930073] [log] > [stream-controller]: Loaded main sn: 94 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: FRAG_LOADING->PARSING
transmuxer-interface.ts:394 [1-1-2633930073] [log] > [transmuxer.ts]: Flushed main sn: 94 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSING->PARSED
base-stream-controller.ts:1945 [1-1-2633930073] [log] > [stream-controller]: Parsed main sn: 94 of level 0 (frag:[188.160-190.226])
base-stream-controller.ts:703 [1-1-2633930073] [log] > [stream-controller]: Buffered main sn: 94 of level 0 (frag:[188.160-190.226] > buffer:[0.226-190.165])
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSED->IDLE
base-stream-controller.ts:896 [1-1-2633930073] [log] > [stream-controller]: Loading main sn: 95 of level 0 (frag:[190.165-192.165]) cc: 0 [0-97], target: 190.165
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: IDLE->FRAG_LOADING
base-stream-controller.ts:517 [1-1-2633930073] [log] > [stream-controller]: Loaded main sn: 95 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: FRAG_LOADING->PARSING
transmuxer-interface.ts:394 [1-1-2633930073] [log] > [transmuxer.ts]: Flushed main sn: 95 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSING->PARSED
base-stream-controller.ts:1945 [1-1-2633930073] [log] > [stream-controller]: Parsed main sn: 95 of level 0 (frag:[190.165-192.226])
base-stream-controller.ts:703 [1-1-2633930073] [log] > [stream-controller]: Buffered main sn: 95 of level 0 (frag:[190.165-192.226] > buffer:[0.226-192.149])
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSED->IDLE
base-stream-controller.ts:896 [1-1-2633930073] [log] > [stream-controller]: Loading main sn: 96 of level 0 (frag:[192.149-194.149]) cc: 0 [0-97], target: 192.149
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: IDLE->FRAG_LOADING
base-stream-controller.ts:517 [1-1-2633930073] [log] > [stream-controller]: Loaded main sn: 96 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: FRAG_LOADING->PARSING
transmuxer-interface.ts:394 [1-1-2633930073] [log] > [transmuxer.ts]: Flushed main sn: 96 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSING->PARSED
base-stream-controller.ts:1945 [1-1-2633930073] [log] > [stream-controller]: Parsed main sn: 96 of level 0 (frag:[192.149-194.226])
base-stream-controller.ts:703 [1-1-2633930073] [log] > [stream-controller]: Buffered main sn: 96 of level 0 (frag:[192.149-194.226] > buffer:[0.226-194.155])
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSED->IDLE
base-stream-controller.ts:896 [1-1-2633930073] [log] > [stream-controller]: Loading main sn: 97 of level 0 (frag:[194.155-194.715]) cc: 0 [0-97], target: 194.155
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: IDLE->FRAG_LOADING
base-stream-controller.ts:517 [1-1-2633930073] [log] > [stream-controller]: Loaded main sn: 97 of level 0
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: FRAG_LOADING->PARSING
transmuxer-interface.ts:394 [1-1-2633930073] [log] > [transmuxer.ts]: Flushed main sn: 97 of level 0
interstitials-controller.ts:1934 [log] > [interstitials]: Interstitial asset "1-1-2633930073" duration change 194.72533333333334 > 195.43466666666666
interstitials-controller.ts:1413 [log] > [interstitials]: Interstitial events (1): ["1" 104.00-234.00]
Schedule: [primary: 0.00-104.00],["1": 104.00-234.00],[primary: 234.00-Infinity]
scte35_3.html:97 Thu Oct 10 2024 16:31:24 GMT+0300 (Moscow Standard Time) HLS Intersticial Events INTERSTITIALS_UPDATED hlsInterstitialsUpdated 
Data {events: Array(1), schedule: Array(3), durations: {…}, removedIds: Array(0)}
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSING->PARSED
base-stream-controller.ts:1945 [1-1-2633930073] [log] > [stream-controller]: Parsed main sn: 97 of level 0 (frag:[194.155-195.435])
base-stream-controller.ts:703 [1-1-2633930073] [log] > [stream-controller]: Buffered main sn: 97 of level 0 (frag:[194.155-195.435] > buffer:[0.226-194.786])
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: PARSED->IDLE
buffer-controller.ts:1033 [1-1-2633930073] [log] > [buffer-controller]: video buffer reached EOS
buffer-controller.ts:1033 [1-1-2633930073] [log] > [buffer-controller]: audio buffer reached EOS
buffer-controller.ts:1045 [1-1-2633930073] [log] > [buffer-controller]: Queueing EOS
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: IDLE->ENDED
buffer-controller.ts:1065 [1-1-2633930073] [log] > [buffer-controller]: Calling mediaSource.endOfStream()
interstitials-controller.ts:1969 [log] > [interstitials]: buffered to end of asset HlsAssetPlayer: ["1-1-2633930073" 104.00-299.43] 80db8c9a-d3ed-42ad-b28d-6275dee25641 
interstitials-controller.ts:1637 [log] > [interstitials]: buffered to boundary [primary: 234.00-Infinity] (193.77 remaining)
hls.ts:571 [1-1-2633930073] [log] > pause buffering
hls.ts:522 [log] > startLoad(122.59760009765625)
hls.ts:556 [1-1-2633930073] [log] > resume buffering
level-controller.ts:647 [log] > [level-controller]: Loading level index 0 with http://127.0.0.1:8081/test_app/bitrate_1/video.m3u8
base-stream-controller.ts:1983 [log] > [stream-controller]: STOPPED->IDLE
audio-track-controller.ts:422 [log] > [audio-track-controller]: loading audio-track playlist 0 "stream_0" lang:ru group:default-audio-group
base-stream-controller.ts:1983 [log] > [audio-stream-controller]: STOPPED->WAITING_TRACK
base-stream-controller.ts:1983 [log] > [audio-stream-controller]: WAITING_TRACK->WAITING_INIT_PTS
base-stream-controller.ts:1983 [log] > [subtitle-stream-controller]: STOPPED->IDLE
buffer-controller.ts:1510 [1-1-2633930073] [log] > [buffer-controller]: Media source ended
base-playlist-controller.ts:163 [log] > [level-controller]: live playlist 0 REFRESHED 65--1
base-playlist-controller.ts:290 [log] > [level-controller]: reload live playlist 0 in 1995 ms
stream-controller.ts:664 [log] > [stream-controller]: Level 0 loaded [59,65][part-65--1], cc [0, 0] duration:14
audio-track-controller.ts:100 [log] > [audio-track-controller]: Audio track 0 "stream_0" lang:ru group:default-audio-group loaded [60-66]
base-playlist-controller.ts:163 [log] > [audio-track-controller]: live playlist 0 REFRESHED 66--1
base-playlist-controller.ts:290 [log] > [audio-track-controller]: reload live playlist 0 in 1979 ms
audio-stream-controller.ts:533 [log] > [audio-stream-controller]: Audio track 0 loaded [60,66][part-66--1],duration:13.994333333333344
base-stream-controller.ts:1983 [log] > [audio-stream-controller]: WAITING_INIT_PTS->IDLE
audio-track-controller.ts:422 [log] > [audio-track-controller]: loading audio-track playlist 0 "stream_0" lang:ru group:default-audio-group
audio-track-controller.ts:100 [log] > [audio-track-controller]: Audio track 0 "stream_0" lang:ru group:default-audio-group loaded [60-66]
base-playlist-controller.ts:163 [log] > [audio-track-controller]: live playlist 0 MISSED
base-playlist-controller.ts:290 [log] > [audio-track-controller]: reload live playlist 0 in 1496 ms
audio-stream-controller.ts:533 [log] > [audio-stream-controller]: Audio track 0 loaded [60,66][part-66--1],duration:13.994333333333344
level-controller.ts:647 [log] > [level-controller]: Loading level index 0 with http://127.0.0.1:8081/test_app/bitrate_1/video.m3u8
base-playlist-controller.ts:163 [log] > [level-controller]: live playlist 0 MISSED
base-playlist-controller.ts:290 [log] > [level-controller]: reload live playlist 0 in 1496 ms
stream-controller.ts:664 [log] > [stream-controller]: Level 0 loaded [59,65][part-65--1], cc [0, 0] duration:14
audio-track-controller.ts:422 [log] > [audio-track-controller]: loading audio-track playlist 0 "stream_0" lang:ru group:default-audio-group
audio-track-controller.ts:100 [log] > [audio-track-controller]: Audio track 0 "stream_0" lang:ru group:default-audio-group loaded [61-68]
base-playlist-controller.ts:163 [log] > [audio-track-controller]: live playlist 0 REFRESHED 68--1
base-playlist-controller.ts:290 [log] > [audio-track-controller]: reload live playlist 0 in 2995 ms
audio-stream-controller.ts:533 [log] > [audio-stream-controller]: Audio track 0 loaded [61,68][part-68--1],duration:15.998999999998915
level-controller.ts:647 [log] > [level-controller]: Loading level index 0 with http://127.0.0.1:8081/test_app/bitrate_1/video.m3u8
base-playlist-controller.ts:163 [log] > [level-controller]: live playlist 0 REFRESHED 66--1
base-playlist-controller.ts:290 [log] > [level-controller]: reload live playlist 0 in 1995 ms
stream-controller.ts:664 [log] > [stream-controller]: Level 0 loaded [60,66][part-66--1], cc [0, 0] duration:14
interstitials-controller.ts:1413 [log] > [interstitials]: Interstitial events (1): ["1" 103.40-233.40]
Schedule: [primary: 0.00-103.40],["1": 103.40-233.40],[primary: 233.40-Infinity]
scte35_3.html:97 Thu Oct 10 2024 16:31:27 GMT+0300 (Moscow Standard Time) HLS Intersticial Events INTERSTITIALS_UPDATED hlsInterstitialsUpdated 
Data {events: Array(1), schedule: Array(3), durations: {…}, removedIds: Array(0)}
scte35_3.html:184 Event received:  {event: Event, type: 'urn:scte:scte35:2014:xml+bin'}
level-controller.ts:647 [log] > [level-controller]: Loading level index 0 with http://127.0.0.1:8081/test_app/bitrate_1/video.m3u8
base-playlist-controller.ts:163 [log] > [level-controller]: live playlist 0 REFRESHED 67--1
base-playlist-controller.ts:290 [log] > [level-controller]: reload live playlist 0 in 2996 ms
stream-controller.ts:664 [log] > [stream-controller]: Level 0 loaded [61,67][part-67--1], cc [0, 0] duration:14
interstitials-controller.ts:1413 [log] > [interstitials]: Interstitial events (1): ["1" 104.04-234.04]
Schedule: [primary: 0.00-104.04],["1": 104.04-234.04],[primary: 234.04-Infinity]
scte35_3.html:97 Thu Oct 10 2024 16:31:29 GMT+0300 (Moscow Standard Time) HLS Intersticial Events INTERSTITIALS_UPDATED hlsInterstitialsUpdated 
Data {events: Array(1), schedule: Array(3), durations: {…}, removedIds: Array(0)}
audio-track-controller.ts:422 [log] > [audio-track-controller]: loading audio-track playlist 0 "stream_0" lang:ru group:default-audio-group
audio-track-controller.ts:100 [log] > [audio-track-controller]: Audio track 0 "stream_0" lang:ru group:default-audio-group loaded [63-69]
base-playlist-controller.ts:163 [log] > [audio-track-controller]: live playlist 0 REFRESHED 69--1
base-playlist-controller.ts:290 [log] > [audio-track-controller]: reload live playlist 0 in 2995 ms
audio-stream-controller.ts:533 [log] > [audio-stream-controller]: Audio track 0 loaded [63,69][part-69--1],duration:14.01466666666775
level-controller.ts:647 [log] > [level-controller]: Loading level index 0 with http://127.0.0.1:8081/test_app/bitrate_1/video.m3u8
base-playlist-controller.ts:163 [log] > [level-controller]: live playlist 0 REFRESHED 69--1
base-playlist-controller.ts:290 [log] > [level-controller]: reload live playlist 0 in 2995 ms
stream-controller.ts:664 [log] > [stream-controller]: Level 0 loaded [63,69][part-69--1], cc [0, 0] duration:14
interstitials-controller.ts:1413 [log] > [interstitials]: Interstitial events (1): ["1" 103.96-233.96]
Schedule: [primary: 0.00-103.96],["1": 103.96-233.96],[primary: 233.96-Infinity]
scte35_3.html:97 Thu Oct 10 2024 16:31:32 GMT+0300 (Moscow Standard Time) HLS Intersticial Events INTERSTITIALS_UPDATED hlsInterstitialsUpdated 
Data {events: Array(1), schedule: Array(3), durations: {…}, removedIds: Array(0)}
audio-track-controller.ts:422 [log] > [audio-track-controller]: loading audio-track playlist 0 "stream_0" lang:ru group:default-audio-group
audio-track-controller.ts:100 [log] > [audio-track-controller]: Audio track 0 "stream_0" lang:ru group:default-audio-group loaded [64-71]
base-playlist-controller.ts:163 [log] > [audio-track-controller]: live playlist 0 REFRESHED 71--1
base-playlist-controller.ts:290 [log] > [audio-track-controller]: reload live playlist 0 in 2991 ms
audio-stream-controller.ts:533 [log] > [audio-stream-controller]: Audio track 0 loaded [64,71][part-71--1],duration:15.998333333333335
level-controller.ts:647 [log] > [level-controller]: Loading level index 0 with http://127.0.0.1:8081/test_app/bitrate_1/video.m3u8
base-playlist-controller.ts:163 [log] > [level-controller]: live playlist 0 REFRESHED 70--1
base-playlist-controller.ts:290 [log] > [level-controller]: reload live playlist 0 in 2994 ms
stream-controller.ts:664 [log] > [stream-controller]: Level 0 loaded [64,70][part-70--1], cc [0, 0] duration:14
interstitials-controller.ts:1413 [log] > [interstitials]: Interstitial events (0): 
Schedule: [primary: 0.00-Infinity]
interstitials-controller.ts:1421 [log] > [interstitials]: Removed events 1
interstitials-controller.ts:1427 [warn] > [interstitials]: Interstitial "1" removed while playing
InterstitialsController._this.onScheduleUpdate @ interstitials-controller.ts:1427
updateSchedule @ interstitials-schedule.ts:296
parseInterstitialDateRanges @ interstitials-schedule.ts:272
onLevelUpdated @ interstitials-controller.ts:1272
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
onLevelLoaded @ stream-controller.ts:704
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
handlePlaylistLoaded @ playlist-loader.ts:681
handleTrackOrLevelPlaylist @ playlist-loader.ts:503
onSuccess @ playlist-loader.ts:318
readystatechange @ xhr-loader.ts:238
XMLHttpRequest.send (async)
openAndSendXhr @ xhr-loader.ts:165
loadInternal @ xhr-loader.ts:124
load @ xhr-loader.ts:82
load @ playlist-loader.ts:351
onLevelLoading @ playlist-loader.ts:165
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
loadPlaylist @ level-controller.ts:661
(anonymous) @ base-playlist-controller.ts:312
setTimeout (async)
playlistLoaded @ base-playlist-controller.ts:311
onLevelLoaded @ level-controller.ts:622
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
handlePlaylistLoaded @ playlist-loader.ts:681
handleTrackOrLevelPlaylist @ playlist-loader.ts:503
onSuccess @ playlist-loader.ts:318
readystatechange @ xhr-loader.ts:238
XMLHttpRequest.send (async)
openAndSendXhr @ xhr-loader.ts:165
loadInternal @ xhr-loader.ts:124
load @ xhr-loader.ts:82
load @ playlist-loader.ts:351
onLevelLoading @ playlist-loader.ts:165
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
loadPlaylist @ level-controller.ts:661
(anonymous) @ base-playlist-controller.ts:312
setTimeout (async)
playlistLoaded @ base-playlist-controller.ts:311
onLevelLoaded @ level-controller.ts:622
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
handlePlaylistLoaded @ playlist-loader.ts:681
handleTrackOrLevelPlaylist @ playlist-loader.ts:503
onSuccess @ playlist-loader.ts:318
readystatechange @ xhr-loader.ts:238
XMLHttpRequest.send (async)
openAndSendXhr @ xhr-loader.ts:165
loadInternal @ xhr-loader.ts:124
load @ xhr-loader.ts:82
load @ playlist-loader.ts:351
onLevelLoading @ playlist-loader.ts:165
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
loadPlaylist @ level-controller.ts:661
(anonymous) @ base-playlist-controller.ts:312
setTimeout (async)
playlistLoaded @ base-playlist-controller.ts:311
onLevelLoaded @ level-controller.ts:622
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
handlePlaylistLoaded @ playlist-loader.ts:681
handleTrackOrLevelPlaylist @ playlist-loader.ts:503
onSuccess @ playlist-loader.ts:318
readystatechange @ xhr-loader.ts:238
XMLHttpRequest.send (async)
openAndSendXhr @ xhr-loader.ts:165
loadInternal @ xhr-loader.ts:124
load @ xhr-loader.ts:82
load @ playlist-loader.ts:351
onLevelLoading @ playlist-loader.ts:165
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
loadPlaylist @ level-controller.ts:661
(anonymous) @ base-playlist-controller.ts:312
setTimeout (async)
playlistLoaded @ base-playlist-controller.ts:311
onLevelLoaded @ level-controller.ts:622
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
handlePlaylistLoaded @ playlist-loader.ts:681
handleTrackOrLevelPlaylist @ playlist-loader.ts:503
onSuccess @ playlist-loader.ts:318
readystatechange @ xhr-loader.ts:238
XMLHttpRequest.send (async)
openAndSendXhr @ xhr-loader.ts:165
loadInternal @ xhr-loader.ts:124
load @ xhr-loader.ts:82
load @ playlist-loader.ts:351
onLevelLoading @ playlist-loader.ts:165
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
loadPlaylist @ level-controller.ts:661
(anonymous) @ base-playlist-controller.ts:312
setTimeout (async)
playlistLoaded @ base-playlist-controller.ts:311
onLevelLoaded @ level-controller.ts:622
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
handlePlaylistLoaded @ playlist-loader.ts:681
handleTrackOrLevelPlaylist @ playlist-loader.ts:503
onSuccess @ playlist-loader.ts:318
readystatechange @ xhr-loader.ts:238
XMLHttpRequest.send (async)
openAndSendXhr @ xhr-loader.ts:165
loadInternal @ xhr-loader.ts:124
load @ xhr-loader.ts:82
load @ playlist-loader.ts:351
onLevelLoading @ playlist-loader.ts:165
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
loadPlaylist @ level-controller.ts:661
startLoad @ base-playlist-controller.ts:52
(anonymous) @ hls.ts:530
startLoad @ hls.ts:529
preloadPrimary @ interstitials-controller.ts:1694
bufferedToItem @ interstitials-controller.ts:1682
bufferedToEnd @ interstitials-controller.ts:1992
emit @ index.js:182
emit @ hls.ts:356
trigger @ hls.ts:364
(anonymous) @ buffer-controller.ts:1069
(anonymous) @ buffer-controller.ts:1668
Promise.then (async)
blockBuffers @ buffer-controller.ts:1663
blockUntilOpen @ buffer-controller.ts:1621
onBufferEos @ buffer-controller.ts:1046
emit @ index.js:182
emit @ hls.ts:356
trigger @ hls.ts:364
doTickIdle @ stream-controller.ts:265
doTick @ stream-controller.ts:215
tick @ task-loop.ts:109
onFragBuffered @ stream-controller.ts:972
emit @ index.js:203
emit @ hls.ts:356
trigger @ hls.ts:364
onUnblocked @ buffer-controller.ts:992
(anonymous) @ buffer-controller.ts:1668
Promise.then (async)
blockBuffers @ buffer-controller.ts:1663
onFragParsed @ buffer-controller.ts:1006
emit @ index.js:182
emit @ hls.ts:356
trigger @ hls.ts:364
updateLevelTiming @ base-stream-controller.ts:1950
_handleTransmuxerFlush @ base-stream-controller.ts:1034
TransmuxerInterface.onWorkerMessage @ transmuxer-interface.ts:387
Show 17 more frames
Show less
interstitials-controller.ts:2071 [log] > [interstitials]: clearAssetPlayer "1-1-2633930073" toSegment: undefined
hls.ts:403 [1-1-2633930073] [log] > destroy
hls.ts:448 [1-1-2633930073] [log] > detachMedia
buffer-controller.ts:456 [1-1-2633930073] [log] > [buffer-controller]: media source detaching
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [stream-controller]: ENDED->STOPPED
5e7062fc-8583-43c9-a687-1e57e6c16ec2:545 [log] > Debug logs enabled for "main" in hls.js version undefined
base-stream-controller.ts:1983 [1-1-2633930073] [log] > [subtitle-stream-controller]: IDLE->STOPPED
scte35_3.html:97 Thu Oct 10 2024 16:31:35 GMT+0300 (Moscow Standard Time) HLS Intersticial Events INTERSTITIALS_UPDATED hlsInterstitialsUpdated 
Data {events: Array(0), schedule: Array(1), durations: {…}, removedIds: Array(1)}
audio-track-controller.ts:422 [log] > [audio-track-controller]: loading audio-track playlist 0 "stream_0" lang:ru group:default-audio-group
audio-track-controller.ts:100 [log] > [audio-track-controller]: Audio track 0 "stream_0" lang:ru group:default-audio-group loaded [65-72]
base-playlist-controller.ts:163 [log] > [audio-track-controller]: live playlist 0 REFRESHED 72--1
base-playlist-controller.ts:290 [log] > [audio-track-controller]: reload live playlist 0 in 2995 ms
audio-stream-controller.ts:533 [log] > [audio-stream-controller]: Audio track 0 loaded [65,72][part-72--1],duration:15.99799999999999
level-controller.ts:647 [log] > [level-controller]: Loading level index 0 with http://127.0.0.1:8081/test_app/bitrate_1/video.m3u8
base-playlist-controller.ts:163 [log] > [level-controller]: live playlist 0 REFRESHED 72--1
base-playlist-controller.ts:290 [log] > [level-controller]: reload live playlist 0 in 2996 ms
stream-controller.ts:664 [log] > [stream-controller]: Level 0 loaded [66,72][part-72--1], cc [0, 0] duration:14
audio-track-controller.ts:422 [log] > [audio-track-controller]: loading audio-track playlist 0 "stream_0" lang:ru group:default-audio-group
audio-track-controller.ts:100 [log] > [audio-track-controller]: Audio track 0 "stream_0" lang:ru group:default-audio-group loaded [68-74]
base-playlist-controller.ts:163 [log] > [audio-track-controller]: live playlist 0 REFRESHED 74--1
base-playlist-controller.ts:290 [log] > [audio-track-controller]: reload live playlist 0 in 2996 ms
audio-stream-controller.ts:533 [log] > [audio-stream-controller]: Audio track 0 loaded [68,74][part-74--1],duration:13.9

Chrome media internals output

No response

robwalch commented 1 month ago
interstitials-controller.ts:1421 [log] > [interstitials]: Removed events 1
interstitials-controller.ts:1427 [warn] > [interstitials]: Interstitial "1" removed while playing

It looks like the date range was removed from the live playlist while playback (active schedule index) was in the event. We haven't confirmed what the expected behavior is here. I think the expectation should be that the the interstitial is exited immediately and throwing playback back to primary at the nearest available resumption offset (you've defined one that might not exist until the interstitial is played through completely).

This one will be a little tricky to replicate, but we can inject dateranges in the parser over live to replicate what's in the logs. Any additional debugging on your end would help. The first thing we might want to try is calling clearInterstitial if it's not already and then call setSchedulePosition with the resolved schedule position here https://github.com/video-dev/hls.js/blob/d25ad973048317445e4cacffad16bd637e450c0e/src/controller/interstitials-controller.ts#L1419-L1425

robwalch commented 1 month ago

From the HLS side, try keeping the date range in the playlist until the START-DATE + DURATION is less than the first PDT in the playlist (plus some number of target-durations for tardy clients).

acris5 commented 1 month ago

You are absolutely right, the thing was that EXT-X-DATERANGE went out of sliding window of playlist. I added it to header and it now works. Also I found that if advert playlist duration is more that tag's duration value then playback also is stalled. I think it will be better to continue main video in all cases.

acris5 commented 1 month ago

Now I use both EXT-X-DATERANGE and EXT-CUE tags, it perfectly works with hls.js and safari implementation https://github.com/Eyevinn/hls-interstitials-web-demo/tree/master

#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/shaka-project/shaka-packager version 24c9a404bc-release
#EXT-X-TARGETDURATION:3
#EXT-X-MEDIA-SEQUENCE:553
#EXT-X-PROGRAM-DATE-TIME:2024-10-16T16:23:26.032Z
#EXT-X-MAP:URI="video_init.mp4"
#EXT-X-DATERANGE:ID="1",CLASS="com.apple.hls.interstitial",START-DATE="2024-10-16T16:22:54.540Z",DURATION=110.000,X-RESUME-OFFSET=0.000,X-ASSET-URI="advert/index.m3u8",X-TIMELINE-OCCUPIES="RANGE"
#EXTINF:2.000,
video_554.m4s
#EXT-X-CUE-CONT:27.200/110.000
#EXTINF:2.000,
video_555.m4s
#EXT-X-CUE-CONT:29.200/110.000
#EXTINF:2.000,
video_556.m4s
#EXT-X-CUE-CONT:31.200/110.000
#EXTINF:2.000,
video_557.m4s
#EXT-X-CUE-CONT:33.200/110.000
#EXTINF:2.000,
video_558.m4s
#EXT-X-CUE-CONT:35.200/110.000
#EXTINF:2.000,
video_559.m4s
#EXT-X-CUE-CONT:37.200/110.000
#EXTINF:2.000,
video_560.m4s
#EXT-X-CUE-CONT:39.200/110.000
#EXTINF:2.000,
video_561.m4s
#EXT-X-CUE-CONT:41.200/110.000
#EXTINF:2.000,
video_562.m4s
#EXT-X-CUE-CONT:43.200/110.000
#EXTINF:2.000,
video_563.m4s
#EXT-X-CUE-CONT:45.200/110.000
#EXTINF:2.000,
video_564.m4s
#EXT-X-CUE-CONT:47.200/110.000
#EXTINF:2.000,
video_565.m4s
#EXT-X-CUE-CONT:49.200/110.000
#EXTINF:2.000,
video_566.m4s
#EXT-X-CUE-CONT:51.200/110.000
#EXTINF:2.000,
video_567.m4s
#EXT-X-CUE-CONT:53.200/110.000
#EXTINF:2.000,
video_568.m4s
#EXT-X-CUE-CONT:55.200/110.000
#EXTINF:2.000,
video_569.m4s