diff --git a/components/player/VideoPlayer.tsx b/components/player/VideoPlayer.tsx index 2533090..4e22d0d 100644 --- a/components/player/VideoPlayer.tsx +++ b/components/player/VideoPlayer.tsx @@ -18,7 +18,7 @@ interface VideoPlayerProps { export function VideoPlayer({ playUrl, videoId, currentEpisode, onBack }: VideoPlayerProps) { const [videoError, setVideoError] = useState(''); const [useProxy, setUseProxy] = useState(false); - const [shouldAutoPlay, setShouldAutoPlay] = useState(false); + const [shouldAutoPlay, setShouldAutoPlay] = useState(true); // Use reactive hook to subscribe to history updates // This ensures the component re-renders when history is hydrated from localStorage const viewingHistory = useHistoryStore(state => state.viewingHistory); diff --git a/components/player/hooks/desktop/usePlaybackControls.ts b/components/player/hooks/desktop/usePlaybackControls.ts index 82762fb..2f5e74d 100644 --- a/components/player/hooks/desktop/usePlaybackControls.ts +++ b/components/player/hooks/desktop/usePlaybackControls.ts @@ -60,9 +60,12 @@ export function usePlaybackControls({ if (!videoRef.current) return; setDuration(videoRef.current.duration); setIsLoading(false); - if (initialTime > 0) { - videoRef.current.currentTime = initialTime; - } + + // Fix for stuck at 00:00:00: + // If initialTime is 0, we seek to a tiny offset to help the browser/HLS buffer start. + const startPosition = initialTime > 0 ? initialTime : 0.1; + videoRef.current.currentTime = startPosition; + videoRef.current.play().catch((err: Error) => { console.warn('Autoplay was prevented:', err); }); diff --git a/components/player/hooks/mobile/useMobilePlaybackControls.ts b/components/player/hooks/mobile/useMobilePlaybackControls.ts index 49e8fcd..6e2c201 100644 --- a/components/player/hooks/mobile/useMobilePlaybackControls.ts +++ b/components/player/hooks/mobile/useMobilePlaybackControls.ts @@ -75,9 +75,12 @@ export function useMobilePlaybackControls({ if (!videoRef.current) return; setDuration(videoRef.current.duration); setIsLoading(false); - if (initialTime > 0) { - videoRef.current.currentTime = initialTime; - } + + // Fix for stuck at 00:00:00: + // If initialTime is 0, we seek to a tiny offset to help the browser/HLS buffer start. + const startPosition = initialTime > 0 ? initialTime : 0.1; + videoRef.current.currentTime = startPosition; + videoRef.current.play().catch((err: Error) => { console.warn('Autoplay was prevented:', err); });