mirror of
https://github.com/videojs/video.js.git
synced 2024-12-25 02:42:10 +02:00
Fixed issue where value & element objects were shared between players. Now defining those vars on init, instead of in prototype.
This commit is contained in:
parent
21a14a7871
commit
9fb3f8923e
@ -469,23 +469,23 @@ VideoJS.player.newBehavior("fullscreenToggle", function(element){
|
||||
/* Big Play Button Behaviors
|
||||
================================================================================ */
|
||||
VideoJS.player.newBehavior("bigPlayButton", function(element){
|
||||
if (!this.bigPlayButtons) {
|
||||
this.bigPlayButtons = [];
|
||||
if (!this.elements.bigPlayButtons) {
|
||||
this.elements.bigPlayButtons = [];
|
||||
this.onPlay(this.bigPlayButtonsOnPlay);
|
||||
this.onEnded(this.bigPlayButtonsOnEnded);
|
||||
}
|
||||
this.bigPlayButtons.push(element);
|
||||
this.elements.bigPlayButtons.push(element);
|
||||
this.activateElement(element, "playButton");
|
||||
},{
|
||||
bigPlayButtonsOnPlay: function(event){ this.hideBigPlayButtons(); },
|
||||
bigPlayButtonsOnEnded: function(event){ this.showBigPlayButtons(); },
|
||||
showBigPlayButtons: function(){
|
||||
this.each(this.bigPlayButtons, function(element){
|
||||
this.each(this.elements.bigPlayButtons, function(element){
|
||||
element.style.display = "block";
|
||||
});
|
||||
},
|
||||
hideBigPlayButtons: function(){
|
||||
this.each(this.bigPlayButtons, function(element){
|
||||
this.each(this.elements.bigPlayButtons, function(element){
|
||||
element.style.display = "none";
|
||||
});
|
||||
}
|
||||
|
@ -398,7 +398,6 @@ VideoJS.player.extend({
|
||||
|
||||
/* Player API - Translate functionality from player to video
|
||||
================================================================================ */
|
||||
values: {}, // Storage for setters and getters of the same name.
|
||||
addVideoListener: function(type, fn){ _V_.addListener(this.video, type, fn.rEvtContext(this)); },
|
||||
|
||||
play: function(){
|
||||
|
@ -17,6 +17,8 @@ var VideoJS = JRClass.extend({
|
||||
// Store reference to player on the video element.
|
||||
// So you can acess the player later: document.getElementById("video_id").player.play();
|
||||
this.video.player = this;
|
||||
this.values = {}; // Cache video values.
|
||||
this.elements = {}; // Store refs to controls elements.
|
||||
|
||||
// Default Options
|
||||
this.options = {
|
||||
@ -62,7 +64,6 @@ var VideoJS = JRClass.extend({
|
||||
/* Behaviors
|
||||
================================================================================ */
|
||||
behaviors: {},
|
||||
elements: {},
|
||||
newBehavior: function(name, activate, functions){
|
||||
this.behaviors[name] = activate;
|
||||
this.extend(functions);
|
||||
|
22
video.js
22
video.js
@ -1355,23 +1355,23 @@ VideoJS.player.newBehavior("fullscreenToggle", function(element){
|
||||
/* Big Play Button Behaviors
|
||||
================================================================================ */
|
||||
VideoJS.player.newBehavior("bigPlayButton", function(element){
|
||||
if (!this.elements.bigPlayButtons) {
|
||||
this.elements.bigPlayButtons = [];
|
||||
if (!this.bigPlayButtons) {
|
||||
this.bigPlayButtons = [];
|
||||
this.onPlay(this.bigPlayButtonsOnPlay);
|
||||
this.onEnded(this.bigPlayButtonsOnEnded);
|
||||
}
|
||||
this.elements.bigPlayButtons.push(element);
|
||||
this.bigPlayButtons.push(element);
|
||||
this.activateElement(element, "playButton");
|
||||
},{
|
||||
bigPlayButtonsOnPlay: function(event){ this.hideBigPlayButtons(); },
|
||||
bigPlayButtonsOnEnded: function(event){ this.showBigPlayButtons(); },
|
||||
showBigPlayButtons: function(){
|
||||
this.each(this.elements.bigPlayButtons, function(element){
|
||||
showBigPlayButtons: function(){
|
||||
this.each(this.bigPlayButtons, function(element){
|
||||
element.style.display = "block";
|
||||
});
|
||||
},
|
||||
hideBigPlayButtons: function(){
|
||||
this.each(this.elements.bigPlayButtons, function(element){
|
||||
hideBigPlayButtons: function(){
|
||||
this.each(this.bigPlayButtons, function(element){
|
||||
element.style.display = "none";
|
||||
});
|
||||
}
|
||||
@ -1442,11 +1442,11 @@ VideoJS.player.newBehavior("spinner", function(element){
|
||||
/* Subtitles
|
||||
================================================================================ */
|
||||
VideoJS.player.newBehavior("subtitlesDisplay", function(element){
|
||||
if (!this.elements.subtitlesDisplays) {
|
||||
this.elements.subtitlesDisplays = [];
|
||||
if (!this.subtitlesDisplays) {
|
||||
this.subtitlesDisplays = [];
|
||||
_V_.addListener(this.video, "timeupdate", this.subtitlesDisplaysOnVideoTimeUpdate.context(this));
|
||||
}
|
||||
this.elements.subtitlesDisplays.push(element);
|
||||
this.subtitlesDisplays.push(element);
|
||||
},{
|
||||
subtitlesDisplaysOnVideoTimeUpdate: function(){
|
||||
// show the subtitles
|
||||
@ -1472,7 +1472,7 @@ VideoJS.player.newBehavior("subtitlesDisplay", function(element){
|
||||
}
|
||||
},
|
||||
updateSubtitlesDisplays: function(val){
|
||||
this.each(this.elements.subtitlesDisplays, function(disp){
|
||||
this.each(this.subtitlesDisplays, function(disp){
|
||||
disp.innerHTML = val;
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user