mirror of
https://github.com/videojs/video.js.git
synced 2024-11-24 08:42:25 +02:00
fix: silence play promise in a few more places (#5213)
Silence the play promise in the Big Play Button, click-to-play, and the poster image.
This commit is contained in:
parent
7c5a066f2a
commit
a29156ca7b
@ -3,7 +3,7 @@
|
||||
*/
|
||||
import Button from './button.js';
|
||||
import Component from './component.js';
|
||||
import {isPromise} from './utils/promise';
|
||||
import {isPromise, silencePromise} from './utils/promise';
|
||||
|
||||
/**
|
||||
* The initial play button that shows before the video has played. The hiding of the
|
||||
@ -46,6 +46,7 @@ class BigPlayButton extends Button {
|
||||
|
||||
// exit early if clicked via the mouse
|
||||
if (this.mouseused_ && event.clientX && event.clientY) {
|
||||
silencePromise(playPromise);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1637,7 +1637,7 @@ class Player extends Component {
|
||||
}
|
||||
|
||||
if (this.paused()) {
|
||||
this.play();
|
||||
silencePromise(this.play());
|
||||
} else {
|
||||
this.pause();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import ClickableComponent from './clickable-component.js';
|
||||
import Component from './component.js';
|
||||
import * as Fn from './utils/fn.js';
|
||||
import * as Dom from './utils/dom.js';
|
||||
import {silencePromise} from './utils/promise';
|
||||
|
||||
/**
|
||||
* A `ClickableComponent` that handles showing the poster image for the player.
|
||||
@ -112,7 +113,7 @@ class PosterImage extends ClickableComponent {
|
||||
}
|
||||
|
||||
if (this.player_.paused()) {
|
||||
this.player_.play();
|
||||
silencePromise(this.player_.play());
|
||||
} else {
|
||||
this.player_.pause();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user