perf(player): implement Turbo Start for faster zapping while maintaining stability

This commit is contained in:
Michael committed 2026-03-10 21:55:11 +01:00
1 parent 9e97f45046
commit 79fae261aa
3 files changed
+18 -17

No files matched your search

+5 -5
View File
@@ -255,16 +255,16 @@
const hls = new Hls({ const hls = new Hls({
maxBufferLength: 120, maxBufferLength: 120,
enableWorker: true, enableWorker: true,
liveSyncDurationCount: 10, // Increased for desktop stability liveSyncDurationCount: 3, // Reduced for faster initial sync
nudgeOffset: 0.4, nudgeOffset: 0.4,
nudgeMaxRetries: 15, nudgeMaxRetries: 15,
maxLiveSyncPlaybackRate: 1.15, maxLiveSyncPlaybackRate: 1.15,
// Turbo-Start specific // Turbo-Start specific
startLevel: isTurbo ? 0 : -1, startLevel: 0, // Force lowest level for instant start
initialLiveManifestSize: 1, initialLiveManifestSize: 1,
abrEwmaDefaultEstimate: 500000, abrEwmaDefaultEstimate: 500000,
manifestLoadingRetryDelay: 1000, manifestLoadingRetryDelay: 500,
levelLoadingRetryDelay: 1000 levelLoadingRetryDelay: 500
}); });
window.hlsInstance = hls; window.hlsInstance = hls;
hls.loadSource(url); hls.loadSource(url);
@@ -292,7 +292,7 @@
if (!mpegts.isSupported()) return false; if (!mpegts.isSupported()) return false;
const player = mpegts.createPlayer({ type: 'mpegts', isLive: isLive, url: url }, { const player = mpegts.createPlayer({ type: 'mpegts', isLive: isLive, url: url }, {
enableWorker: true, enableWorker: true,
stashInitialSize: 512 * 1024, stashInitialSize: 64 * 1024, // Turbo Start: 64KB initial buffer
maxStashSize: 20 * 1024 * 1024 // 20MB buffer capacity maxStashSize: 20 * 1024 * 1024 // 20MB buffer capacity
}); });
player.attachMediaElement(video); player.attachMediaElement(video);
+5 -5
View File
@@ -248,7 +248,7 @@
maxBufferLength: 120, // Doubled for stability maxBufferLength: 120, // Doubled for stability
maxMaxBufferLength: 240, maxMaxBufferLength: 240,
enableWorker: true, enableWorker: true,
liveSyncDurationCount: 12, // Increased distance from live edge (TiviMate style) for high latency liveSyncDurationCount: 3, // Reduced for faster initial sync
liveMaxLatencyDurationCount: 40, liveMaxLatencyDurationCount: 40,
lowLatencyMode: false, // Disabled for better stability on laggy connections lowLatencyMode: false, // Disabled for better stability on laggy connections
// Robustness features // Robustness features
@@ -256,11 +256,11 @@
nudgeMaxRetries: 20, nudgeMaxRetries: 20,
maxLiveSyncPlaybackRate: 1.2, // Smooth catch-up maxLiveSyncPlaybackRate: 1.2, // Smooth catch-up
// Turbo-Start specific // Turbo-Start specific
startLevel: isTurbo ? 0 : -1, startLevel: 0, // Force lowest level for instant start
initialLiveManifestSize: 1, initialLiveManifestSize: 1,
abrEwmaDefaultEstimate: 500000, abrEwmaDefaultEstimate: 500000,
manifestLoadingRetryDelay: 1000, manifestLoadingRetryDelay: 500,
levelLoadingRetryDelay: 1000 levelLoadingRetryDelay: 500
}); });
window.hlsInstance = hls; window.hlsInstance = hls;
@@ -296,7 +296,7 @@
url: url url: url
}, { }, {
enableWorker: true, enableWorker: true,
stashInitialSize: 512 * 1024, stashInitialSize: 64 * 1024, // Turbo Start: 64KB initial buffer
enableStashBuffer: true, enableStashBuffer: true,
liveBufferLatencyChasing: true, liveBufferLatencyChasing: true,
liveBufferLatencyChasingOnPaused: true, liveBufferLatencyChasingOnPaused: true,
+8 -7
View File
@@ -233,8 +233,8 @@
const hls = new Hls({ const hls = new Hls({
maxBufferLength: 60, maxBufferLength: 60,
maxMaxBufferLength: 120, maxMaxBufferLength: 120,
liveSyncDurationCount: 6, liveSyncDurationCount: 3, // Reduced for faster initial sync on mobile
liveMaxLatencyDurationCount: 20, liveMaxLatencyDurationCount: 15,
enableWorker: true, enableWorker: true,
lowLatencyMode: true, lowLatencyMode: true,
// Robustness // Robustness
@@ -242,11 +242,11 @@
nudgeMaxRetries: 10, nudgeMaxRetries: 10,
maxLiveSyncPlaybackRate: 1.1, maxLiveSyncPlaybackRate: 1.1,
// Turbo-Start specific // Turbo-Start specific
startLevel: isTurbo ? 0 : -1, startLevel: 0, // Force lowest level for instant start
initialLiveManifestSize: 1, initialLiveManifestSize: 1,
abrEwmaDefaultEstimate: 500000, abrEwmaDefaultEstimate: 500000,
manifestLoadingRetryDelay: 800, manifestLoadingRetryDelay: 500,
levelLoadingRetryDelay: 800 levelLoadingRetryDelay: 500
}); });
hls.loadSource(streamUrl); hls.loadSource(streamUrl);
hls.attachMedia(video); hls.attachMedia(video);
@@ -271,8 +271,9 @@
url: streamUrl url: streamUrl
}, { }, {
enableWorker: true, enableWorker: true,
stashInitialSize: 2 * 1024 * 1024, stashInitialSize: 128 * 1024, // Turbo Start: 128KB initial buffer
enableStashBuffer: true enableStashBuffer: true,
maxStashSize: 20 * 1024 * 1024 // 20MB Max for stability
}); });
player.attachMediaElement(video); player.attachMediaElement(video);
player.load(); player.load();