Skip to content

Commit

Permalink
fix(38362): revert all optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-croff committed Mar 15, 2024
1 parent 8d89308 commit 9af6e46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/components/VideoPlayerContexts/PlaybackContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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],
);
Expand Down

0 comments on commit 9af6e46

Please sign in to comment.