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

The player keeps loading the playlist but not loading any new segments in live streaming (segment request stall) #7008

Open
vkaswin opened this issue Feb 6, 2025 · 9 comments

Comments

@vkaswin
Copy link

vkaswin commented Feb 6, 2025

We are using the HLS player for live streaming. In certain scenarios, the player only loads the playlist even though new segments are updated in it. The sequence number and target duration are also correct. I found similar issues on GitHub. I have attached the screenshot and .har file for reference. Please help us resolve this issue.

Hls version : 1.5.19
Config :
{
liveSyncDurationCount : 4,
maxBufferLength : 5,
backBufferLength : Infinity,
maxBufferSize : Infinity
}

For other configs we are using the default value.

Har file link : https://drive.google.com/file/d/11z6HCXdaol-c67VuKOlP8c6rbDx4x4xS/view?usp=sharing

Image
Image
Image
Image
Image
Image

@robwalch
Copy link
Collaborator

robwalch commented Feb 6, 2025

Please share debug logs from HLS.js (JavaScript console with config { debug: true }).

HAR files are not useful in this case as they only express what was requested and not what HLS.js was doing.

@vkaswin
Copy link
Author

vkaswin commented Feb 6, 2025

Sure, we will enable debug logs, reproduce the issue again, and share the logs. Meanwhile, for better understanding, could you please explain in which cases this issue might occur? Also, a similar issue has already been reported. @robwalch

@robwalch
Copy link
Collaborator

robwalch commented Feb 6, 2025

Please read the comments in other issues if you are interested in the response to what others have reported.

@vkaswin
Copy link
Author

vkaswin commented Feb 7, 2025

After the wmslive_media_213.ts fragment, only the manifest was loaded. Although new segments were updated in the manifest response, the player did not load any new fragments. After some time, the player loaded the wmslive_media_219.ts fragment, but the fragments in between were not loaded. I have attached the HLS logs and HAR file for reference. Please check and help us resolve this issue. @robwalch

Hls logs : https://drive.google.com/file/d/1skDQ68wLCDev_2cPvr9dCMpx4hSXKV-j/view?usp=sharing
Har file : https://drive.google.com/file/d/1A86mfEgAI57pyYekaolQxtlAaHaFYsAE/view?usp=sharing

Image

@robwalch
Copy link
Collaborator

robwalch commented Feb 7, 2025

The logs show an exception instantiating the WebWorker with your player build. Use enableWorker: false to suppress this:

hls.min.03ec90db3c8c4b33e5436b0e778600c0.js:1 [warn] > Error setting up "main" Web Worker, fallback to inline TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'mediaPlayerObj' -> object with constructor 'RTCMediaPlayerObj'
    |     property '_playerInstance' -> object with constructor 'e'
    --- property 'config' closes the circle
    at JSON.stringify (<anonymous>)
    at new t (hls.min.03ec90db3c8c4b33e5436b0e778600c0.js:1:210856)
    at r._handleFragmentLoadProgress (hls.min.03ec90db3c8c4b33e5436b0e778600c0.js:1:391948)
    at hls.min.03ec90db3c8c4b33e5436b0e778600c0.js:1:126394

After that, if we filter on loading and buffering lines, fragments are loaded and buffered:

