Fix: white play icons (target svg path), cycle promos through all 6 channels

This commit is contained in:
OpenClaw Agent
2026-04-29 11:59:50 +02:00
parent ac22286f5e
commit 3b1cf139e5
2 changed files with 25 additions and 12 deletions
+14 -9
View File
@@ -206,20 +206,25 @@ 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;
// When this promo ends, jump to the next channel (cycle through all 6).
// Use `once: true` so the handler fires only for this promo — when we
// start the next channel, a fresh `ended` listener is attached again.
video.loop = false;
video.addEventListener('ended', () => {
try {
video.currentTime = 0;
video.play().catch(() => {});
} catch (_) {}
});
const i = CHANNELS.findIndex(c => c.key === currentChannel?.key);
const next = CHANNELS[(i + 1) % CHANNELS.length];
playChannel(next.key);
}, { once: true });
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.loop = false;
video.addEventListener('ended', () => {
const i = CHANNELS.findIndex(c => c.key === currentChannel?.key);
const next = CHANNELS[(i + 1) % CHANNELS.length];
playChannel(next.key);
}, { once: true });
video.play().catch(() => {});
}