hls.js: outlast CDN segment stalls (TTFT 5s->15s, 8 retries)
The upstream CDN intermittently serves 0 bytes on segments for 10s+ (fragLoadTimeOut errors 17:58-18:14 and 19:16-19:18 today). hls.js's default 5s time-to-first-byte abort dropped the XHR before the proxy's 12s upstream attempt + 300ms retry could answer with its 502, so the proxy-side retry never got a chance and stalls went straight to fatal. fragLoadPolicy: maxTimeToFirstByteMs 15000 (> proxy's 12s timeout), maxNumRetry 8 — slow-but-alive segments now finish, and stall tolerance rises to several minutes.
This commit is contained in:
1 parent
e361f0ba0e
commit
8f519b0251
1 file changed
+6
-1
+6
-1
@@ -696,7 +696,12 @@ async function play(ep_id, ep_no) {
|
||||
document.getElementById("player").replaceChildren(v);
|
||||
playerOverlay("Loading\u2026");
|
||||
if (!window.Hls || !Hls.isSupported()) throw new Error("HLS not supported in this browser");
|
||||
hls = new Hls();
|
||||
// the upstream CDN occasionally stalls on segment bytes (0 bytes for
|
||||
// 10s+). hls.js's default 5s time-to-first-byte abort would drop the XHR
|
||||
// before our proxy's 12s upstream attempt (+300ms retry) can answer with
|
||||
// its 502 — keep TTFT past the proxy timeout so slow-but-alive segments
|
||||
// finish, and the proxy's retry path gets a chance
|
||||
hls = new Hls({ fragLoadPolicy: { default: { maxTimeToFirstByteMs: 15000, maxNumRetry: 8 } } });
|
||||
hls.on(Hls.Events.ERROR, (_, data) => {
|
||||
if (data.fatal) {
|
||||
stopHls();
|
||||
|
||||
Reference in new issue
Block a user