From c198b9d4ea81964c9f26f0ca48f0fa54fae6f14c Mon Sep 17 00:00:00 2001 From: Sebastjan Date: Wed, 20 May 2026 19:03:06 +0200 Subject: [PATCH] FIX critical: test Hls.isSupported() FIRST, then native HLS fallback. Chrome reports canPlayType=maybe but actually fails. iPhone Safari uses real native HLS via the new fallback path. --- views/index.ejs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/views/index.ejs b/views/index.ejs index 00f9286..a6885dc 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -647,14 +647,10 @@ try { hls && hls.destroy(); } catch (e) {} hls = null; - if (video.canPlayType('application/vnd.apple.mpegurl')) { - // iOS Safari — native HLS - video.src = HLS_URL; - video.play().catch(() => {}); - video.addEventListener('playing', hideMsg, { once: true }); - return; - } - + // PRIORITY 1: hls.js (works in Chrome, Firefox, Edge — most browsers) + // We test isSupported() FIRST because some Chrome versions now report + // canPlayType('application/vnd.apple.mpegurl') === 'maybe' but native + // playback actually fails silently (black screen). hls.js works. if (window.Hls && window.Hls.isSupported()) { hls = new Hls({ liveDurationInfinity: true, @@ -684,6 +680,11 @@ showMsg('
Verbindung wird wiederhergestellt…
'); setTimeout(() => { attach(); }, 3000); }); + } else if (video.canPlayType('application/vnd.apple.mpegurl')) { + // FALLBACK: iOS Safari native HLS (hls.js not supported on iOS) + video.src = HLS_URL; + video.play().catch(() => {}); + video.addEventListener('playing', hideMsg, { once: true }); } else { showMsg('
Stream wird in diesem Browser nicht unterstützt
'); }