Skip to content

Commit

Permalink
Fix when switching to fullscreen and then exiting fullscreen mode whi…
Browse files Browse the repository at this point in the history
…le playing, the video pauses
  • Loading branch information
kowczarz committed Feb 8, 2024
1 parent f479d57 commit 7a858b7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/VideoPlayer/BaseVideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function BaseVideoPlayer({
}) {
const styles = useThemeStyles();
const {isSmallScreenWidth} = useWindowDimensions();
const {currentlyPlayingURL, updateSharedElements, sharedElement, originalParent, shareVideoPlayerElements, currentVideoPlayerRef} = usePlaybackContext();
const {playVideo, currentlyPlayingURL, updateSharedElements, sharedElement, originalParent, shareVideoPlayerElements, currentVideoPlayerRef} = usePlaybackContext();
const [duration, setDuration] = useState(videoDuration);
const [position, setPosition] = useState(0);
const [isPlaying, setIsPlaying] = useState(false);
Expand Down Expand Up @@ -143,6 +143,14 @@ function BaseVideoPlayer({
isLooping={isLooping}
onReadyForDisplay={onVideoLoaded}
onPlaybackStatusUpdate={onPlaybackStatusUpdate}
onFullscreenUpdate={(event) => {
// fix for iOS native and mWeb: when switching to fullscreen and then exiting
// the fullscreen mode while playing, the video pauses
if (!event.status.isPlaying) {
return;
}
playVideo();
}}
/>
</View>
</View>
Expand Down

0 comments on commit 7a858b7

Please sign in to comment.