show controls if both calls to play fail (#1724)
This commit is contained in:
parent
7ea73c3f1b
commit
628da8bb04
1 changed files with 23 additions and 7 deletions
|
@ -510,13 +510,29 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
// $FlowIssue
|
// $FlowIssue
|
||||||
vjsPlayer?.muted(true);
|
vjsPlayer?.muted(true);
|
||||||
// $FlowIssue
|
// $FlowIssue
|
||||||
vjsPlayer?.play();
|
const mutedPlayPromise = vjsPlayer?.play();
|
||||||
// $FlowIssue
|
if (mutedPlayPromise !== undefined) {
|
||||||
document.querySelector('.video-js--tap-to-unmute')?.style.setProperty('visibility', 'visible');
|
mutedPlayPromise
|
||||||
// $FlowIssue
|
.then(() => {
|
||||||
document
|
const tapToUnmuteButton = document.querySelector('.video-js--tap-to-unmute');
|
||||||
.querySelector('.video-js--tap-to-unmute')
|
|
||||||
?.style.setProperty('display', 'inline', 'important');
|
// $FlowIssue
|
||||||
|
tapToUnmuteButton?.style.setProperty('visibility', 'visible');
|
||||||
|
// $FlowIssue
|
||||||
|
tapToUnmuteButton?.style.setProperty('display', 'inline', 'important');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// $FlowFixMe
|
||||||
|
vjsPlayer?.addClass('vjs-paused');
|
||||||
|
// $FlowFixMe
|
||||||
|
vjsPlayer?.addClass('vjs-has-started');
|
||||||
|
|
||||||
|
// $FlowFixMe
|
||||||
|
document.querySelector('.vjs-touch-overlay')?.classList.add('show-play-toggle');
|
||||||
|
// $FlowFixMe
|
||||||
|
document.querySelector('.vjs-play-control')?.classList.add('vjs-paused');
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// $FlowIssue
|
// $FlowIssue
|
||||||
vjsPlayer?.bigPlayButton?.show();
|
vjsPlayer?.bigPlayButton?.show();
|
||||||
|
|
Loading…
Reference in a new issue