Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

Firefox needs mousemove events from Flash #37

Closed
heff opened this issue Aug 29, 2013 · 2 comments
Closed

Firefox needs mousemove events from Flash #37

heff opened this issue Aug 29, 2013 · 2 comments

Comments

@heff
Copy link
Member

heff commented Aug 29, 2013

(Discovered in videojs/video.js#691 and mentioned by bkelley in IRC #videojs)

With the latest control bar updates in video.js core (in master, not released yet) we moved to tracking mouse/touch events to determine when the controls should be visible. Other browsers emit mousemove events from swf element, but Firefox does not, meaning once the controls hide, they never show again.

bkelley has a partial fix but it causes flickering of the control bar (because of mouseouts bubbling from control elements) and this shouldn't work in fullscreen when you can't ever mouse out of the player area.

The real fix will be to bubble mouse move events from the swf to the JS layer. It can probably be implemented in the same way as the stageclick event in the following lines. However we'll need to make sure we're not doubling up the mouse events in browsers that do fire mousemoves for the swf element.

stage.addEventListener(MouseEvent.CLICK, onStageClick);

private function onStageClick(e:MouseEvent):void{

public static const ON_STAGE_CLICK:String = "stageclick";

@sangatpedas
Copy link

This is my solution, no flickering whatsoever and works fullscreen but it's not in the videojs code itself:
//solve the user-active / inactive bug with flash player
var isFirefox = typeof InstallTrigger !== 'undefined';

if (isFirefox) {
    var _player_canvas = document.getElementById("vidtag_flash_api");

    function mousMove () {
        player.reportUserActivity();
        document.getElementById("vidtag_flash_api").removeEventListener( 'mousemove', mousMove, true);
        setTimeout(function(){addlistener();}, 2000);
    }


    function addlistener() {
        document.getElementById("vidtag_flash_api").addEventListener( 'mousemove', mousMove, true);
    }
    addlistener();
}

heff added a commit to heff/video.js that referenced this issue Dec 17, 2013
…ideo-js-swf#37

Also fixed a bug introduced by videojs#898. First arg of setTimeout was `this`.
@heff
Copy link
Member Author

heff commented Dec 17, 2013

I was able to fix this (in all my testing at least) by manually bubbling the mousemove event. See videojs/video.js#899

I turns out Firefox was firing the mousemove events, but they just weren't bubbling up to the player div like in other browsers.

@heff heff closed this as completed Dec 17, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants