From 6ec884a76ed73083cdc227875f300bf51875fe41 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 6 Aug 2025 13:59:20 -0700 Subject: [PATCH] Schedule level reload sooner if only 1 fragment in level --- src/utils/level-helper.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils/level-helper.ts b/src/utils/level-helper.ts index 0968f3d4d65..12e39f77070 100644 --- a/src/utils/level-helper.ts +++ b/src/utils/level-helper.ts @@ -518,6 +518,14 @@ export function computeReloadInterval( reloadInterval = lastSegmentDuration; } } + + // If only 1 fragment, make sure to reload well before it ends to avoid race condition stall + if (fragments.length == 1) { + reloadInterval = (fragments[0].duration * 1000) / 2; + logger.log( + 'computeReloadInterval found only 1 fragment, using duration / 2', + ); + } } else { // estimate = 'miss half average'; // follow HLS Spec, If the client reloads a Playlist file and finds that it has not