Skip to content

Commit

Permalink
fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbautistars12 committed Apr 14, 2024
1 parent f20c041 commit 5431131
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/VideoPlayer/BaseVideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type {AVPlaybackStatus, VideoFullscreenUpdateEvent} from 'expo-av';
import {ResizeMode, Video, VideoFullscreenUpdate} from 'expo-av';
import type {MutableRefObject} from 'react';
import React, {useCallback, useEffect, useRef, useState} from 'react';
import React, {useCallback, useEffect, useLayoutEffect, useRef, useState} from 'react';
import type {GestureResponderEvent} from 'react-native';
import {View} from 'react-native';
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
Expand Down Expand Up @@ -172,6 +172,15 @@ function BaseVideoPlayer({
});
}, [currentVideoPlayerRef, handleFullscreenUpdate, handlePlaybackStatusUpdate]);

useLayoutEffect(() =>
() => {
if(shouldUseSharedVideoElement || videoPlayerRef.current !== currentVideoPlayerRef.current) {
return;
}
currentVideoPlayerRef.current = null;
}
, [currentVideoPlayerRef, shouldUseSharedVideoElement]);

useEffect(() => {
if (!isUploading || !videoPlayerRef.current) {
return;
Expand Down

0 comments on commit 5431131

Please sign in to comment.