From cb7e78eeddb3393a9ccb325edddc9de80d29b4b9 Mon Sep 17 00:00:00 2001 From: Sebastjan Date: Sat, 25 Apr 2026 12:06:28 +0200 Subject: [PATCH] Enable ABR 1080p<->720p; disable 480p (desynced); realistic bandwidth estimate --- views/index.ejs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/views/index.ejs b/views/index.ejs index 78d4d67..cdc5fe8 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -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)); });