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