Enable ABR 1080p<->720p; disable 480p (desynced); realistic bandwidth estimate

This commit is contained in:
Sebastjan 2026-04-25 12:06:28 +02:00
parent 7c2f4eee89
commit cb7e78eedd

View File

@ -664,14 +664,28 @@
manifestLoadingMaxRetry: 6,
fragLoadingTimeOut: 20000,
fragLoadingMaxRetry: 6,
startLevel: -1,
capLevelToPlayerSize: false,
abrEwmaDefaultEstimate: 50000000,
testBandwidth: false,
// ABR (Adaptive Bitrate) — let player auto-switch between qualities
startLevel: -1, // auto: start with whatever bandwidth allows
capLevelToPlayerSize: false, // don't cap to viewport size
abrEwmaDefaultEstimate: 3000000, // realistic 3 Mbps starting estimate
testBandwidth: true, // probe bandwidth on startup
abrBandWidthFactor: 0.95, // 95% of measured BW → safety margin
abrBandWidthUpFactor: 0.7, // need 70% headroom before upgrading
});
hls.loadSource(HLS_URL);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, () => {
// Disable 480p variant (it's desynchronized from 1080p/720p on Rok's encoder)
// ABR will only switch between 1080p and 720p, both of which are in sync.
try {
if (hls.levels && hls.levels.length) {
hls.levels.forEach((lvl, idx) => {
if (lvl.height && lvl.height <= 480) {
lvl.enabled = false;
}
});
}
} catch (e) {}
hideMsg();
video.play().catch(() => setTimeout(() => video.play().catch(() => {}), 200));
});