Video: Fix auto-pausing on iOS
This commit is contained in:
parent
41f2c3e26b
commit
ea6c28a5de
@ -15,11 +15,11 @@ export default function useVideoAutoPause(playerRef: { current: HTMLVideoElement
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasPlaying.current) {
|
wasPlaying.current = !playerRef.current.paused;
|
||||||
wasPlaying.current = !playerRef.current.paused;
|
|
||||||
}
|
|
||||||
|
|
||||||
playerRef.current.pause();
|
if (wasPlaying.current) {
|
||||||
|
playerRef.current.pause();
|
||||||
|
}
|
||||||
}, [playerRef]);
|
}, [playerRef]);
|
||||||
|
|
||||||
const unfreezePlaying = useCallback(() => {
|
const unfreezePlaying = useCallback(() => {
|
||||||
@ -30,8 +30,6 @@ export default function useVideoAutoPause(playerRef: { current: HTMLVideoElement
|
|||||||
) {
|
) {
|
||||||
safePlay(playerRef.current);
|
safePlay(playerRef.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
wasPlaying.current = false;
|
|
||||||
}, [playerRef]);
|
}, [playerRef]);
|
||||||
|
|
||||||
const unfreezePlayingOnRaf = useCallback(() => {
|
const unfreezePlayingOnRaf = useCallback(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user