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.

This commit is contained in:
Sebastjan 2026-05-20 19:03:06 +02:00
parent 810bed52c2
commit c198b9d4ea

View File

@ -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('<div class="spinner"></div><div>Verbindung wird wiederhergestellt…</div>');
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('<div>Stream wird in diesem Browser nicht unterstützt</div>');
}