From d33573f2d643fdb89862ee9e9f0f6ab7b38835f5 Mon Sep 17 00:00:00 2001 From: Steve Heffernan Date: Mon, 16 Dec 2013 16:54:47 -0800 Subject: [PATCH 1/3] Bubbling mousemove events from the swf to the parent. fixes videojs/video-js-swf#37 Also fixed a bug introduced by #898. First arg of setTimeout was `this`. --- src/js/media/flash.js | 6 ++++++ src/js/player.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/media/flash.js b/src/js/media/flash.js index 95780d63e2..3ae6b2542d 100644 --- a/src/js/media/flash.js +++ b/src/js/media/flash.js @@ -88,6 +88,12 @@ vjs.Flash = vjs.MediaTechController.extend({ }); } + this.ready(function(){ + vjs.on(this.el(), 'mousemove', vjs.bind(this, function(){ + this.player().trigger('mousemove'); + })); + }); + // Flash iFrame Mode // In web browsers there are multiple instances where changing the parent element or visibility of a plugin causes the plugin to reload. // - Firefox just about always. https://bugzilla.mozilla.org/show_bug.cgi?id=90268 (might be fixed by version 13) diff --git a/src/js/player.js b/src/js/player.js index be7f560655..636e8797bb 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -1297,7 +1297,7 @@ vjs.Player.prototype.listenForUserActivity = function(){ // Setting userActivity=true now and setting the interval to the same time // as the activityCheck interval (250) should ensure we never miss the // next activityCheck - mouseInProgress = setInterval(this, onMouseActivity, 250); + mouseInProgress = setInterval(onMouseActivity, 250); }; onMouseUp = function(event) { From c6a9ef37a53554914ba2afbe8a1e8dc151c19b37 Mon Sep 17 00:00:00 2001 From: Steve Heffernan Date: Mon, 16 Dec 2013 17:02:25 -0800 Subject: [PATCH 2/3] Added comment --- src/js/media/flash.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/media/flash.js b/src/js/media/flash.js index 3ae6b2542d..11fdcb85c1 100644 --- a/src/js/media/flash.js +++ b/src/js/media/flash.js @@ -88,6 +88,7 @@ vjs.Flash = vjs.MediaTechController.extend({ }); } + // firefox doesn't bubble mousemove events to parent. videojs/video-js-swf#37 this.ready(function(){ vjs.on(this.el(), 'mousemove', vjs.bind(this, function(){ this.player().trigger('mousemove'); From fde1740523eece57a57747343c2c932197c70786 Mon Sep 17 00:00:00 2001 From: Steve Heffernan Date: Wed, 18 Dec 2013 17:23:56 -0800 Subject: [PATCH 3/3] Added firefox check to not impact other browsers. Also added link to bugzilla bug for tracking the status of this issue. --- src/js/media/flash.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/js/media/flash.js b/src/js/media/flash.js index 11fdcb85c1..126bdb6fe3 100644 --- a/src/js/media/flash.js +++ b/src/js/media/flash.js @@ -89,11 +89,15 @@ vjs.Flash = vjs.MediaTechController.extend({ } // firefox doesn't bubble mousemove events to parent. videojs/video-js-swf#37 - this.ready(function(){ - vjs.on(this.el(), 'mousemove', vjs.bind(this, function(){ - this.player().trigger('mousemove'); - })); - }); + // bugzilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=836786 + if (vjs.IS_FIREFOX) { + this.ready(function(){ + vjs.on(this.el(), 'mousemove', vjs.bind(this, function(){ + // since it's a custom event, don't bubble higher than the player + this.player().trigger({ 'type':'mousemove', 'bubbles': false }); + })); + }); + } // Flash iFrame Mode // In web browsers there are multiple instances where changing the parent element or visibility of a plugin causes the plugin to reload.