[stream-controller]: Loading fragment 194 cc: 0 of [188-197] level: 0, target: 12.267
[stream-controller]: Loaded fragment 194 of level 0
[stream-controller]: Buffered main sn: 194 of level 0 (frag:[12.266-14.292] > buffer:[12.291-14.271])
[stream-controller]: Loading fragment 195 cc: 0 of [188-197] level: 0, target: 14.271
[stream-controller]: Loaded fragment 195 of level 0
[stream-controller]: Buffered main sn: 195 of level 0 (frag:[14.266-16.289] > buffer:[12.291-16.277])
[stream-controller]: Loading fragment 196 cc: 0 of [188-197] level: 0, target: 16.277
[stream-controller]: Loaded fragment 196 of level 0
[stream-controller]: Buffered main sn: 196 of level 0 (frag:[16.266-18.292] > buffer:[12.291-18.282])
[stream-controller]: Loading fragment 197 cc: 0 of [188-197] level: 0, target: 18.282
[stream-controller]: Loaded fragment 197 of level 0
[stream-controller]: Buffered main sn: 197 of level 0 (frag:[18.266-20.292] > buffer:[12.291-20.266])
[stream-controller]: Loading fragment 198 cc: 0 of [189-198] level: 0, target: 20.292
[stream-controller]: Loaded fragment 198 of level 0
[stream-controller]: Buffered main sn: 198 of level 0 (frag:[20.266-22.292] > buffer:[12.291-22.250])
[stream-controller]: Loading fragment 199 cc: 0 of [190-199] level: 0, target: 22.292
[stream-controller]: Loaded fragment 199 of level 0
[stream-controller]: Buffered main sn: 199 of level 0 (frag:[22.250-24.292] > buffer:[12.291-24.277])
[stream-controller]: Loading fragment 207 cc: 0 of [198-207] level: 3, target: 24.277
[stream-controller]: Loaded fragment 207 of level 3
[stream-controller]: Buffered main sn: 207 of level 3 (frag:[20.624-24.383] > buffer:[12.291-24.157])
[stream-controller]: Loading fragment 208 cc: 0 of [199-208] level: 3, target: 24.383
[stream-controller]: Loaded fragment 208 of level 3
[stream-controller]: Buffered main sn: 208 of level 3 (frag:[24.158-26.389] > buffer:[12.291-26.157])
[stream-controller]: Loading fragment 209 cc: 0 of [200-209] level: 3, target: 26.389
[stream-controller]: Loaded fragment 209 of level 3
[stream-controller]: Buffered main sn: 209 of level 3 (frag:[26.157-28.394] > buffer:[12.291-28.157])
[stream-controller]: Loading fragment 210 cc: 0 of [202-211] level: 3, target: 28.394
[stream-controller]: Loaded fragment 210 of level 3
[stream-controller]: Buffered main sn: 210 of level 3 (frag:[28.157-29.653] > buffer:[12.291-29.457])
[stream-controller]: Loading fragment 211 cc: 0 of [202-211] level: 3, target: 29.457
[stream-controller]: Loaded fragment 211 of level 3
[stream-controller]: Buffered main sn: 211 of level 3 (frag:[29.457-31.189] > buffer:[12.291-30.959])
[stream-controller]: Loading fragment 212 cc: 0 of [203-212] level: 3, target: 31.189
[stream-controller]: Loaded fragment 212 of level 3
[stream-controller]: Buffered main sn: 212 of level 3 (frag:[30.959-33.173] > buffer:[12.291-32.957])
[stream-controller]: Loading fragment 213 cc: 0 of [204-213] level: 3, target: 33.173
[stream-controller]: Loading fragment 219 cc: 0 of [214-223] level: 3, target: 45.973
[stream-controller]: Loaded fragment 219 of level 3
[stream-controller]: Buffered main sn: 219 of level 3 (frag:[45.291-46.975] > buffer:[12.291-32.957][45.525-46.757])
[stream-controller]: Loading fragment 220 cc: 0 of [214-223] level: 3, target: 46.757
[stream-controller]: Loaded fragment 220 of level 3
[stream-controller]: Buffered main sn: 220 of level 3 (frag:[46.757-49.002] > buffer:[12.291-32.957][45.525-48.759])
[stream-controller]: Loading fragment 221 cc: 0 of [214-223] level: 3, target: 48.759
[stream-controller]: Loaded fragment 221 of level 3
[stream-controller]: Buffered main sn: 221 of level 3 (frag:[48.759-50.986] > buffer:[12.291-32.957][45.525-50.759])
[stream-controller]: Loading fragment 222 cc: 0 of [214-223] level: 3, target: 50.759
[stream-controller]: Loading fragment 222 cc: 0 of [214-223] level: 3, target: 50.759
[stream-controller]: Loaded fragment 222 of level 3
[stream-controller]: Buffered main sn: 222 of level 3 (frag:[50.759-52.991] > buffer:[12.291-32.957][45.525-52.759])
[stream-controller]: Loading fragment 223 cc: 0 of [214-223] level: 3, target: 52.759
[stream-controller]: Loaded fragment 223 of level 3
[stream-controller]: Buffered main sn: 223 of level 3 (frag:[52.759-54.975] > buffer:[12.291-32.957][45.525-54.759])
[stream-controller]: Loading fragment 224 cc: 0 of [215-224] level: 3, target: 54.975
[stream-controller]: Loaded fragment 224 of level 3
[stream-controller]: Buffered main sn: 224 of level 3 (frag:[54.759-57.301] > buffer:[12.291-32.957][45.525-57.092])
[stream-controller]: Loading fragment 225 cc: 0 of [216-225] level: 3, target: 57.301
[stream-controller]: Loaded fragment 225 of level 3
[stream-controller]: Buffered main sn: 225 of level 3 (frag:[57.092-59.285] > buffer:[12.291-32.957][45.525-59.091])
[stream-controller]: Loading fragment 226 cc: 0 of [217-226] level: 3, target: 59.285
[stream-controller]: Loaded fragment 226 of level 3
[stream-controller]: Buffered main sn: 226 of level 3 (frag:[59.091-61.311] > buffer:[12.291-32.957][45.525-61.092])
[stream-controller]: Loading fragment 227 cc: 0 of [218-227] level: 3, target: 61.311
[stream-controller]: Loaded fragment 227 of level 3
[stream-controller]: Buffered main sn: 227 of level 3 (frag:[61.092-63.317] > buffer:[12.291-32.957][45.525-63.089])
[stream-controller]: Loading fragment 228 cc: 0 of [219-228] level: 3, target: 63.317
[stream-controller]: Loaded fragment 228 of level 3
[stream-controller]: Buffered main sn: 228 of level 3 (frag:[63.091-65.621] > buffer:[12.291-32.957][45.525-65.424])
[stream-controller]: Loading fragment 229 cc: 0 of [220-229] level: 3, target: 65.621
[stream-controller]: Loaded fragment 229 of level 3
[stream-controller]: Buffered main sn: 229 of level 3 (frag:[65.424-67.647] > buffer:[12.291-32.957][45.525-67.424])
[stream-controller]: Loading fragment 230 cc: 0 of [221-230] level: 3, target: 67.647
[stream-controller]: Loaded fragment 230 of level 3
[stream-controller]: Buffered main sn: 230 of level 3 (frag:[67.424-69.631] > buffer:[12.291-32.957][45.525-69.424])
[stream-controller]: Loading fragment 231 cc: 0 of [222-231] level: 3, target: 69.631
[stream-controller]: Loaded fragment 231 of level 3
[stream-controller]: Buffered main sn: 231 of level 3 (frag:[69.424-71.658] > buffer:[12.291-32.957][45.525-71.424])
[stream-controller]: Loading fragment 232 cc: 0 of [223-232] level: 3, target: 71.658
[stream-controller]: Loaded fragment 232 of level 3
[stream-controller]: Buffered main sn: 232 of level 3 (frag:[71.424-73.962] > buffer:[12.291-32.957][45.525-73.757])
[stream-controller]: Loading fragment 233 cc: 0 of [224-233] level: 3, target: 73.962
[stream-controller]: Loaded fragment 233 of level 3
[stream-controller]: Buffered main sn: 233 of level 3 (frag:[73.758-75.989] > buffer:[12.291-32.957][45.525-75.759])
[stream-controller]: Loading fragment 234 cc: 0 of [225-234] level: 3, target: 75.989
[stream-controller]: Loaded fragment 234 of level 3
[stream-controller]: Buffered main sn: 234 of level 3 (frag:[75.759-77.951] > buffer:[12.291-32.957][45.525-77.757])

