diff --git a/src/components/player/VideoPlayer.jsx b/src/components/player/VideoPlayer.jsx index 4a0a2c5..c717725 100644 --- a/src/components/player/VideoPlayer.jsx +++ b/src/components/player/VideoPlayer.jsx @@ -4,6 +4,6 @@ import Hls from 'hls.js'; export function VideoPlayer({ src, poster, autoPlay = true, muted = true, onProgress }) { const ref = useRef(null); - useEffect(() => { const video = ref.current; if (!video || !src) return undefined; const hls = new Hls(); if (video.canPlayType('application/vnd.apple.mpegurl')) video.src = src; else if (Hls.isSupported()) { hls.loadSource(src); hls.attachMedia(video); } const attempt = video.play(); attempt?.catch(() => {}); return () => { hls.destroy(); video.pause(); }; }, [src]); + useEffect(() => { const video = ref.current; if (!video || !src) return undefined; const hls = new Hls(); if (video.canPlayType('application/vnd.apple.mpegurl')) video.src = src; else if (Hls.isSupported()) { hls.loadSource(src); hls.attachMedia(video); } if (autoPlay) video.play().catch(() => {}); else video.pause(); return () => { hls.destroy(); video.pause(); }; }, [src, autoPlay]); return