Skip to content

Commit a29156c

Browse files
rtezera1gkatsev
authored andcommitted
fix: silence play promise in a few more places (videojs#5213)
Silence the play promise in the Big Play Button, click-to-play, and the poster image.
1 parent 7c5a066 commit a29156c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/js/big-play-button.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import Button from './button.js';
55
import Component from './component.js';
6-
import {isPromise} from './utils/promise';
6+
import {isPromise, silencePromise} from './utils/promise';
77

88
/**
99
* The initial play button that shows before the video has played. The hiding of the
@@ -46,6 +46,7 @@ class BigPlayButton extends Button {
4646

4747
// exit early if clicked via the mouse
4848
if (this.mouseused_ && event.clientX && event.clientY) {
49+
silencePromise(playPromise);
4950
return;
5051
}
5152

src/js/player.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ class Player extends Component {
16371637
}
16381638

16391639
if (this.paused()) {
1640-
this.play();
1640+
silencePromise(this.play());
16411641
} else {
16421642
this.pause();
16431643
}

src/js/poster-image.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import ClickableComponent from './clickable-component.js';
55
import Component from './component.js';
66
import * as Fn from './utils/fn.js';
77
import * as Dom from './utils/dom.js';
8+
import {silencePromise} from './utils/promise';
89

910
/**
1011
* A `ClickableComponent` that handles showing the poster image for the player.
@@ -112,7 +113,7 @@ class PosterImage extends ClickableComponent {
112113
}
113114

114115
if (this.player_.paused()) {
115-
this.player_.play();
116+
silencePromise(this.player_.play());
116117
} else {
117118
this.player_.pause();
118119
}

0 commit comments

Comments
 (0)