Fixed HLS and MP4 handling issues

This commit is contained in:
Trevor Mears
2025-12-28 03:46:59 -08:00
parent d251488f5f
commit 064d550cc8
+7 -2
View File
@@ -209,8 +209,13 @@ class VideoPlayer {
this.isUsingProxy = needsProxy;
const finalUrl = needsProxy ? this.getProxiedUrl(streamUrl) : streamUrl;
// Priority 1: Use HLS.js for all browsers that support it (Chrome, Firefox, Edge, etc.)
if (Hls.isSupported()) {
// Detect if this is likely an HLS stream (vs direct video file like MP4)
const looksLikeHls = finalUrl.includes('.m3u8') ||
finalUrl.includes('m3u8') ||
(!finalUrl.includes('.mp4') && !finalUrl.includes('.mkv') && !finalUrl.includes('.avi'));
// Priority 1: Use HLS.js for HLS streams on browsers that support it
if (looksLikeHls && Hls.isSupported()) {
this.hls = new Hls(this.getHlsConfig());
this.hls.loadSource(finalUrl);
this.hls.attachMedia(this.video);