Fix: white play icons (target svg path), cycle promos through all 6 channels
This commit is contained in:
+14
-9
@@ -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(() => {});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user