mirror of
https://github.com/videojs/video.js.git
synced 2025-01-21 11:02:08 +02:00
Merge branch 'feature/changing-addevent-to-on'
This commit is contained in:
commit
a671e6b9d8
@ -1,3 +1,4 @@
|
||||
* Changed addEvent function name to 'on'.
|
||||
* Removed conflicting array.indexOf function
|
||||
Added exitFullScreen to support BlackBerry devices (pull/143)
|
||||
--------------------------------------------------------------------------------
|
||||
|
@ -170,15 +170,24 @@ _V_.Component = _V_.Class.extend({
|
||||
|
||||
/* Events
|
||||
================================================================================ */
|
||||
addEvent: function(type, fn, uid){
|
||||
return _V_.addEvent(this.el, type, _V_.proxy(this, fn));
|
||||
on: function(type, fn, uid){
|
||||
return _V_.on(this.el, type, _V_.proxy(this, fn));
|
||||
},
|
||||
removeEvent: function(type, fn){
|
||||
return _V_.removeEvent(this.el, type, fn);
|
||||
// Deprecated name for 'on' function
|
||||
addEvent: function(){ return this.on.apply(this, arguments); },
|
||||
|
||||
off: function(type, fn){
|
||||
return _V_.off(this.el, type, fn);
|
||||
},
|
||||
triggerEvent: function(type, e){
|
||||
return _V_.triggerEvent(this.el, type, e);
|
||||
// Deprecated name for 'off' function
|
||||
removeEvent: function(){ return this.off.apply(this, arguments); },
|
||||
|
||||
trigger: function(type, e){
|
||||
return _V_.trigger(this.el, type, e);
|
||||
},
|
||||
// Deprecated name for 'off' function
|
||||
triggerEvent: function(){ return this.trigger.apply(this, arguments); },
|
||||
|
||||
one: function(type, fn) {
|
||||
_V_.one(this.el, type, _V_.proxy(this, fn));
|
||||
},
|
||||
@ -212,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");
|
||||
}
|
||||
},
|
||||
|
||||
|
78
src/controls.js
vendored
78
src/controls.js
vendored
@ -30,10 +30,10 @@ _V_.ControlBar = _V_.Component.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
player.addEvent("play", this.proxy(function(){
|
||||
player.on("play", this.proxy(function(){
|
||||
this.fadeIn();
|
||||
this.player.addEvent("mouseover", this.proxy(this.fadeIn));
|
||||
this.player.addEvent("mouseout", this.proxy(this.fadeOut));
|
||||
this.player.on("mouseover", this.proxy(this.fadeIn));
|
||||
this.player.on("mouseout", this.proxy(this.fadeOut));
|
||||
}));
|
||||
|
||||
},
|
||||
@ -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(){
|
||||
@ -67,9 +67,9 @@ _V_.Button = _V_.Control.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
this.addEvent("click", this.onClick);
|
||||
this.addEvent("focus", this.onFocus);
|
||||
this.addEvent("blur", this.onBlur);
|
||||
this.on("click", this.onClick);
|
||||
this.on("focus", this.onFocus);
|
||||
this.on("blur", this.onBlur);
|
||||
},
|
||||
|
||||
createElement: function(type, attrs){
|
||||
@ -89,7 +89,7 @@ _V_.Button = _V_.Control.extend({
|
||||
|
||||
// Focus - Add keyboard functionality to element
|
||||
onFocus: function(){
|
||||
_V_.addEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
|
||||
_V_.on(document, "keyup", _V_.proxy(this, this.onKeyPress));
|
||||
},
|
||||
|
||||
// KeyPress (document level) - Trigger click when keys are pressed
|
||||
@ -103,7 +103,7 @@ _V_.Button = _V_.Control.extend({
|
||||
|
||||
// Blur - Remove keyboard triggers
|
||||
onBlur: function(){
|
||||
_V_.removeEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
|
||||
_V_.off(document, "keyup", _V_.proxy(this, this.onKeyPress));
|
||||
}
|
||||
|
||||
});
|
||||
@ -149,8 +149,8 @@ _V_.PlayToggle = _V_.Button.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
player.addEvent("play", _V_.proxy(this, this.onPlay));
|
||||
player.addEvent("pause", _V_.proxy(this, this.onPause));
|
||||
player.on("play", _V_.proxy(this, this.onPlay));
|
||||
player.on("pause", _V_.proxy(this, this.onPause));
|
||||
},
|
||||
|
||||
buildCSSClass: function(){
|
||||
@ -207,8 +207,8 @@ _V_.BigPlayButton = _V_.Button.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
player.addEvent("play", _V_.proxy(this, this.hide));
|
||||
player.addEvent("ended", _V_.proxy(this, this.show));
|
||||
player.on("play", _V_.proxy(this, this.hide));
|
||||
player.on("ended", _V_.proxy(this, this.show));
|
||||
},
|
||||
|
||||
createElement: function(){
|
||||
@ -234,18 +234,18 @@ _V_.LoadingSpinner = _V_.Component.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
player.addEvent("canplay", _V_.proxy(this, this.hide));
|
||||
player.addEvent("canplaythrough", _V_.proxy(this, this.hide));
|
||||
player.addEvent("playing", _V_.proxy(this, this.hide));
|
||||
player.on("canplay", _V_.proxy(this, this.hide));
|
||||
player.on("canplaythrough", _V_.proxy(this, this.hide));
|
||||
player.on("playing", _V_.proxy(this, this.hide));
|
||||
|
||||
player.addEvent("seeking", _V_.proxy(this, this.show));
|
||||
player.addEvent("error", _V_.proxy(this, this.show));
|
||||
player.on("seeking", _V_.proxy(this, this.show));
|
||||
player.on("error", _V_.proxy(this, this.show));
|
||||
|
||||
// Not showing spinner on stalled any more. Browsers may stall and then not trigger any events that would remove the spinner.
|
||||
// Checked in Chrome 16 and Safari 5.1.2. http://help.videojs.com/discussions/problems/883-why-is-the-download-progress-showing
|
||||
// player.addEvent("stalled", _V_.proxy(this, this.show));
|
||||
// player.on("stalled", _V_.proxy(this, this.show));
|
||||
|
||||
player.addEvent("waiting", _V_.proxy(this, this.show));
|
||||
player.on("waiting", _V_.proxy(this, this.show));
|
||||
},
|
||||
|
||||
createElement: function(){
|
||||
@ -278,7 +278,7 @@ _V_.CurrentTimeDisplay = _V_.Component.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
player.addEvent("timeupdate", _V_.proxy(this, this.updateContent));
|
||||
player.on("timeupdate", _V_.proxy(this, this.updateContent));
|
||||
},
|
||||
|
||||
createElement: function(){
|
||||
@ -308,7 +308,7 @@ _V_.DurationDisplay = _V_.Component.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
player.addEvent("timeupdate", _V_.proxy(this, this.updateContent));
|
||||
player.on("timeupdate", _V_.proxy(this, this.updateContent));
|
||||
},
|
||||
|
||||
createElement: function(){
|
||||
@ -348,7 +348,7 @@ _V_.RemainingTimeDisplay = _V_.Component.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
player.addEvent("timeupdate", _V_.proxy(this, this.updateContent));
|
||||
player.on("timeupdate", _V_.proxy(this, this.updateContent));
|
||||
},
|
||||
|
||||
createElement: function(){
|
||||
@ -382,13 +382,13 @@ _V_.Slider = _V_.Component.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
player.addEvent(this.playerEvent, _V_.proxy(this, this.update));
|
||||
player.on(this.playerEvent, _V_.proxy(this, this.update));
|
||||
|
||||
this.addEvent("mousedown", this.onMouseDown);
|
||||
this.addEvent("focus", this.onFocus);
|
||||
this.addEvent("blur", this.onBlur);
|
||||
this.on("mousedown", this.onMouseDown);
|
||||
this.on("focus", this.onFocus);
|
||||
this.on("blur", this.onBlur);
|
||||
|
||||
this.player.addEvent("controlsvisible", this.proxy(this.update));
|
||||
this.player.on("controlsvisible", this.proxy(this.update));
|
||||
|
||||
// This is actually to fix the volume handle position. http://twitter.com/#!/gerritvanaaken/status/159046254519787520
|
||||
// this.player.one("timeupdate", this.proxy(this.update));
|
||||
@ -412,16 +412,16 @@ _V_.Slider = _V_.Component.extend({
|
||||
event.preventDefault();
|
||||
_V_.blockTextSelection();
|
||||
|
||||
_V_.addEvent(document, "mousemove", _V_.proxy(this, this.onMouseMove));
|
||||
_V_.addEvent(document, "mouseup", _V_.proxy(this, this.onMouseUp));
|
||||
_V_.on(document, "mousemove", _V_.proxy(this, this.onMouseMove));
|
||||
_V_.on(document, "mouseup", _V_.proxy(this, this.onMouseUp));
|
||||
|
||||
this.onMouseMove(event);
|
||||
},
|
||||
|
||||
onMouseUp: function(event) {
|
||||
_V_.unblockTextSelection();
|
||||
_V_.removeEvent(document, "mousemove", this.onMouseMove, false);
|
||||
_V_.removeEvent(document, "mouseup", this.onMouseUp, false);
|
||||
_V_.off(document, "mousemove", this.onMouseMove, false);
|
||||
_V_.off(document, "mouseup", this.onMouseUp, false);
|
||||
|
||||
this.update();
|
||||
},
|
||||
@ -491,7 +491,7 @@ _V_.Slider = _V_.Component.extend({
|
||||
},
|
||||
|
||||
onFocus: function(event){
|
||||
_V_.addEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
|
||||
_V_.on(document, "keyup", _V_.proxy(this, this.onKeyPress));
|
||||
},
|
||||
|
||||
onKeyPress: function(event){
|
||||
@ -505,7 +505,7 @@ _V_.Slider = _V_.Component.extend({
|
||||
},
|
||||
|
||||
onBlur: function(event){
|
||||
_V_.removeEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
|
||||
_V_.off(document, "keyup", _V_.proxy(this, this.onKeyPress));
|
||||
}
|
||||
});
|
||||
|
||||
@ -602,7 +602,7 @@ _V_.LoadProgressBar = _V_.Component.extend({
|
||||
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
player.addEvent("progress", _V_.proxy(this, this.update));
|
||||
player.on("progress", _V_.proxy(this, this.update));
|
||||
},
|
||||
|
||||
createElement: function(){
|
||||
@ -726,7 +726,7 @@ _V_.MuteToggle = _V_.Button.extend({
|
||||
init: function(player, options){
|
||||
this._super(player, options);
|
||||
|
||||
player.addEvent("volumechange", _V_.proxy(this, this.update));
|
||||
player.on("volumechange", _V_.proxy(this, this.update));
|
||||
},
|
||||
|
||||
createElement: function(){
|
||||
@ -772,7 +772,7 @@ _V_.PosterImage = _V_.Button.extend({
|
||||
this.hide();
|
||||
}
|
||||
|
||||
player.addEvent("play", _V_.proxy(this, this.hide));
|
||||
player.on("play", _V_.proxy(this, this.hide));
|
||||
},
|
||||
|
||||
createElement: function(){
|
||||
@ -801,7 +801,7 @@ _V_.Menu = _V_.Component.extend({
|
||||
|
||||
addItem: function(component){
|
||||
this.addComponent(component);
|
||||
component.addEvent("click", this.proxy(function(){
|
||||
component.on("click", this.proxy(function(){
|
||||
this.unlockShowing();
|
||||
}));
|
||||
},
|
||||
|
@ -15,7 +15,7 @@ _V_.extend({
|
||||
// It stores the handler function in a separate cache object
|
||||
// and adds a generic handler to the element's event,
|
||||
// along with a unique id (guid) to the element.
|
||||
addEvent: function(elem, type, fn){
|
||||
on: function(elem, type, fn){
|
||||
var data = _V_.getData(elem), handlers;
|
||||
|
||||
// We only need to generate one handler per element
|
||||
@ -61,8 +61,10 @@ _V_.extend({
|
||||
|
||||
handlers.push(fn);
|
||||
},
|
||||
// Deprecated name for 'on' function
|
||||
addEvent: function(){ return _V_.on.apply(this, arguments); },
|
||||
|
||||
removeEvent: function(elem, type, fn) {
|
||||
off: function(elem, type, fn) {
|
||||
var data = _V_.getData(elem), handlers;
|
||||
// If no events exist, nothing to unbind
|
||||
if (!data.events) { return; }
|
||||
@ -94,6 +96,8 @@ _V_.extend({
|
||||
|
||||
_V_.cleanUpEvents(elem, type);
|
||||
},
|
||||
// Deprecated name for 'on' function
|
||||
removeEvent: function(){ return _V_.off.apply(this, arguments); },
|
||||
|
||||
cleanUpEvents: function(elem, type) {
|
||||
var data = _V_.getData(elem);
|
||||
@ -174,7 +178,7 @@ _V_.extend({
|
||||
return event;
|
||||
},
|
||||
|
||||
triggerEvent: function(elem, event) {
|
||||
trigger: function(elem, event) {
|
||||
var data = _V_.getData(elem),
|
||||
parent = elem.parentNode || elem.ownerDocument,
|
||||
type = event.type || event,
|
||||
@ -227,10 +231,12 @@ _V_.extend({
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
// Deprecated name for 'on' function
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
@ -71,11 +71,11 @@ _V_.Player = _V_.Component.extend({
|
||||
|
||||
this.addClass("vjs-paused");
|
||||
|
||||
this.addEvent("ended", this.onEnded);
|
||||
this.addEvent("play", this.onPlay);
|
||||
this.addEvent("pause", this.onPause);
|
||||
this.addEvent("progress", this.onProgress);
|
||||
this.addEvent("error", this.onError);
|
||||
this.on("ended", this.onEnded);
|
||||
this.on("play", this.onPlay);
|
||||
this.on("pause", this.onPause);
|
||||
this.on("progress", this.onProgress);
|
||||
this.on("error", this.onError);
|
||||
|
||||
// When the API is ready, loop through the components and add to the player.
|
||||
if (options.controls) {
|
||||
@ -256,7 +256,7 @@ _V_.Player = _V_.Component.extend({
|
||||
// Watch for a native progress event call on the tech element
|
||||
// In HTML5, some older versions don't support the progress event
|
||||
// So we're assuming they don't, and turning off manual progress if they do.
|
||||
this.tech.addEvent("progress", function(){
|
||||
this.tech.on("progress", function(){
|
||||
|
||||
// Remove this listener from the element
|
||||
this.removeEvent("progress", arguments.callee);
|
||||
@ -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);
|
||||
},
|
||||
@ -293,12 +293,12 @@ _V_.Player = _V_.Component.extend({
|
||||
manualTimeUpdatesOn: function(){
|
||||
this.manualTimeUpdates = true;
|
||||
|
||||
this.addEvent("play", this.trackCurrentTime);
|
||||
this.addEvent("pause", this.stopTrackingCurrentTime);
|
||||
this.on("play", this.trackCurrentTime);
|
||||
this.on("pause", this.stopTrackingCurrentTime);
|
||||
// timeupdate is also called by .currentTime whenever current time is set
|
||||
|
||||
// Watch for native timeupdate event
|
||||
this.tech.addEvent("timeupdate", function(){
|
||||
this.tech.on("timeupdate", function(){
|
||||
|
||||
// Remove this listener from the element
|
||||
this.removeEvent("timeupdate", arguments.callee);
|
||||
@ -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"));
|
||||
@ -570,7 +570,7 @@ _V_.Player = _V_.Component.extend({
|
||||
if (requestFullScreen) {
|
||||
|
||||
// Trigger fullscreenchange event after change
|
||||
_V_.addEvent(document, requestFullScreen.eventName, this.proxy(function(){
|
||||
_V_.on(document, requestFullScreen.eventName, this.proxy(function(){
|
||||
this.isFullScreen = document[requestFullScreen.isFullScreen];
|
||||
|
||||
// If cancelling fullscreen, remove event listener.
|
||||
@ -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.
|
||||
@ -588,7 +588,7 @@ _V_.Player = _V_.Component.extend({
|
||||
this.pause();
|
||||
this.unloadTech();
|
||||
|
||||
_V_.addEvent(document, requestFullScreen.eventName, this.proxy(function(){
|
||||
_V_.on(document, requestFullScreen.eventName, this.proxy(function(){
|
||||
_V_.removeEvent(document, requestFullScreen.eventName, arguments.callee);
|
||||
this.loadTech(this.techName, { src: this.values.src });
|
||||
}));
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -626,7 +626,7 @@ _V_.Player = _V_.Component.extend({
|
||||
this.pause();
|
||||
this.unloadTech();
|
||||
|
||||
_V_.addEvent(document, requestFullScreen.eventName, this.proxy(function(){
|
||||
_V_.on(document, requestFullScreen.eventName, this.proxy(function(){
|
||||
_V_.removeEvent(document, requestFullScreen.eventName, arguments.callee);
|
||||
this.loadTech(this.techName, { src: this.values.src })
|
||||
}));
|
||||
@ -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;
|
||||
@ -657,7 +657,7 @@ _V_.Player = _V_.Component.extend({
|
||||
this.docOrigOverflow = document.documentElement.style.overflow;
|
||||
|
||||
// Add listener for esc key to exit fullscreen
|
||||
_V_.addEvent(document, "keydown", _V_.proxy(this, this.fullWindowOnEscKey));
|
||||
_V_.on(document, "keydown", _V_.proxy(this, this.fullWindowOnEscKey));
|
||||
|
||||
// Hide any scroll bars
|
||||
document.documentElement.style.overflow = 'hidden';
|
||||
@ -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){
|
||||
|
@ -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(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user