Skip to content

Commit

Permalink
Revert problem
Browse files Browse the repository at this point in the history
  • Loading branch information
pecanoro committed Mar 6, 2024
1 parent 39f60a2 commit 2b14e79
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/VideoPlayer/BaseVideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function BaseVideoPlayer({
setIsPopoverVisible(false);
};

// fix for iOS mWeb: preventing iOS native player edfault behavior from pausing the video when exiting fullscreen
// fix for iOS mWeb: preventing iOS native player default behavior from pausing the video when exiting fullscreen
const preventPausingWhenExitingFullscreen = useCallback(
(isVideoPlaying) => {
if (videoResumeTryNumber.current === 0 || isVideoPlaying) {
Expand Down Expand Up @@ -121,6 +121,7 @@ function BaseVideoPlayer({
const handleFullscreenUpdate = useCallback(
(e) => {
onFullscreenUpdate(e);

// fix for iOS native and mWeb: when switching to fullscreen and then exiting
// the fullscreen mode while playing, the video pauses
if (!isPlaying || e.fullscreenUpdate !== VideoFullscreenUpdate.PLAYER_DID_DISMISS) {
Expand All @@ -139,16 +140,19 @@ function BaseVideoPlayer({
const bindFunctions = useCallback(() => {
currentVideoPlayerRef.current._onPlaybackStatusUpdate = handlePlaybackStatusUpdate;
currentVideoPlayerRef.current._onFullscreenUpdate = handleFullscreenUpdate;
// update states after binding

// Update states after binding
currentVideoPlayerRef.current.getStatusAsync().then((status) => {
handlePlaybackStatusUpdate(status);
});
}, [currentVideoPlayerRef, handleFullscreenUpdate, handlePlaybackStatusUpdate]);

useEffect(() => {
if (!videoPlayerRef.current) {
if (!isUploading) {
return;
}

// If we are uploading a new video, we want to immediately set the video player ref.
currentVideoPlayerRef.current = videoPlayerRef.current;
}, [url, currentVideoPlayerRef, isUploading]);

Expand All @@ -161,6 +165,7 @@ function BaseVideoPlayer({
if (shouldUseSharedVideoElementRef.current) {
return;
}

// If it's not a shared video player, clear the video player ref.
currentVideoPlayerRef.current = null;
},
Expand Down

0 comments on commit 2b14e79

Please sign in to comment.