Skip to content
Merged
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
13 changes: 13 additions & 0 deletions src/components/VideoPlayer/BaseVideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ function BaseVideoPlayer({
[playVideo, videoResumeTryNumberRef],
);

const prevIsMutedRef = useRef(false);
const prevVolumeRef = useRef(0);

const handlePlaybackStatusUpdate = useCallback(
(status: AVPlaybackStatus) => {
if (!status.isLoaded) {
Expand All @@ -142,6 +145,16 @@ function BaseVideoPlayer({
onPlaybackStatusUpdate?.(status);
return;
}

if (prevIsMutedRef.current && prevVolumeRef.current === 0 && !status.isMuted) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This caused #60117, see #60117 (comment)

updateVolume(0.25);
}
Comment on lines +149 to +151
Copy link
Contributor

@hungvu193 hungvu193 Dec 18, 2024

Choose a reason for hiding this comment

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

This line caused this issue:
#52858

More details in: #52858 (comment)

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;
Expand Down