2013-04-09 13:43:35 -07:00
|
|
|
/* Big Play Button
|
|
|
|
================================================================================ */
|
|
|
|
/**
|
|
|
|
* Initial play button. Shows before the video has played.
|
|
|
|
* @param {vjs.Player|Object} player
|
|
|
|
* @param {Object=} options
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
vjs.BigPlayButton = vjs.Button.extend({
|
|
|
|
/** @constructor */
|
|
|
|
init: function(player, options){
|
|
|
|
vjs.Button.call(this, player, options);
|
|
|
|
|
2013-05-02 18:35:32 -07:00
|
|
|
if (!player.controls()) {
|
|
|
|
this.hide();
|
|
|
|
}
|
|
|
|
|
2013-04-09 13:43:35 -07:00
|
|
|
player.on('play', vjs.bind(this, this.hide));
|
|
|
|
// player.on('ended', vjs.bind(this, this.show));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
vjs.BigPlayButton.prototype.createEl = function(){
|
|
|
|
return vjs.Button.prototype.createEl.call(this, 'div', {
|
|
|
|
className: 'vjs-big-play-button',
|
|
|
|
innerHTML: '<span></span>',
|
|
|
|
'aria-label': 'play video'
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
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);
|
|
|
|
//}
|
|
|
|
this.player_.play();
|
2013-05-02 18:35:32 -07:00
|
|
|
};
|