diff --git a/src/components/player/AndroidVideoPlayer.tsx b/src/components/player/AndroidVideoPlayer.tsx index d0023374..0dc2da64 100644 --- a/src/components/player/AndroidVideoPlayer.tsx +++ b/src/components/player/AndroidVideoPlayer.tsx @@ -86,6 +86,16 @@ const AndroidVideoPlayer: React.FC = () => { } as any; }; + const defaultIosHeaders = () => { + if (Platform.OS !== 'ios') return {} as any; + return { + 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1 Nuvio/1.0', + 'Accept': '*/*', + 'Accept-Language': 'en-US,en;q=0.9', + 'Connection': 'keep-alive', + } as any; + }; + // Initialize Trakt autosync const traktAutosync = useTraktAutosync({ id: id || '', @@ -204,6 +214,10 @@ const AndroidVideoPlayer: React.FC = () => { const [errorDetails, setErrorDetails] = useState(''); const errorTimeoutRef = useRef(null); + // iOS startup timing diagnostics + const loadStartAtRef = useRef(null); + const firstFrameAtRef = useRef(null); + // Pause overlay state const [showPauseOverlay, setShowPauseOverlay] = useState(false); const pauseOverlayTimerRef = useRef(null); @@ -614,9 +628,10 @@ const AndroidVideoPlayer: React.FC = () => { isSeeking.current = false; // Resume playback on iOS if we paused for seeking if (Platform.OS === 'ios') { - const shouldResume = wasPlayingBeforeDragRef.current || iosWasPausedDuringSeekRef.current === false; + const shouldResume = wasPlayingBeforeDragRef.current || iosWasPausedDuringSeekRef.current === false || isDragging; + // Aggressively resume on iOS after seek if user was playing or this was a drag if (shouldResume) { - logger.log('[AndroidVideoPlayer] onSeek: resuming after drag/seek (iOS)'); + logger.log('[AndroidVideoPlayer] onSeek: resuming after seek (iOS)'); setPaused(false); } else { logger.log('[AndroidVideoPlayer] onSeek: staying paused (iOS)'); @@ -659,6 +674,13 @@ const AndroidVideoPlayer: React.FC = () => { const seekTime = Math.min(value, duration - END_EPSILON); seekToTime(seekTime); pendingSeekValue.current = null; + // iOS safety: if the user was playing before drag, ensure resume shortly after seek + if (Platform.OS === 'ios' && wasPlayingBeforeDragRef.current) { + setTimeout(() => { + logger.log('[AndroidVideoPlayer] handleSlidingComplete: forcing resume after seek (iOS)'); + setPaused(false); + }, 60); + } } // Restart auto-hide timer after interaction finishes if (controlsTimeout.current) { @@ -2067,13 +2089,27 @@ const AndroidVideoPlayer: React.FC = () => {