diff --git a/src/components/VideoPlayer/BaseVideoPlayer.tsx b/src/components/VideoPlayer/BaseVideoPlayer.tsx index bc7c32729c5..8230f9132d0 100644 --- a/src/components/VideoPlayer/BaseVideoPlayer.tsx +++ b/src/components/VideoPlayer/BaseVideoPlayer.tsx @@ -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) diff --git a/src/components/VideoPlayerContexts/PlaybackContext.tsx b/src/components/VideoPlayerContexts/PlaybackContext.tsx index 499dd2b07f6..0e5e7f993ee 100644 --- a/src/components/VideoPlayerContexts/PlaybackContext.tsx +++ b/src/components/VideoPlayerContexts/PlaybackContext.tsx @@ -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(); } },