From 5c4a1c23bb0fb8903631deacdca7728a7ada98e1 Mon Sep 17 00:00:00 2001 From: jeremy-croff Date: Thu, 14 Mar 2024 19:14:17 -0500 Subject: [PATCH] fix(38362): remove optional chain for ref --- .../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 92eb1960deef..caad4ce5519b 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 d5c04a6b234d..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], );