diff --git a/src/components/VideoPlayer/BaseVideoPlayer.tsx b/src/components/VideoPlayer/BaseVideoPlayer.tsx index 8c04830bed2f..91f02943680f 100644 --- a/src/components/VideoPlayer/BaseVideoPlayer.tsx +++ b/src/components/VideoPlayer/BaseVideoPlayer.tsx @@ -130,6 +130,9 @@ function BaseVideoPlayer({ [playVideo, videoResumeTryNumberRef], ); + const prevIsMutedRef = useRef(false); + const prevVolumeRef = useRef(0); + const handlePlaybackStatusUpdate = useCallback( (status: AVPlaybackStatus) => { if (!status.isLoaded) { @@ -142,6 +145,16 @@ function BaseVideoPlayer({ onPlaybackStatusUpdate?.(status); return; } + + if (prevIsMutedRef.current && prevVolumeRef.current === 0 && !status.isMuted) { + updateVolume(0.25); + } + if (isFullScreenRef.current && prevVolumeRef.current !== 0 && status.volume === 0 && !status.isMuted) { + currentVideoPlayerRef.current?.setStatusAsync({isMuted: true}); + } + prevIsMutedRef.current = status.isMuted; + prevVolumeRef.current = status.volume; + const isVideoPlaying = status.isPlaying; // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const currentDuration = status.durationMillis || videoDuration * 1000;