Never let the player get focus
Fruitsapje opened this issue · 3 comments
Hi there,
I have an issue where the player gets focus when alwaysCaptureHotkeys
is set to false
and autoplay is active. This means that the page will jump to the player on pageload if autoplay is active.
This happens because we handle autoplay in a different way in order to do certain detections before we 'autoplay' the video. In short this causes autoplay to be set to false when the player gets initialized, while still starting the video, and therefor it passes the following if statement
of the hotkeys code:
if (alwaysCaptureHotkeys || !player.autoplay()) {
player.one('play', function() {
pEl.focus(); // Fixes the .vjs-big-play-button handing focus back to body instead of the player
});
}
Is it possible to get an option created where we can set the player to never get focus? Something like neverAllowFocus
for example. which will ignore this whole if statement
if set to true
?
Thanks in advance
Can't do an option to never allow focus, but a skipInitialFocus
should be fine
if (alwaysCaptureHotkeys || !player.autoplay()) {
if (!skipInitialFocus) {
player.one('play', function() {
pEl.focus(); // Fixes the .vjs-big-play-button handing focus back to body instead of the player
});
}
}
That would be perfect for us as well!
The commit looks to fit our needs, thanks! Any estimate when you will release a new package?