From 1c17a67f398a1fe408bd53e7c69cfe84eab4d3ad Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Fri, 16 Jan 2015 12:05:21 -0800 Subject: [PATCH] Fixed issue where ManualTimeUpdatesOff was not de-registering events. closes #1793 --- CHANGELOG.md | 1 + src/js/media/media.js | 6 ++++-- test/unit/flash.js | 1 + test/unit/media.js | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd586ccc55..c7f3eca8b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ CHANGELOG * @Sxmanek added a Czech translation ([view](/~https://github.com/videojs/video.js/pull/1739)) * @jcaron23 added the vjs-scrubbing CSS class and prevented menus from showing while scrubbing ([view](/~https://github.com/videojs/video.js/pull/1741)) * @dmlap fixed URL parsing in IE9 ([view](/~https://github.com/videojs/video.js/pull/1765)) +* Fixed issue where ManualTimeUpdatesOff was not de-registering events ([view](/~https://github.com/videojs/video.js/pull/1793)) -------------------- diff --git a/src/js/media/media.js b/src/js/media/media.js index e75a8dbcda..80f4c18de2 100644 --- a/src/js/media/media.js +++ b/src/js/media/media.js @@ -215,10 +215,12 @@ vjs.MediaTechController.prototype.manualTimeUpdatesOn = function(){ }; vjs.MediaTechController.prototype.manualTimeUpdatesOff = function(){ + var player = this.player_; + this.manualTimeUpdates = false; this.stopTrackingCurrentTime(); - this.off('play', this.trackCurrentTime); - this.off('pause', this.stopTrackingCurrentTime); + this.off(player, 'play', this.trackCurrentTime); + this.off(player, 'pause', this.stopTrackingCurrentTime); }; vjs.MediaTechController.prototype.trackCurrentTime = function(){ diff --git a/test/unit/flash.js b/test/unit/flash.js index 24f5ea3e5d..9cd14a5b9b 100644 --- a/test/unit/flash.js +++ b/test/unit/flash.js @@ -105,6 +105,7 @@ test('dispose removes the object element even before ready fires', function() { tech = new vjs.Flash({ id: noop, on: noop, + off: noop, trigger: noop, options_: {} }, { diff --git a/test/unit/media.js b/test/unit/media.js index f217b22d79..04a7f20dc1 100644 --- a/test/unit/media.js +++ b/test/unit/media.js @@ -39,6 +39,7 @@ test('stops timeupdates if the tech produces them natively', function() { var timeupdates = 0, tech, playHandler, expected; tech = new videojs.MediaTechController({ id: this.noop, + off: this.noop, on: function(event, handler) { if (event === 'play') { playHandler = handler;