1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-15 01:34:23 +02:00

refactor: player.listenForUserActivity_() (#4719)

This commit is contained in:
Chuong
2017-11-16 23:24:32 +07:00
committed by Gary Katsevman
parent 95d7832b0e
commit c16fedf26d

View File

@ -2920,7 +2920,10 @@ class Player extends Component {
this.setInterval(function() {
// Check to see if mouse/touch activity has happened
if (this.userActivity_) {
if (!this.userActivity_) {
return;
}
// Reset the activity tracker
this.userActivity_ = false;
@ -2932,7 +2935,10 @@ class Player extends Component {
const timeout = this.options_.inactivityTimeout;
if (timeout > 0) {
if (timeout <= 0) {
return;
}
// In <timeout> milliseconds, if no more activity has occurred the
// user will be considered inactive
inactivityTimeout = this.setTimeout(function() {
@ -2943,8 +2949,7 @@ class Player extends Component {
this.userActive(false);
}
}, timeout);
}
}
}, 250);
}