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
Player.mouseover/mouseout events handlers will fire multiple times if play button is clicked multiple times #173
Comments
Woah, good catch. On it. -heff On Apr 17, 2012, at 11:28 PM, schwarzenneger wrote:
|
I was trying a few things myself in the meantime. See if you find this patch useful:
|
Any reason something like this won't solve the problem? player.addEvent("play", this.proxy(function(){
this.fadeIn();
if (!player.hasAddedPlayEvents) {
this.player.addEvent("mouseover", this.proxy(this.fadeIn));
this.player.addEvent("mouseout", this.proxy(this.fadeOut));
player.hasAddedPlayEvents = true;
}
})); |
I just used the 'one' method, which binds a listener only once. |
In file video.js, version 3.2.0, line 753, you have this:
This is probably a code smell. Each time the player fires the play event (e.g. user clicking play button) an extra handler is attached to mouseover/mouseout events. I verified this by adding
console.log()
statements insidefadeIn()
andfadeOut()
. I clicked the play/pause button about, say, 8 times. After that, every time I hovered the mouse over and out of the video I noticed 8 log messages in console.Secondly, the above mentioned lines will cause the controls to appear and remain stuck on the screen if video is set to autoplay. To un-stick, mouse over-and-out of the player. This is annoying; I don't think everyone can figure out how to get rid of video controls.
On youtube for example, if controls are set to autohide they will do so automatically in a few seconds (see http://jsfiddle.net/FBeRn/1/). Depending on how you work around the first problem, you might be able to address this issue at the same time.
The text was updated successfully, but these errors were encountered: