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
|
||||
vjsPlayer?.muted(true);
|
||||
// $FlowIssue
|
||||
vjsPlayer?.play();
|
||||
// $FlowIssue
|
||||
document.querySelector('.video-js--tap-to-unmute')?.style.setProperty('visibility', 'visible');
|
||||
// $FlowIssue
|
||||
document
|
||||
.querySelector('.video-js--tap-to-unmute')
|
||||
?.style.setProperty('display', 'inline', 'important');
|
||||
const mutedPlayPromise = vjsPlayer?.play();
|
||||
if (mutedPlayPromise !== undefined) {
|
||||
mutedPlayPromise
|
||||
.then(() => {
|
||||
const tapToUnmuteButton = document.querySelector('.video-js--tap-to-unmute');
|
||||
|
||||
// $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 {
|
||||
// $FlowIssue
|
||||
vjsPlayer?.bigPlayButton?.show();
|
||||
|
|
Loading…
Reference in a new issue