Optimized Video: Fix priority video pausing (#4454)
This commit is contained in:
parent
b69e2b8d0f
commit
38ca3dd9de
@ -151,7 +151,7 @@ const RoundVideo: FC<OwnProps> = ({
|
||||
stopPrevious = stopPlaying;
|
||||
});
|
||||
|
||||
const tooglePlaying = useLastCallback(() => {
|
||||
const togglePlaying = useLastCallback(() => {
|
||||
const playerEl = playerRef.current!;
|
||||
if (isActivated) {
|
||||
if (playerEl.paused) {
|
||||
@ -175,7 +175,7 @@ const RoundVideo: FC<OwnProps> = ({
|
||||
if (!isInOneTimeModal) {
|
||||
return;
|
||||
}
|
||||
tooglePlaying();
|
||||
togglePlaying();
|
||||
}, [isInOneTimeModal]);
|
||||
|
||||
const handleClick = useLastCallback(() => {
|
||||
@ -196,7 +196,7 @@ const RoundVideo: FC<OwnProps> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
tooglePlaying();
|
||||
togglePlaying();
|
||||
});
|
||||
|
||||
const handleTimeUpdate = useLastCallback((e: React.UIEvent<HTMLVideoElement>) => {
|
||||
@ -250,6 +250,7 @@ const RoundVideo: FC<OwnProps> = ({
|
||||
muted={!isActivated}
|
||||
loop={!isActivated}
|
||||
playsInline
|
||||
isPriority
|
||||
onEnded={isActivated ? onStop ?? stopPlaying : undefined}
|
||||
onTimeUpdate={isActivated ? handleTimeUpdate : undefined}
|
||||
onReady={markPlayerReady}
|
||||
|
||||
@ -25,9 +25,9 @@ export default function useVideoAutoPause(
|
||||
requestMeasure(unfreezePlaying);
|
||||
});
|
||||
|
||||
useBackgroundMode(pause, unfreezePlayingOnRaf, !canPlay);
|
||||
useHeavyAnimationCheck(pause, unfreezePlaying, !canPlay);
|
||||
usePriorityPlaybackCheck(pause, unfreezePlaying, !canPlay);
|
||||
useBackgroundMode(pause, unfreezePlayingOnRaf, !canPlay || isPriority);
|
||||
useHeavyAnimationCheck(pause, unfreezePlaying, !canPlay || isPriority);
|
||||
usePriorityPlaybackCheck(pause, unfreezePlaying, !canPlay || isPriority);
|
||||
|
||||
const handlePlaying = useLastCallback(() => {
|
||||
if (!canPlayRef.current || (!isPriority && isFrozen())) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user