-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed extra mousemove events on Windows caused by certain apps, not users #1068
Conversation
Some platforms produce frequent mousemove events whether or not the mouse has moved. This causes the UI to always be displayed since userActive_ is always `true`. By keeping track of the last mouse position and only firing if the new position is different, we can eleminate the event spam.
Thanks for the PR! Would you mind telling us a little more about when you see this happen (like what platforms specifically)? |
I got this in node-webkit on Windows 7 x64. I remember running across the same problem in Chrome a while back (not involving video.js) but didn't think much of it. There's an SO question where someone suggested it might be caused by applications attempting to prevent a power-saving state. |
Another thing that will help is using requestAnimationFrame rather than setTimeout/setInterval for getting useractivity. |
@gkatsev, requestAnimationFrame is IE10+, so I don't think we could use that? |
You'd want to use the polyfill which is basically |
Have you had a chance to test this in IE8? |
I'm a little cautious about this one for a few reasons:
It would be nice to get ahead of this issue if it's going to come up again, but I'm not yet convinced it will. @download13, would it be possible to set up an example case where others could see this happening? |
The platform was node-webkit on Windows 7 64bit. No parallels or any other virtualization layer. After more googling and testing, it turns out this is a bug that occurs when the task manager is open. Some other applications (iTunes and Windows Media Player) seem to cause it as well. For an example, go to the videojs home page in Chrome and put the player into fullscreen mode. The controls should disappear after a short time. Now open task manager (assuming you're on Windows, haven't tested this with a mac but you could try opening iTunes) and again fullscreen the video. The controls should remain visible. You can run this in the console to see the extra events:
From what I can tell, Firefox already filters out the extra events. Chrome and node-webkit fire the extra events. IE 11 does as well, but it doesn't seem to matter at the moment since fullscreen doesn't work there. |
I can confirm this happens with the task manager open. Windows Media Player didn't, but my VM has an audio issue so I wasn't able to see if something has to be playing. So I think pulling this in is fine then, but I'd still like to be able to track a Chrome bug so we know if/when we can remove this. Would you mind submitting a bug to the chrome tracker about this? |
Submitted to chrome tracker |
Awesome, thanks. Pulling in. |
Some platforms produce frequent mousemove events whether or not the mouse has moved. This causes the UI to always be displayed since userActive_ is always
true
. By keeping track of the last mouse position and only firing if the new position is different, we can eleminate the event spam.