Skip to content

Commit

Permalink
fix: silence play promise in a few more places (#5213)
Browse files Browse the repository at this point in the history
Silence the play promise in the Big Play Button, click-to-play, and the poster image.
  • Loading branch information
rtezera1 authored and gkatsev committed Jun 5, 2018
1 parent 4d9a6ae commit 7efefff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/js/big-play-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ class Player extends Component {
}

if (this.paused()) {
this.play();
silencePromise(this.play());
} else {
this.pause();
}
Expand Down
3 changes: 2 additions & 1 deletion src/js/poster-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Component from './component.js';
import * as Fn from './utils/fn.js';
import * as Dom from './utils/dom.js';
import * as browser from './utils/browser.js';
import {silencePromise} from './utils/promise';

/**
* A `ClickableComponent` that handles showing the poster image for the player.
Expand Down Expand Up @@ -126,7 +127,7 @@ class PosterImage extends ClickableComponent {
}

if (this.player_.paused()) {
this.player_.play();
silencePromise(this.player_.play());
} else {
this.player_.pause();
}
Expand Down

0 comments on commit 7efefff

Please sign in to comment.