1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-03 15:12:49 +02:00

Make BigPlayButton show up when paused. Add 'showBigPlayButton' event to allow users to cancel that.

This commit is contained in:
Gary Katsevman 2013-03-11 18:03:56 -04:00
parent 57c5cefe0f
commit c94ceca337
2 changed files with 12 additions and 4 deletions

15
src/js/controls.js vendored
View File

@ -278,7 +278,14 @@ vjs.FullscreenToggle.prototype.onClick = function(){
vjs.BigPlayButton = function(player, options){
goog.base(this, player, options);
player.on('play', vjs.bind(this, this.hide));
player.on('play', vjs.bind(this, function() {
this.hide();
player.on('showBigPlayButton', vjs.bind(this, function(event) {
console.log(event);
this.show();
}));
}));
// player.on('ended', vjs.bind(this, this.show));
};
goog.inherits(vjs.BigPlayButton, vjs.Button);
@ -294,9 +301,9 @@ vjs.BigPlayButton.prototype.createEl = function(){
vjs.BigPlayButton.prototype.onClick = function(){
// Go back to the beginning if big play button is showing at the end.
// Have to check for current time otherwise it might throw a 'not ready' error.
if(this.player_.currentTime()) {
this.player_.currentTime(0);
}
//if(this.player_.currentTime()) {
//this.player_.currentTime(0);
//}
this.player_.play();
};

View File

@ -483,6 +483,7 @@ vjs.Player.prototype.play = function(){
// http://dev.w3.org/html5/spec/video.html#dom-media-pause
vjs.Player.prototype.pause = function(){
this.trigger(type:'showBigPlayButton', target: this.el_});
this.techCall('pause');
return this;
};