aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/listeners.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2020-04-19 19:51:06 +1000
committerSam Potts <sam@potts.es>2020-04-19 19:51:06 +1000
commit9c7e429b48320f6b021baa2ed23e35a6bd9ceae5 (patch)
treee3eb0acf2ce3408bc404e2cc10cbe04a7545d21c /src/js/listeners.js
parent502d5977d79148957828cbf313b7ef4c9f31973f (diff)
downloadplyr-9c7e429b48320f6b021baa2ed23e35a6bd9ceae5.tar.lz
plyr-9c7e429b48320f6b021baa2ed23e35a6bd9ceae5.tar.xz
plyr-9c7e429b48320f6b021baa2ed23e35a6bd9ceae5.zip
Vimeo ratio fixes
Diffstat (limited to 'src/js/listeners.js')
-rw-r--r--src/js/listeners.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/js/listeners.js b/src/js/listeners.js
index e4c3c132..dd2c4834 100644
--- a/src/js/listeners.js
+++ b/src/js/listeners.js
@@ -229,16 +229,18 @@ class Listeners {
// Delay the adding of classname until the focus has changed
// This event fires before the focusin event
- this.focusTimer = setTimeout(() => {
- const focused = document.activeElement;
+ if (event.type !== 'focusout') {
+ this.focusTimer = setTimeout(() => {
+ const focused = document.activeElement;
- // Ignore if current focus element isn't inside the player
- if (!elements.container.contains(focused)) {
- return;
- }
+ // Ignore if current focus element isn't inside the player
+ if (!elements.container.contains(focused)) {
+ return;
+ }
- toggleClass(document.activeElement, player.config.classNames.tabFocus, true);
- }, 10);
+ toggleClass(document.activeElement, player.config.classNames.tabFocus, true);
+ }, 10);
+ }
}
// Global window & document listeners
@@ -257,7 +259,7 @@ class Listeners {
once.call(player, document.body, 'touchstart', this.firstTouch);
// Tab focus detection
- toggleListener.call(player, document.body, 'keydown focus blur', this.setTabFocus, toggle, false, true);
+ toggleListener.call(player, document.body, 'keydown focus blur focusout', this.setTabFocus, toggle, false, true);
}
// Container listeners
@@ -304,7 +306,7 @@ class Listeners {
// Set a gutter for Vimeo
const setGutter = (ratio, padding, toggle) => {
- if (!player.isVimeo) {
+ if (!player.isVimeo || player.config.vimeo.premium) {
return;
}
@@ -331,6 +333,7 @@ class Listeners {
const resized = () => {
clearTimeout(timers.resized);
+
timers.resized = setTimeout(setPlayerSize, 50);
};
@@ -354,7 +357,7 @@ class Listeners {
// Set Vimeo gutter
setGutter(ratio, padding, isEnter);
- // If not using native fullscreen, we need to check for resizes of viewport
+ // If not using the native browser fullscreen API, we need to check for resizes of viewport
if (!usingNative) {
if (isEnter) {
on.call(player, window, 'resize', resized);