Skip to content

Commit

Permalink
fix: showing custom poster with controls disabled (#3933)
Browse files Browse the repository at this point in the history
We previously hid the poster image when controls were disabled because
the poster image had a click handler on it. However, this meant that in
the case of Flash, which doesn't have a native poster image ability, we
lost the poster.

Fixes #1625.
  • Loading branch information
gkatsev authored Jan 11, 2017
1 parent 94fd5c1 commit 305e5ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions src/css/components/_poster.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@
display: block;
}

// Hide the poster when controls are disabled because it's clickable
// and the native poster can take over
.vjs-controls-disabled .vjs-poster {
display: none;
}

// Hide the poster when native controls are used otherwise it covers them
.vjs-using-native-controls .vjs-poster {
display: none;
Expand Down
5 changes: 4 additions & 1 deletion src/js/poster-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ class PosterImage extends ClickableComponent {
*/
handleClick(event) {
// We don't want a click to trigger playback when controls are disabled
// but CSS should be hiding the poster to prevent that from happening
if (!this.player_.controls()) {
return;
}

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

0 comments on commit 305e5ea

Please sign in to comment.