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