mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-15 00:33:44 +08:00
refactor: remove proxy URL handling from video player and HLS hook
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user