1
0
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:
Robel Tezera 2018-06-04 15:25:51 -04:00 committed by Gary Katsevman
parent 7c5a066f2a
commit a29156ca7b
3 changed files with 5 additions and 3 deletions

View File

@ -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;
}

View File

@ -1637,7 +1637,7 @@ class Player extends Component {
}
if (this.paused()) {
this.play();
silencePromise(this.play());
} else {
this.pause();
}

View File

@ -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();
}