Skip to content

Commit

Permalink
Merge pull request #37840 from Expensify/@Skalakid/video-sharing-foll…
Browse files Browse the repository at this point in the history
…ow-up

[CP staging] Fix video not opening full screen
  • Loading branch information
roryabraham authored Mar 6, 2024
2 parents f0f1ecc + 2b14e79 commit f759e3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ function CarouselItem({item, onPress, isFocused, isModalHovered}) {
isHovered={isModalHovered}
isFocused={isFocused}
optionalVideoDuration={item.duration}
isUsedInCarousel
/>
</View>

Expand Down
8 changes: 6 additions & 2 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,7 +140,8 @@ 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);
});
Expand All @@ -149,6 +151,7 @@ function BaseVideoPlayer({
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 @@ -162,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 f759e3b

Please sign in to comment.