mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-12 00:59:52 +01:00
Round Video: Fix pause after first click on Safari (#1291)
This commit is contained in:
parent
6f4900fd4c
commit
2497488eec
@ -23,6 +23,7 @@ import useVideoCleanup from '../../../hooks/useVideoCleanup';
|
|||||||
import usePauseOnInactive from './hooks/usePauseOnInactive';
|
import usePauseOnInactive from './hooks/usePauseOnInactive';
|
||||||
import useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef';
|
import useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef';
|
||||||
import safePlay from '../../../util/safePlay';
|
import safePlay from '../../../util/safePlay';
|
||||||
|
import { fastRaf } from '../../../util/schedulers';
|
||||||
|
|
||||||
import ProgressSpinner from '../../ui/ProgressSpinner';
|
import ProgressSpinner from '../../ui/ProgressSpinner';
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ const RoundVideo: FC<OwnProps> = ({
|
|||||||
setProgress(0);
|
setProgress(0);
|
||||||
safePlay(playerRef.current!);
|
safePlay(playerRef.current!);
|
||||||
|
|
||||||
requestAnimationFrame(() => {
|
fastRaf(() => {
|
||||||
playingProgressRef.current!.innerHTML = '';
|
playingProgressRef.current!.innerHTML = '';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -162,7 +163,11 @@ const RoundVideo: FC<OwnProps> = ({
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
capturePlaying();
|
capturePlaying();
|
||||||
|
// Pause is a workaround for iOS Safari – otherwise it stops video after several frames
|
||||||
|
playerEl.pause();
|
||||||
playerEl.currentTime = 0;
|
playerEl.currentTime = 0;
|
||||||
|
safePlay(playerEl);
|
||||||
|
|
||||||
setIsActivated(true);
|
setIsActivated(true);
|
||||||
}
|
}
|
||||||
}, [capturePlaying, isActivated, mediaData]);
|
}, [capturePlaying, isActivated, mediaData]);
|
||||||
|
Loading…
Reference in New Issue
Block a user