Skip to content

Commit

Permalink
Merge pull request #43025 from jacobnguyen0000/issue-42427
Browse files Browse the repository at this point in the history
Incorrect video is paused after turning on and off full screen mode
  • Loading branch information
grgia authored Jun 12, 2024
2 parents b70b136 + 82c3c18 commit 8e87c07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/VideoPlayer/BaseVideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ function BaseVideoPlayer({
);
// update shared video elements
useEffect(() => {
if (shouldUseSharedVideoElement || url !== currentlyPlayingURL || isFullScreenRef.current) {
if (shouldUseSharedVideoElement || url !== currentlyPlayingURL) {
return;
}
shareVideoPlayerElements(videoPlayerRef.current, videoPlayerElementParentRef.current, videoPlayerElementRef.current, isUploading);
shareVideoPlayerElements(videoPlayerRef.current, videoPlayerElementParentRef.current, videoPlayerElementRef.current, isUploading || isFullScreenRef.current);
}, [currentlyPlayingURL, shouldUseSharedVideoElement, shareVideoPlayerElements, url, isUploading, isFullScreenRef]);

// append shared video element to new parent (used for example in attachment modal)
Expand Down
4 changes: 2 additions & 2 deletions src/components/VideoPlayerContexts/PlaybackContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ function PlaybackContextProvider({children}: ChildrenProps) {
);

const shareVideoPlayerElements = useCallback(
(ref: VideoWithOnFullScreenUpdate | null, parent: View | HTMLDivElement | null, child: View | HTMLDivElement | null, isUploading: boolean) => {
(ref: VideoWithOnFullScreenUpdate | null, parent: View | HTMLDivElement | null, child: View | HTMLDivElement | null, shouldNotAutoPlay: boolean) => {
currentVideoPlayerRef.current = ref;
setOriginalParent(parent);
setSharedElement(child);
// Prevents autoplay when uploading the attachment
if (!isUploading) {
if (!shouldNotAutoPlay) {
playVideo();
}
},
Expand Down

0 comments on commit 8e87c07

Please sign in to comment.