From 9af6e46d20f1c2c1aa27c1df9b3cd48c2a07d02f Mon Sep 17 00:00:00 2001 From: jeremy-croff Date: Thu, 14 Mar 2024 19:08:36 -0500 Subject: [PATCH] fix(38362): revert all optional chaining --- .../VideoPlayerContexts/PlaybackContext.tsx | 12 ++++++------ .../VideoPlayerContexts/VideoPopoverMenuContext.tsx | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/VideoPlayerContexts/PlaybackContext.tsx b/src/components/VideoPlayerContexts/PlaybackContext.tsx index d751f861711b..92eb1960deef 100644 --- a/src/components/VideoPlayerContexts/PlaybackContext.tsx +++ b/src/components/VideoPlayerContexts/PlaybackContext.tsx @@ -15,25 +15,25 @@ 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; } - currentVideoPlayerRef.current?.setStatusAsync(newStatus); + currentVideoPlayerRef?.current?.setStatusAsync(newStatus); }); }, [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..d5c04a6b234d 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], );