hls.js: 10s -> 30s segment load cap (iPhone FragLoadTimeout)

The iPhone error 'Playback failed: FragLoadTimeout' + 74 all-200
segment requests = the phone's downlink can't deliver a ~700KB
segment within the 10s cap; hls.js measured the load client-side
while the server finished instantly. Raise maxLoadTimeMs to 30s
(first-byte 20s) so slow-but-alive phone links complete; retries
still bound the truly-dead case. assets v=11.
This commit is contained in:
jozamudi committed 2026-08-31 20:32:40 +00:00
1 parent 5268e77d00
commit 3df074a5fe
2 files changed
+12 -11

No files matched your search

+10 -9
View File
@@ -899,18 +899,19 @@ async function play(ep_id, ep_no) {
// finish, and the proxy's retry path gets a chance
// hls.js 1.5.x reads the retry budget from the errorRetry / timeoutRetry
// sub-objects (a top-level maxNumRetry is ignored — that was the old bug).
// maxTimeToFirstByteMs first byte within 15s
// maxLoadTimeMs total load within 10s — finite cap, and LOWER than
// the first-byte cap, so a dribbling CDN segment is
// aborted at 10s and retried (timeoutRetry 6x) instead
// of the player staring at "Buffering…" for 30s
// maxTimeToFirstByteMs first byte within 20s
// maxLoadTimeMs total load within 30s — covers SLOW CLIENT LINKS
// (a 700KB segment on a ~35KB/s phone link takes
// 20s+; the old 10s cap made the iPhone FragLoadTime
// out through all 6 retries even though every
// request 200'd server-side)
// timeoutRetry retries for a load *timeout* (was default 1!)
// errorRetry retries for HTTP errors like our proxy's 502
// Together: a slow/stalled CDN gets retried with backoff instead of one
// shot -> fatal fragLoadTimeOut.
// Together: a slow/stalled CDN or slow phone link gets retried with backoff
// instead of one shot -> fatal fragLoadTimeOut.
hls = new Hls({ fragLoadPolicy: { default: {
maxTimeToFirstByteMs: 15000,
maxLoadTimeMs: 10000,
maxTimeToFirstByteMs: 20000,
maxLoadTimeMs: 30000,
timeoutRetry: { maxNumRetry: 6, retryDelayMs: 1000, maxRetryDelayMs: 20000, backoff: "linear" },
errorRetry: { maxNumRetry: 8, retryDelayMs: 1000, maxRetryDelayMs: 20000, backoff: "linear" },
} } });