diff options
author | Sam Potts <sam@potts.es> | 2018-08-02 00:47:57 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-02 00:47:57 +1000 |
commit | 18b4d26bee07e1d1079e39ded8a30eaed8b02ff9 (patch) | |
tree | 8456332396352cce0afa3f9f598d2ffb11fdc0f6 /src/js/plyr.js | |
parent | fa0861ff2e9b22e361ada7b1fb9ff45c0378464e (diff) | |
parent | 7f4b74e2d43ed95a695f760f48e5b8e0792f9528 (diff) | |
download | plyr-18b4d26bee07e1d1079e39ded8a30eaed8b02ff9.tar.lz plyr-18b4d26bee07e1d1079e39ded8a30eaed8b02ff9.tar.xz plyr-18b4d26bee07e1d1079e39ded8a30eaed8b02ff9.zip |
Merge pull request #1142 from sampotts/a11y-improvements
A11y improvements
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r-- | src/js/plyr.js | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js index 65b6c94d..b99df2ff 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -75,16 +75,17 @@ class Plyr { // Elements cache this.elements = { container: null, + captions: null, buttons: {}, display: {}, progress: {}, inputs: {}, settings: { + popup: null, menu: null, - panes: {}, - tabs: {}, + panels: {}, + buttons: {}, }, - captions: null, }; // Captions @@ -185,7 +186,7 @@ class Plyr { // YouTube requires the playsinline in the URL if (this.isYouTube) { this.config.playsinline = truthy.includes(url.searchParams.get('playsinline')); - this.config.hl = url.searchParams.get('hl'); + this.config.hl = url.searchParams.get('hl'); // TODO: Should this be setting language? } else { this.config.playsinline = true; } @@ -221,7 +222,7 @@ class Plyr { if (this.media.hasAttribute('autoplay')) { this.config.autoplay = true; } - if (this.media.hasAttribute('playsinline')) { + if (this.media.hasAttribute('playsinline') || this.media.hasAttribute('webkit-playsinline')) { this.config.playsinline = true; } if (this.media.hasAttribute('muted')) { @@ -293,7 +294,9 @@ class Plyr { this.fullscreen = new Fullscreen(this); // Setup ads if provided - this.ads = new Ads(this); + if (this.config.ads.enabled) { + this.ads = new Ads(this); + } // Autoplay if required if (this.config.autoplay) { @@ -696,7 +699,9 @@ class Plyr { } // Trigger request event - triggerEvent.call(this, this.media, 'qualityrequested', false, { quality }); + triggerEvent.call(this, this.media, 'qualityrequested', false, { + quality, + }); // Update config config.selected = quality; @@ -933,13 +938,16 @@ class Plyr { if (hiding && this.config.controls.includes('settings') && !is.empty(this.config.settings)) { controls.toggleMenu.call(this, false); } + // Trigger event on change if (hiding !== isHidden) { const eventName = hiding ? 'controlshidden' : 'controlsshown'; triggerEvent.call(this, this.media, eventName); } + return !hiding; } + return false; } |