From 13e4db9265ad90da0e8f146a095a6f98aa7ab8e7 Mon Sep 17 00:00:00 2001 From: Michael SCHAL Date: Sun, 7 Dec 2025 16:07:06 +0100 Subject: [PATCH] feat: implement web-based IPTV player with HLS.js and mpegts.js, including parent communication for control and status. --- web/player.html | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/web/player.html b/web/player.html index 01a4125..7c459c4 100644 --- a/web/player.html +++ b/web/player.html @@ -505,6 +505,7 @@ // Determine stream type and try appropriate player const lowerUrl = streamUrl.toLowerCase(); + const ext = urlParams.get('ext') ? urlParams.get('ext').toLowerCase() : ''; // HLS streams first if (lowerUrl.includes('.m3u8') || lowerUrl.includes('/hls/')) { @@ -512,6 +513,17 @@ return; } + // MPEG-TS streams (live or forced TS via ext param) + // Checked BEFORE generic MP4/MKV to handle transcoded streams correctly + if (ext === '.ts' || lowerUrl.includes('.ts')) { + log('Detected MPEG-TS (via extension or URL), using mpegts.js'); + const success = await playWithMpegTS(streamUrl); + if (!success) { + await playDirect(streamUrl); + } + return; + } + // MP4 and WebM - play directly (supports seeking via Range) if (lowerUrl.includes('.mp4') || lowerUrl.includes('.webm') || lowerUrl.includes('.mov')) { log('Detected MP4/WebM/MOV, playing directly with seek support'); @@ -555,15 +567,6 @@ return; } - // MPEG-TS streams (live) - if (lowerUrl.includes('.ts')) { - const success = await playWithMpegTS(streamUrl); - if (!success) { - await playDirect(streamUrl); - } - return; - } - // Unknown format - try direct first (for VOD with Range support), then HLS log('Unknown format, trying direct first then HLS fallback'); video.src = streamUrl;