Loop video promos: native loop attr + ended handler fallback
This commit is contained in:
parent
b45f0ced4a
commit
ac22286f5e
@ -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(() => {});
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user