Skip to content

Commit

Permalink
allow poster image to toggle playback
Browse files Browse the repository at this point in the history
This allows the poster image to toggle play / pause on audio-only sources
  • Loading branch information
mmcc committed Apr 24, 2015
1 parent 697325e commit adc5415
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sandbox/icons.html.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<title>Video.js Icons Sandbox</title>

<link href="../build/files/video-js.css" rel="stylesheet" type="text/css">
<link href="../build/temp/video-js.css" rel="stylesheet" type="text/css">

<style>
.icon-list li span { font-size: 150% }
Expand Down
3 changes: 1 addition & 2 deletions sandbox/index.html.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

<link href="../build/temp/video-js.css" rel="stylesheet" type="text/css">

<!-- LOAD VIDEO.JS SOURCE FILES IN ORDER -->
<script src="../build/temp/video.js"></script>

<!-- Set the location of the flash SWF -->
<script>
videojs.options.flash.swf = '../build/temp/video-js.swf'
videojs.options.flash.swf = '../build/temp/video-js.swf';
</script>

</head>
Expand Down
6 changes: 6 additions & 0 deletions src/css/components/_control-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
display: none;
}

// Don't hide the control bar if it's audio
.video-js.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar {
opacity: 1;
visibility: visible;
}

/* IE8 is flakey with fonts, and you have to change the actual content to force
fonts to show/hide properly.
- "\9" IE8 hack didn't work for this
Expand Down
6 changes: 5 additions & 1 deletion src/js/poster-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ class PosterImage extends Button {
onClick() {
// 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
this.player_.play();
if (this.player_.paused()) {
this.player_.play();
} else {
this.player_.pause();
}
}

}
Expand Down

0 comments on commit adc5415

Please sign in to comment.