Skip to content
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

Inactivity check contains incorrect variable declaration leading to flickering behavior #2298

Closed
pavelhoral opened this issue Jul 1, 2015 · 2 comments

Comments

@pavelhoral
Copy link
Contributor

Inactivity check is not behaving correctly as it "flickers" between states multiple times when the player is about to go to inactive state. The reason for this is incorrect variable declaration of inactivityTimeout variable in player.js#1923:

let activityCheck = this.setInterval(function() {
  let inactivityTimeout;
  // ...
  this.clearTimeout(inactivityTimeout);
  // ...
  inactivityTimeout = this.setTimeout(...)

Variable inactivityTimeout must be declared outside of the inner function to work properly (otherwise the clearTimeout is simply no-op).

@pavelhoral
Copy link
Contributor Author

Demonstation of the incorrect behavior - http://jsbin.com/jipemubuhu/edit?js,output . Every inactivity timeout logs timeout occured in the browser console.

What to do: play video and move mouse in circles for 5 seconds
Expected output: see timeout occured once at the end of mouse movement
Observed incorrect output: timeout occured appears during the interaction and also after it ends

pavelhoral added a commit to orchitech/video.js that referenced this issue Jul 1, 2015
@heff
Copy link
Member

heff commented Jul 2, 2015

Ah! Thanks for figuring this out. It was proving difficult to debug. Looks like we missed this requirement in the move to let scoping.

@heff heff closed this as completed in 26a7862 Jul 2, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants