diff --git a/src/components/VideoPlayerContexts/PlaybackContext.tsx b/src/components/VideoPlayerContexts/PlaybackContext.tsx index ae33a82fd0e7..caad4ce5519b 100644 --- a/src/components/VideoPlayerContexts/PlaybackContext.tsx +++ b/src/components/VideoPlayerContexts/PlaybackContext.tsx @@ -15,15 +15,15 @@ function PlaybackContextProvider({children}: ChildrenProps) { const {currentReportID} = useCurrentReportID() ?? {}; const pauseVideo = useCallback(() => { - currentVideoPlayerRef.current?.setStatusAsync({shouldPlay: false}); + currentVideoPlayerRef.current?.setStatusAsync?.({shouldPlay: false}); }, [currentVideoPlayerRef]); const stopVideo = useCallback(() => { - currentVideoPlayerRef.current?.stopAsync(); + currentVideoPlayerRef.current?.stopAsync?.(); }, [currentVideoPlayerRef]); const playVideo = useCallback(() => { - currentVideoPlayerRef.current?.getStatusAsync().then((status) => { + currentVideoPlayerRef.current?.getStatusAsync?.().then((status) => { const newStatus: AVPlaybackStatusToSet = {shouldPlay: true}; if ('durationMillis' in status && status.durationMillis === status.positionMillis) { newStatus.positionMillis = 0; @@ -33,7 +33,7 @@ function PlaybackContextProvider({children}: ChildrenProps) { }, [currentVideoPlayerRef]); const unloadVideo = useCallback(() => { - currentVideoPlayerRef.current?.unloadAsync(); + currentVideoPlayerRef.current?.unloadAsync?.(); }, [currentVideoPlayerRef]); const updateCurrentlyPlayingURL = useCallback( @@ -61,7 +61,7 @@ function PlaybackContextProvider({children}: ChildrenProps) { const checkVideoPlaying = useCallback( (statusCallback: StatusCallback) => { - currentVideoPlayerRef.current?.getStatusAsync().then((status) => { + currentVideoPlayerRef.current?.getStatusAsync?.().then((status) => { statusCallback('isPlaying' in status && status.isPlaying); }); }, diff --git a/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx b/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx index 0a53801683c3..f953ed802623 100644 --- a/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx +++ b/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx @@ -22,7 +22,7 @@ function VideoPopoverMenuContextProvider({children}: ChildrenProps) { const updatePlaybackSpeed = useCallback( (speed: PlaybackSpeed) => { setCurrentPlaybackSpeed(speed); - currentVideoPlayerRef.current?.setStatusAsync({rate: speed}); + currentVideoPlayerRef.current?.setStatusAsync?.({rate: speed}); }, [currentVideoPlayerRef], );