feat(player): increase buffering and stability for HLS and MPEG-TS

This commit is contained in:
Michael committed 2026-03-10 21:30:02 +01:00
1 parent b8682eafe0
commit 9e97f45046
2 files changed
+26 -22

No files matched your search

+12 -8
View File
@@ -253,18 +253,18 @@
const isTurbo = urlParams.get('turbo') === 'true';
const hls = new Hls({
maxBufferLength: 60,
maxBufferLength: 120,
enableWorker: true,
liveSyncDurationCount: 5, // Balanced for desktop
nudgeOffset: 0.2,
nudgeMaxRetries: 10,
maxLiveSyncPlaybackRate: 1.1,
liveSyncDurationCount: 10, // Increased for desktop stability
nudgeOffset: 0.4,
nudgeMaxRetries: 15,
maxLiveSyncPlaybackRate: 1.15,
// Turbo-Start specific
startLevel: isTurbo ? 0 : -1,
initialLiveManifestSize: 1,
abrEwmaDefaultEstimate: 500000,
manifestLoadingRetryDelay: 800,
levelLoadingRetryDelay: 800
manifestLoadingRetryDelay: 1000,
levelLoadingRetryDelay: 1000
});
window.hlsInstance = hls;
hls.loadSource(url);
@@ -290,7 +290,11 @@
log('Trying mpegts.js with: ' + url);
showLoading('Chargement MPEG-TS...');
if (!mpegts.isSupported()) return false;
const player = mpegts.createPlayer({ type: 'mpegts', isLive: isLive, url: url }, { enableWorker: true, stashInitialSize: 1024 * 1024 });
const player = mpegts.createPlayer({ type: 'mpegts', isLive: isLive, url: url }, {
enableWorker: true,
stashInitialSize: 512 * 1024,
maxStashSize: 20 * 1024 * 1024 // 20MB buffer capacity
});
player.attachMediaElement(video);
player.load();
player.play().catch(() => playOverlay.style.display = 'flex');