@robwalch
Copy link
Collaborator

robwalch commented Feb 7, 2025

Are you able to reproduce the issue at https://hlsjs-dev.video-dev.org/demo/ ?

@vkaswin
Copy link
Author

vkaswin commented Feb 7, 2025

If you check the logs, the fragments from 214 to 218 were not loaded. Could the web worker not being initialized be causing this issue? @robwalch

[warn] > Playback stalling at @33.110514 due to low buffer
[warn] > [playback-rate-controller]: Stall detected, adjusting target latency

Also, I noticed the above logs right after fragment 213 was loaded

@robwalch
Copy link
Collaborator

robwalch commented Feb 7, 2025

Yes. Playback stalled after fragment 213 was requested but never retrieved (missing Loaded fragment 213).

 [log] > [stream-controller]: Loading fragment 213 cc: 0 of [204-213] level: 3, target: 33.173

This was followed by a seek to catch up with playlist window (at which point fragment 213 was aborted):

[warn] > [stream-controller]: Playback: 33.111 is located too far from the end of live sliding playlist: 54.97266666666667, reset currentTime to : 45.973
..
[log] > [stream-controller]: media seeking to 45.973, state: FRAG_LOADING
[log] > [stream-controller]: seeking outside of buffer while fragment load in progress, cancel fragment load
...
[warn] > [stream-controller]: Fragment 213 of level 3 was aborted

Why was fragment 213 blocked? What does your HAR file say about it? The screenshot above shows the segment request took 18.7 seconds to resolve.

If the server can't respond in time, perhaps you could adjust the fragment loading policy to timeout earlier? Would a timeout and retry resolve the issue or do you expect frequent network stalls like this?

fragLoadPolicy: {
  default: {
    maxTimeToFirstByteMs: 10000,
    maxLoadTimeMs: 120000,

I'm not sure why the abandon rules check isn't attempting a switch earlier. I recommend giving the latest v1.6.0 pre-release a try.

@vkaswin
Copy link
Author

vkaswin commented Feb 8, 2025

Thanks for the clarification. If I'm not wrong, since fragment 213 took 18.5 seconds to load, the player only loaded the manifest after fragment 213 was resolved. By that time, the player was too far from the live edge, causing it to skip loading fragments 214 to 218. @robwalch

@robwalch robwalch changed the title The player keeps loading the playlist but not loading any new segments in live streaming The player keeps loading the playlist but not loading any new segments in live streaming (segment request stall) Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants