fix(player): finalize Buffer-First strategy in player_lite.html

This commit is contained in:
Michael committed 2026-03-10 22:13:41 +01:00
1 parent 893ae7b03a
commit 2f7d709fe6
1 file changed
+17 -15
+17 -15
View File
@@ -245,22 +245,19 @@
const isTurbo = urlParams.get('turbo') === 'true'; const isTurbo = urlParams.get('turbo') === 'true';
const hls = new Hls({ const hls = new Hls({
maxBufferLength: 120, // Doubled for stability maxBufferLength: 120,
maxMaxBufferLength: 240, maxMaxBufferLength: 240,
enableWorker: true, enableWorker: true,
liveSyncDurationCount: 6, // Slightly more buffer for micro-cut protection liveSyncDurationCount: 10,
liveMaxLatencyDurationCount: 40, liveMaxLatencyDurationCount: 30,
lowLatencyMode: false, // Disabled for better stability on laggy connections lowLatencyMode: false,
// Robustness features nudgeOffset: 0.8,
nudgeOffset: 0.6, // More aggressive jump over corrupted frames nudgeMaxRetries: 30,
nudgeMaxRetries: 25, maxLiveSyncPlaybackRate: 1.1,
maxLiveSyncPlaybackRate: 1.2, // Smooth catch-up initialLiveManifestSize: 3,
// Turbo-Start specific abrEwmaDefaultEstimate: 1000000,
startLevel: 0, manifestLoadingRetryDelay: 1000,
initialLiveManifestSize: 1, levelLoadingRetryDelay: 1000
abrEwmaDefaultEstimate: 700000,
manifestLoadingRetryDelay: 500,
levelLoadingRetryDelay: 500
}); });
window.hlsInstance = hls; window.hlsInstance = hls;
@@ -269,7 +266,12 @@
hls.on(Hls.Events.MANIFEST_PARSED, () => { hls.on(Hls.Events.MANIFEST_PARSED, () => {
hideLoading(); hideLoading();
video.play().catch(() => playOverlay.style.display = 'flex'); const checkBuffer = setInterval(() => {
if (video.buffered.length > 0 && video.buffered.end(0) > 1.5) {
clearInterval(checkBuffer);
video.play().catch(() => playOverlay.style.display = 'flex');
}
}, 200);
}); });
hls.on(Hls.Events.ERROR, (event, data) => { hls.on(Hls.Events.ERROR, (event, data) => {