1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-13 10:32:26 +02:00

Updated remaining event listener function names.

This commit is contained in:
Steve Heffernan 2012-03-26 11:23:05 -07:00
parent eff300cebb
commit 82e2322493
5 changed files with 30 additions and 30 deletions

View File

@ -221,7 +221,7 @@ _V_.Component = _V_.Class.extend({
this.readyQueue = [];
// Allow for using event listeners also, in case you want to do something everytime a source is ready.
this.triggerEvent("ready");
this.trigger("ready");
}
},

4
src/controls.js vendored
View File

@ -46,12 +46,12 @@ _V_.ControlBar = _V_.Component.extend({
fadeIn: function(){
this._super();
this.player.triggerEvent("controlsvisible");
this.player.trigger("controlsvisible");
},
fadeOut: function(){
this._super();
this.player.triggerEvent("controlshidden");
this.player.trigger("controlshidden");
},
lockShowing: function(){

View File

@ -235,8 +235,8 @@ _V_.extend({
triggerEvent: function(){ return _V_.trigger.apply(this, arguments); },
one: function(elem, type, fn) {
_V_.addEvent(elem, type, function(){
_V_.removeEvent(elem, type, arguments.callee)
_V_.on(elem, type, function(){
_V_.off(elem, type, arguments.callee)
fn.apply(this, arguments);
});
}

View File

@ -280,10 +280,10 @@ _V_.Player = _V_.Component.extend({
// log(this.values.bufferEnd, this.buffered().end(0), this.duration())
/* TODO: update for multiple buffered regions */
if (this.values.bufferEnd < this.buffered().end(0)) {
this.triggerEvent("progress");
this.trigger("progress");
} else if (this.bufferedPercent() == 1) {
this.stopTrackingProgress();
this.triggerEvent("progress"); // Last update
this.trigger("progress"); // Last update
}
}), 500);
},
@ -321,7 +321,7 @@ _V_.Player = _V_.Component.extend({
trackCurrentTime: function(){
if (this.currentTimeInterval) { this.stopTrackingCurrentTime(); }
this.currentTimeInterval = setInterval(_V_.proxy(this, function(){
this.triggerEvent("timeupdate");
this.trigger("timeupdate");
}), 250); // 42 = 24 fps // 250 is what Webkit uses // FF uses 15
},
@ -354,7 +354,7 @@ _V_.Player = _V_.Component.extend({
onProgress: function(){
// Add custom event for when source is finished downloading.
if (this.bufferedPercent() == 1) {
this.triggerEvent("loadedalldata");
this.trigger("loadedalldata");
}
},
@ -458,7 +458,7 @@ _V_.Player = _V_.Component.extend({
this.techCall("setCurrentTime", seconds);
// Improve the accuracy of manual timeupdates
if (this.manualTimeUpdates) { this.triggerEvent("timeupdate"); }
if (this.manualTimeUpdates) { this.trigger("timeupdate"); }
return this;
}
@ -537,7 +537,7 @@ _V_.Player = _V_.Component.extend({
this.el.style.width = width+"px";
// skipListeners allows us to avoid triggering the resize event when setting both width and height
if (!skipListeners) { this.triggerEvent("resize"); }
if (!skipListeners) { this.trigger("resize"); }
return this;
}
return parseInt(this.el.getAttribute("width"));
@ -546,7 +546,7 @@ _V_.Player = _V_.Component.extend({
if (height !== undefined) {
this.el.height = height;
this.el.style.height = height+"px";
this.triggerEvent("resize");
this.trigger("resize");
return this;
}
return parseInt(this.el.getAttribute("height"));
@ -578,7 +578,7 @@ _V_.Player = _V_.Component.extend({
_V_.removeEvent(document, requestFullScreen.eventName, arguments.callee);
}
this.triggerEvent("fullscreenchange");
this.trigger("fullscreenchange");
}));
// Flash and other plugins get reloaded when you take their parent to fullscreen.
@ -600,11 +600,11 @@ _V_.Player = _V_.Component.extend({
}
} else if (this.tech.supportsFullScreen()) {
this.triggerEvent("fullscreenchange");
this.trigger("fullscreenchange");
this.techCall("enterFullScreen");
} else {
this.triggerEvent("fullscreenchange");
this.trigger("fullscreenchange");
this.enterFullWindow();
}
@ -639,11 +639,11 @@ _V_.Player = _V_.Component.extend({
} else if (this.tech.supportsFullScreen()) {
this.techCall("exitFullScreen");
this.triggerEvent("fullscreenchange");
this.trigger("fullscreenchange");
} else {
this.exitFullWindow();
this.triggerEvent("fullscreenchange");
this.trigger("fullscreenchange");
}
return this;
@ -666,7 +666,7 @@ _V_.Player = _V_.Component.extend({
_V_.addClass(document.body, "vjs-full-window");
_V_.addClass(this.el, "vjs-fullscreen");
this.triggerEvent("enterFullWindow");
this.trigger("enterFullWindow");
},
fullWindowOnEscKey: function(event){
if (event.keyCode == 27) {
@ -691,7 +691,7 @@ _V_.Player = _V_.Component.extend({
// Resize the box, controller, and poster to original sizes
// this.positionAll();
this.triggerEvent("exitFullWindow");
this.trigger("exitFullWindow");
},
selectSource: function(sources){

View File

@ -63,7 +63,7 @@ _V_.merge(_V_.Player.prototype, {
// Trigger trackchange event, captionstrackchange, subtitlestrackchange, etc.
if (kind) {
this.triggerEvent(kind+"trackchange");
this.trigger(kind+"trackchange");
}
return this;
@ -184,10 +184,10 @@ _V_.Track = _V_.Component.extend({
if (this.mode == 0) {
// Update current cue on timeupdate
// Using unique ID for proxy function so other tracks don't remove listener
this.player.addEvent("timeupdate", this.proxy(this.update, this.id));
this.player.on("timeupdate", this.proxy(this.update, this.id));
// Reset cue time on media end
this.player.addEvent("ended", this.proxy(this.reset, this.id));
this.player.on("ended", this.proxy(this.reset, this.id));
// Add to display
if (this.kind == "captions" || this.kind == "subtitles") {
@ -199,8 +199,8 @@ _V_.Track = _V_.Component.extend({
// Turn off cue tracking.
deactivate: function(){
// Using unique ID for proxy function so other tracks don't remove listener
this.player.removeEvent("timeupdate", this.proxy(this.update, this.id));
this.player.removeEvent("ended", this.proxy(this.reset, this.id));
this.player.off("timeupdate", this.proxy(this.update, this.id));
this.player.off("ended", this.proxy(this.reset, this.id));
this.reset(); // Reset
// Remove from display
@ -234,7 +234,7 @@ _V_.Track = _V_.Component.extend({
onError: function(err){
this.error = err;
this.readyState = 3;
this.triggerEvent("error");
this.trigger("error");
},
// Parse the WebVTT text format for cue times.
@ -289,7 +289,7 @@ _V_.Track = _V_.Component.extend({
}
this.readyState = 2;
this.triggerEvent("loaded");
this.trigger("loaded");
},
parseCueTime: function(timeText) {
@ -437,7 +437,7 @@ _V_.Track = _V_.Component.extend({
this.updateDisplay();
this.triggerEvent("cuechange");
this.trigger("cuechange");
}
}
},
@ -504,7 +504,7 @@ _V_.TextTrackMenuItem = _V_.MenuItem.extend({
options.selected = track["default"];
this._super(player, options);
this.player.addEvent(track.kind + "trackchange", _V_.proxy(this, this.update));
this.player.on(track.kind + "trackchange", _V_.proxy(this, this.update));
},
onClick: function(){
@ -685,7 +685,7 @@ _V_.ChaptersButton = _V_.TextTrackButton.extend({
if (track.kind == this.kind && track["default"]) {
if (track.readyState < 2) {
this.chaptersTrack = track;
track.addEvent("loaded", this.proxy(this.createMenu));
track.on("loaded", this.proxy(this.createMenu));
return;
} else {
chaptersTrack = track;
@ -743,7 +743,7 @@ _V_.ChaptersTrackMenuItem = _V_.MenuItem.extend({
options.selected = (cue.startTime <= currentTime && currentTime < cue.endTime);
this._super(player, options);
track.addEvent("cuechange", _V_.proxy(this, this.update));
track.on("cuechange", _V_.proxy(this, this.update));
},
onClick: function(){