From 703193870f69516b38e130a8118e68b250b6b06e Mon Sep 17 00:00:00 2001 From: Michael SCHAL Date: Sun, 7 Dec 2025 15:05:01 +0100 Subject: [PATCH] feat: add IPTV player with HLS.js and mpegts.js for stream playback and parent communication. --- web/player.html | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/web/player.html b/web/player.html index 8415300..d5d0e1b 100644 --- a/web/player.html +++ b/web/player.html @@ -97,7 +97,8 @@
- + +
Loading stream...
@@ -344,7 +345,10 @@ hls.on(Hls.Events.MANIFEST_PARSED, () => { log('HLS manifest parsed, starting playback'); hideLoading(); - video.play().catch(e => log('Autoplay prevented: ' + e)); + video.play().catch(e => { + log('Autoplay prevented: ' + e); + window.parent.postMessage({ type: 'playback_status', status: 'paused' }, '*'); + }); }); // Better error recovery @@ -406,7 +410,10 @@ video.addEventListener('canplay', () => { log('MPEG-TS stream ready'); hideLoading(); - video.play().catch(e => log('Autoplay prevented: ' + e)); + video.play().catch(e => { + log('Autoplay prevented: ' + e); + window.parent.postMessage({ type: 'playback_status', status: 'paused' }, '*'); + }); }); video.addEventListener('error', (e) => { @@ -440,7 +447,10 @@ video.addEventListener('canplay', () => { hideLoading(); - video.play().catch(e => log('Autoplay prevented: ' + e)); + video.play().catch(e => { + log('Autoplay prevented: ' + e); + window.parent.postMessage({ type: 'playback_status', status: 'paused' }, '*'); + }); }, { once: true }); video.addEventListener('error', (e) => { @@ -514,7 +524,10 @@ const onCanPlay = () => { playStarted = true; hideLoading(); - video.play().catch(e => log('Autoplay prevented: ' + e)); + video.play().catch(e => { + log('Autoplay prevented: ' + e); + window.parent.postMessage({ type: 'playback_status', status: 'paused' }, '*'); + }); }; const onError = async () => { @@ -550,7 +563,10 @@ video.addEventListener('canplay', () => { hideLoading(); - video.play().catch(e => log('Autoplay prevented: ' + e)); + video.play().catch(e => { + log('Autoplay prevented: ' + e); + window.parent.postMessage({ type: 'playback_status', status: 'paused' }, '*'); + }); }, { once: true }); video.addEventListener('error', async () => {