Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP staging] Fix video not opening full screen #37840

Merged
merged 5 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting that this line removal causes video play sync issue back but we agreed to do this temporarily to unblock deploy.

Bringing this comment from https://github.com/Expensify/App/pull/37781/files#r1515026658

/>
</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
Loading