perf(player): switch to Buffer-First strategy to eliminate chaotic startup and micro-cuts

This commit is contained in:
Michael committed 2026-03-10 22:08:20 +01:00
1 parent 118887ab6f
commit 893ae7b03a
3 files changed
+69 -38

No files matched your search

+10 -8
View File
@@ -296,19 +296,21 @@
url: url
}, {
enableWorker: true,
stashInitialSize: 256 * 1024, // Optimized Turbo Start: 256KB initial buffer
stashInitialSize: 512 * 1024,
enableStashBuffer: true,
liveBufferLatencyChasing: true,
liveBufferLatencyChasingOnPaused: true,
liveBufferLatencyMaxLatency: 10.0,
liveBufferLatencyMinLatency: 2.0,
lazyLoad: false,
maxStashSize: 20 * 1024 * 1024
liveBufferLatencyChasing: false,
maxStashSize: 30 * 1024 * 1024
});
player.attachMediaElement(video);
player.load();
player.play().catch(() => playOverlay.style.display = 'flex');
const checkBuffer = setInterval(() => {
if (video.buffered.length > 0 && video.buffered.end(0) > 1.0) {
clearInterval(checkBuffer);
player.play().catch(() => playOverlay.style.display = 'flex');
}
}, 200);
player.on(mpegts.Events.ERROR, (type, detail, info) => {
log('MpegTS Error: ' + type + ' - ' + detail);