Loop video promos: native loop attr + ended handler fallback

This commit is contained in:
OpenClaw Agent 2026-04-29 11:58:44 +02:00
parent b45f0ced4a
commit ac22286f5e

View File

@ -206,10 +206,20 @@ async function playChannel(key) {
// Safari / native HLS
video.src = hlsUrl;
}
// Belt-and-suspenders loop: native `loop` attribute + explicit handler
// (Shaka sometimes pauses on `ended` instead of looping the manifest)
video.loop = true;
video.addEventListener('ended', () => {
try {
video.currentTime = 0;
video.play().catch(() => {});
} catch (_) {}
});
video.play().catch(() => { /* autoplay may be blocked, user can press play */ });
} catch (e) {
console.warn('HLS load failed, falling back to native src:', e?.message);
video.src = hlsUrl;
video.loop = true;
video.play().catch(() => {});
}