From 4ab2128f74ea08d6cedd260b404cdb51fd804076 Mon Sep 17 00:00:00 2001 From: Trevor Mears Date: Sat, 27 Dec 2025 23:28:41 -0800 Subject: [PATCH] Removed the .m3u8 URL requirement and prioritize HLS.js for all browsers --- public/js/components/VideoPlayer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/js/components/VideoPlayer.js b/public/js/components/VideoPlayer.js index eef8b2f..8ece5de 100644 --- a/public/js/components/VideoPlayer.js +++ b/public/js/components/VideoPlayer.js @@ -169,7 +169,8 @@ class VideoPlayer { this.isUsingProxy = needsProxy; const finalUrl = needsProxy ? this.getProxiedUrl(streamUrl) : streamUrl; - if (finalUrl.includes('.m3u8') && Hls.isSupported()) { + // Priority 1: Use HLS.js for all browsers that support it (Chrome, Firefox, Edge, etc.) + if (Hls.isSupported()) { this.hls = new Hls(); this.hls.loadSource(finalUrl); this.hls.attachMedia(this.video); @@ -191,8 +192,9 @@ class VideoPlayer { } } }); - } else if (this.video.canPlayType('application/vnd.apple.mpegurl')) { - // Native HLS support (Safari) + } else if (this.video.canPlayType('application/vnd.apple.mpegurl') === 'probably' || + this.video.canPlayType('application/vnd.apple.mpegurl') === 'maybe') { + // Priority 2: Native HLS support (Safari on iOS/macOS where HLS.js may not work) this.video.src = finalUrl; this.video.play().catch(e => { console.log('Autoplay prevented, trying proxy if CORS error:', e); @@ -203,7 +205,7 @@ class VideoPlayer { } }); } else { - // Try direct playback + // Priority 3: Try direct playback for non-HLS streams this.video.src = finalUrl; this.video.play().catch(e => console.log('Autoplay prevented:', e)); }