perf: faster stream startup

- Stop sending no-store on vendored player libraries: hls.min.js and
  mpegts.min.js (~750 KB) were re-downloaded on every player open
- hls.js: start with 1 live segment instead of 3, lower buffer-first
  threshold 1.5s -> 0.8s, poll buffer every 100ms
- mpegts.js: initial stash 512KB -> 128KB, start at 0.5s buffered
- Live FFmpeg: -hls_init_time 1 closes the first segment after ~1s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5 committed 2026-06-10 11:23:32 +02:00
1 parent dcf1c00cca
commit 92634dba13
5 files changed
+28 -16

No files matched your search

+3 -3
View File
@@ -264,7 +264,7 @@
nudgeOffset: 0.8, // More aggressive jump over corrupted frames
nudgeMaxRetries: 30,
maxLiveSyncPlaybackRate: 1.1, // Slower catch-up to avoid chaos
initialLiveManifestSize: 3, // Wait for more segments before starting
initialLiveManifestSize: 1, // Start as soon as one segment exists
abrEwmaDefaultEstimate: 1000000,
manifestLoadingRetryDelay: 1000,
levelLoadingRetryDelay: 1000
@@ -286,12 +286,12 @@
const checkBuffer = setInterval(() => {
if (video.buffered.length > 0) {
const bufferEnd = video.buffered.end(0);
if (bufferEnd > 1.5) { // 1.5s buffer-first
if (bufferEnd > 0.8) { // Start fast, hls.js keeps buffering
clearInterval(checkBuffer);
video.play().catch(() => playOverlay.style.display = 'flex');
}
}
}, 200);
}, 100);
});
hls.on(Hls.Events.LEVEL_LOADED, (e, d) => {
if (d.details && d.details.totalduration > injectedDuration) window.currentHlsDuration = d.details.totalduration;
+7 -7
View File
@@ -258,7 +258,7 @@
nudgeOffset: 0.8,
nudgeMaxRetries: 30,
maxLiveSyncPlaybackRate: 1.1,
initialLiveManifestSize: 3,
initialLiveManifestSize: 1,
abrEwmaDefaultEstimate: 1000000,
manifestLoadingRetryDelay: 1000,
levelLoadingRetryDelay: 1000
@@ -271,11 +271,11 @@
hls.on(Hls.Events.MANIFEST_PARSED, () => {
hideLoading();
const checkBuffer = setInterval(() => {
if (video.buffered.length > 0 && video.buffered.end(0) > 1.5) {
if (video.buffered.length > 0 && video.buffered.end(0) > 0.8) {
clearInterval(checkBuffer);
video.play().catch(() => playOverlay.style.display = 'flex');
}
}, 200);
}, 100);
});
hls.on(Hls.Events.ERROR, (event, data) => {
@@ -302,7 +302,7 @@
url: url
}, {
enableWorker: true,
stashInitialSize: 512 * 1024,
stashInitialSize: 128 * 1024,
enableStashBuffer: true,
liveBufferLatencyChasing: false,
maxStashSize: 30 * 1024 * 1024
@@ -310,13 +310,13 @@
player.attachMediaElement(video);
player.load();
const checkBuffer = setInterval(() => {
if (video.buffered.length > 0 && video.buffered.end(0) > 1.0) {
if (video.buffered.length > 0 && video.buffered.end(0) > 0.5) {
clearInterval(checkBuffer);
player.play().catch(() => playOverlay.style.display = 'flex');
}
}, 200);
}, 100);
player.on(mpegts.Events.ERROR, (type, detail, info) => {
log('MpegTS Error: ' + type + ' - ' + detail);