refactor: remove proxy URL handling from video player and HLS hook

This commit is contained in:
kuekhaoyang
2025-11-29 17:05:34 +08:00
parent 39523e373a
commit accc2ca3bc
2 changed files with 4 additions and 9 deletions
+3 -5
View File
@@ -1,6 +1,5 @@
import { useEffect, useRef } from 'react';
import Hls from 'hls.js';
import { getProxyUrl } from '../utils/urlUtils';
interface UseHlsPlayerProps {
videoRef: React.RefObject<HTMLVideoElement | null>;
@@ -28,7 +27,6 @@ export function useHlsPlayer({
}
let hls: Hls | null = null;
const proxiedSrc = getProxyUrl(src);
// Check if HLS is supported natively (Safari, Mobile Chrome)
// We prefer native playback if available as it's usually more battery efficient
@@ -51,7 +49,7 @@ export function useHlsPlayer({
});
hlsRef.current = hls;
hls.loadSource(proxiedSrc);
hls.loadSource(src);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, () => {
@@ -119,12 +117,12 @@ export function useHlsPlayer({
} else {
console.log('[HLS] Using native HLS support');
// Native HLS support
video.src = proxiedSrc;
video.src = src;
}
} else if (isNativeHlsSupported) {
// Fallback for environments where Hls.js is not supported but native is (e.g. iOS without MSE?)
console.log('[HLS] Using native HLS support (Hls.js not supported)');
video.src = proxiedSrc;
video.src = src;
} else {
console.error('[HLS] HLS not supported in this browser');
}