Video: Fix auto-pausing on iOS

This commit is contained in:
Alexander Zinchuk 2021-11-27 17:41:25 +01:00
parent 41f2c3e26b
commit ea6c28a5de

View File

@ -15,11 +15,11 @@ export default function useVideoAutoPause(playerRef: { current: HTMLVideoElement
return;
}
if (!wasPlaying.current) {
wasPlaying.current = !playerRef.current.paused;
}
if (wasPlaying.current) {
playerRef.current.pause();
}
}, [playerRef]);
const unfreezePlaying = useCallback(() => {
@ -30,8 +30,6 @@ export default function useVideoAutoPause(playerRef: { current: HTMLVideoElement
) {
safePlay(playerRef.current);
}
wasPlaying.current = false;
}, [playerRef]);
const unfreezePlayingOnRaf = useCallback(() => {