1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-03 00:57:02 +02:00

@heff enhanced the event listener API to allow for auto-cleanup of listeners on other componenets and elements. closes #1588

This commit is contained in:
Steve Heffernan
2014-10-28 11:16:56 -07:00
parent b8cc047a2e
commit 4b818d9ebf
18 changed files with 324 additions and 79 deletions

View File

@ -121,7 +121,7 @@ vjs.Html5.prototype.createEl = function(){
// Triggers removed using this.off when disposed
vjs.Html5.prototype.setupTriggers = function(){
for (var i = vjs.Html5.Events.length - 1; i >= 0; i--) {
vjs.on(this.el_, vjs.Html5.Events[i], vjs.bind(this, this.eventHandler));
this.on(vjs.Html5.Events[i], this.eventHandler);
}
};
@ -214,16 +214,16 @@ vjs.Html5.prototype.enterFullScreen = function(){
var video = this.el_;
if ('webkitDisplayingFullscreen' in video) {
this.one('webkitbeginfullscreen', vjs.bind(this, function(e) {
this.one('webkitbeginfullscreen', function() {
this.player_.isFullscreen(true);
this.one('webkitendfullscreen', vjs.bind(this, function(e) {
this.one('webkitendfullscreen', function() {
this.player_.isFullscreen(false);
this.player_.trigger('fullscreenchange');
}));
});
this.player_.trigger('fullscreenchange');
}));
});
}
if (video.paused && video.networkState <= video.HAVE_METADATA) {