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
+1 -4
View File
@@ -9,7 +9,6 @@ import { useMobileGestures } from './hooks/useMobileGestures';
import { MobileControlsWrapper } from './mobile/MobileControlsWrapper';
import { MobileOverlay } from './mobile/MobileOverlay';
import { MobileSkipIndicator } from './mobile/MobileSkipIndicator';
import { getProxyUrl } from './utils/urlUtils';
interface MobileVideoPlayerProps {
src: string;
@@ -88,8 +87,6 @@ export function MobileVideoPlayer({
togglePlay,
});
const proxiedSrc = getProxyUrl(src);
return (
<div
ref={containerRef}
@@ -99,7 +96,7 @@ export function MobileVideoPlayer({
<video
ref={videoRef}
className="w-full h-full object-contain touch-none"
src={proxiedSrc}
src={src}
poster={poster}
onPlay={handlePlay}
onPause={handlePause}
+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');
}