mirror of
https://github.com/videojs/video.js.git
synced 2025-03-17 21:18:27 +02:00
Updated player API to support poster and controls
This commit is contained in:
parent
2c28d44f92
commit
07d03e1a27
6
src/js/controls.js
vendored
6
src/js/controls.js
vendored
@ -914,7 +914,7 @@ vjs.MuteToggle.prototype.update = function(){
|
||||
vjs.PosterImage = function(player, options){
|
||||
goog.base(this, player, options);
|
||||
|
||||
if (!this.player_.options_['poster']) {
|
||||
if (!player.poster()) {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
@ -931,8 +931,8 @@ vjs.PosterImage.prototype.createEl = function(){
|
||||
});
|
||||
|
||||
// src throws errors if no poster was defined.
|
||||
if (this.player_.options_['poster']) {
|
||||
el.src = this.player_.options_['poster'];
|
||||
if (this.player_.poster()) {
|
||||
el.src = this.player_.poster();
|
||||
}
|
||||
return el;
|
||||
};
|
||||
|
@ -194,7 +194,6 @@ vjs.Html5.prototype.ended = function(){ return this.el_.ended; };
|
||||
// playbackRate: function(){ return this.el_.playbackRate; },
|
||||
// mediaGroup: function(){ return this.el_.mediaGroup; },
|
||||
// controller: function(){ return this.el_.controller; },
|
||||
vjs.Html5.prototype.controls = function(){ return this.player_.options_['controls']; };
|
||||
vjs.Html5.prototype.defaultMuted = function(){ return this.el_.defaultMuted; };
|
||||
|
||||
/* HTML5 Support Testing ---------------------------------------------------- */
|
||||
|
@ -29,7 +29,7 @@ goog.inherits(vjs.MediaTechController, vjs.Component);
|
||||
* Handle a click on the media element. By default will play the media.
|
||||
*/
|
||||
vjs.MediaTechController.prototype.onClick = function(){
|
||||
if (this.player_.options_['controls']) {
|
||||
if (this.player_.controls()) {
|
||||
if (this.player_.paused()) {
|
||||
this.player_.play();
|
||||
} else {
|
||||
|
@ -30,6 +30,11 @@ vjs.Player = function(tag, options, ready){
|
||||
// Inits and embeds any child components in opts
|
||||
vjs.Component.call(this, this, opts, ready);
|
||||
|
||||
// Set poster
|
||||
this.poster_ = this.options_['poster'];
|
||||
// Set controls
|
||||
this.controls_ = this.options_['controls'];
|
||||
|
||||
// Firstplay event implimentation. Not sold on the event yet.
|
||||
// Could probably just check currentTime==0?
|
||||
this.one('play', function(e){
|
||||
@ -809,8 +814,44 @@ vjs.Player.prototype.loop = function(value){
|
||||
return this.techGet('loop');
|
||||
};
|
||||
|
||||
vjs.Player.prototype.controls = function(){ return this.options_['controls']; };
|
||||
vjs.Player.prototype.poster = function(){ return this.techGet('poster'); };
|
||||
/**
|
||||
* The url of the poster image source.
|
||||
* @type {String}
|
||||
* @private
|
||||
*/
|
||||
vjs.Player.prototype.poster_;
|
||||
|
||||
/**
|
||||
* Get or set the poster image source url.
|
||||
* @param {String} src Poster image source URL
|
||||
* @return {String=} Poster image source URL or null
|
||||
*/
|
||||
vjs.Player.prototype.poster = function(src){
|
||||
if (src !== undefined) {
|
||||
this.poster_ = src;
|
||||
}
|
||||
return this.poster_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether or not the controls are showing
|
||||
* @type {Boolean}
|
||||
* @private
|
||||
*/
|
||||
vjs.Player.prototype.controls_;
|
||||
|
||||
/**
|
||||
* Get or set whether or not the controls are showing.
|
||||
* @param {Boolean} controls Set controls to showing or not
|
||||
* @return {Boolean} Controls are showing
|
||||
*/
|
||||
vjs.Player.prototype.controls = function(controls){
|
||||
if (controls !== undefined) {
|
||||
this.controls_ = controls;
|
||||
}
|
||||
return this.controls_;
|
||||
};
|
||||
|
||||
vjs.Player.prototype.error = function(){ return this.techGet('error'); };
|
||||
vjs.Player.prototype.ended = function(){ return this.techGet('ended'); };
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user