Skip to content

Commit 2a64fb5

Browse files
committed
Merge branch 'fix-userinactive'
2 parents d10f0bd + f74394f commit 2a64fb5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

videojs.hotkeys.js

+18
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@
7373
});
7474
}
7575

76+
player.on('userinactive', function() {
77+
var transitionTime, focusingPlayerTimeout, cancelFocusingPlayer;
78+
79+
transitionTime = 1000;
80+
81+
cancelFocusingPlayer = function(){
82+
clearTimeout(focusingPlayerTimeout);
83+
};
84+
85+
focusingPlayerTimeout = setTimeout(function(){
86+
player.off('useractive', cancelFocusingPlayer);
87+
pEl.focus();
88+
}, transitionTime);
89+
90+
player.one('useractive', cancelFocusingPlayer);
91+
92+
});
93+
7694
player.on('play', function() {
7795
// Fix allowing the YouTube plugin to have hotkey support.
7896
var ifblocker = pEl.querySelector('.iframeblocker');

0 commit comments

Comments
 (0)