mirror of
https://github.com/videojs/video.js.git
synced 2025-03-29 22:07:10 +02:00
Added a disable
method on components.
Used it to hide the controls when player.controls is false. Also hiding big play button and poster if controls are false.
This commit is contained in:
parent
d54f473670
commit
64f7729b72
@ -11,6 +11,10 @@ vjs.BigPlayButton = vjs.Button.extend({
|
||||
init: function(player, options){
|
||||
vjs.Button.call(this, player, options);
|
||||
|
||||
if (!player.controls()) {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
player.on('play', vjs.bind(this, this.hide));
|
||||
// player.on('ended', vjs.bind(this, this.show));
|
||||
}
|
||||
@ -31,4 +35,4 @@ vjs.BigPlayButton.prototype.onClick = function(){
|
||||
//this.player_.currentTime(0);
|
||||
//}
|
||||
this.player_.play();
|
||||
};
|
||||
};
|
||||
|
@ -575,6 +575,21 @@ vjs.Component.prototype.unlockShowing = function(){
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Disable component by making it unshowable
|
||||
*/
|
||||
vjs.Component.prototype.disable = function(){
|
||||
this.hide();
|
||||
this.show = function(){};
|
||||
this.fadeIn = function(){};
|
||||
};
|
||||
|
||||
// TODO: Get enable working
|
||||
// vjs.Component.prototype.enable = function(){
|
||||
// this.fadeIn = vjs.Component.prototype.fadeIn;
|
||||
// this.show = vjs.Component.prototype.show;
|
||||
// };
|
||||
|
||||
/**
|
||||
* If a value is provided it will change the width of the player to that value
|
||||
* otherwise the width is returned
|
||||
|
4
src/js/controls.js
vendored
4
src/js/controls.js
vendored
@ -15,6 +15,10 @@ vjs.ControlBar = vjs.Component.extend({
|
||||
init: function(player, options){
|
||||
vjs.Component.call(this, player, options);
|
||||
|
||||
if (!player.controls()) {
|
||||
this.disable();
|
||||
}
|
||||
|
||||
player.one('play', vjs.bind(this, function(){
|
||||
var touchstart,
|
||||
fadeIn = vjs.bind(this, this.fadeIn),
|
||||
|
@ -11,7 +11,7 @@ vjs.PosterImage = vjs.Button.extend({
|
||||
init: function(player, options){
|
||||
vjs.Button.call(this, player, options);
|
||||
|
||||
if (!player.poster()) {
|
||||
if (!player.poster() || !player.controls()) {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
@ -41,4 +41,4 @@ vjs.PosterImage.prototype.createEl = function(){
|
||||
|
||||
vjs.PosterImage.prototype.onClick = function(){
|
||||
this.player_.play();
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user