From 8fc6c2ba526bf1ef8cdb9476f1644089281ce60d Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Fri, 21 Jun 2019 00:19:37 +1000 Subject: File rename and clean up --- src/js/controls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 43a92140..7afcd2c0 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -28,7 +28,7 @@ import { import { off, on } from './utils/events'; import i18n from './utils/i18n'; import is from './utils/is'; -import loadSprite from './utils/loadSprite'; +import loadSprite from './utils/load-sprite'; import { extend } from './utils/objects'; import { getPercentage, replaceAll, toCamelCase, toTitleCase } from './utils/strings'; import { formatTime, getHours } from './utils/time'; -- cgit v1.2.3 From b36b92b2478b5aac165be0d3d84cd1f011d4c8df Mon Sep 17 00:00:00 2001 From: nskazki Date: Fri, 19 Jul 2019 16:12:16 +0300 Subject: Detach event listeners on destroy if "on" receives "this", it attaches "eventListeners" array to "this" and stores "{ element, type, callback }" hash in there. later, during the destruction process, all the entries from this array will be processed by "unbindListeners" helper to detach all the event listeners. --- src/js/controls.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 7afcd2c0..b5b2d00a 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -402,7 +402,8 @@ const controls = { // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143 bindMenuItemShortcuts(menuItem, type) { // Navigate through menus via arrow keys and space - on( + on.call( + this, menuItem, 'keydown keyup', event => { @@ -452,7 +453,7 @@ const controls = { // Enter will fire a `click` event but we still need to manage focus // So we bind to keyup which fires after and set focus here - on(menuItem, 'keyup', event => { + on.call(this, menuItem, 'keyup', event => { if (event.which !== 13) { return; } @@ -1463,7 +1464,7 @@ const controls = { bindMenuItemShortcuts.call(this, menuItem, type); // Show menu on click - on(menuItem, 'click', () => { + on.call(this, menuItem, 'click', () => { showMenuPanel.call(this, type, false); }); @@ -1515,7 +1516,8 @@ const controls = { ); // Go back via keyboard - on( + on.call( + this, pane, 'keydown', event => { @@ -1535,7 +1537,7 @@ const controls = { ); // Go back via button click - on(backButton, 'click', () => { + on.call(this, backButton, 'click', () => { showMenuPanel.call(this, 'home', false); }); -- cgit v1.2.3 From 0b240ae7d1a0bece3609e3dc6d0eddf8d70ddc16 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Mon, 13 Jan 2020 16:20:02 +0000 Subject: Fix linting issues --- src/js/controls.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 7afcd2c0..aa5d7fba 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -139,10 +139,7 @@ const controls = { // Create hidden text label createLabel(key, attr = {}) { const text = i18n.get(key, this.config); - - const attributes = Object.assign({}, attr, { - class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' '), - }); + const attributes = { ...attr, class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' '),}; return createElement('span', attributes, text); }, -- cgit v1.2.3 From a2498acf7c1ea3d7e77fecc524a9130777ef9508 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Tue, 14 Jan 2020 07:44:59 +0000 Subject: Manually merge PR #1629 --- src/js/controls.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index a0bbc991..15c82716 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -139,7 +139,7 @@ const controls = { // Create hidden text label createLabel(key, attr = {}) { const text = i18n.get(key, this.config); - const attributes = { ...attr, class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' '),}; + const attributes = { ...attr, class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ') }; return createElement('span', attributes, text); }, @@ -1378,7 +1378,9 @@ const controls = { } // Volume range control - if (control === 'volume') { + // Ignored on iOS as it's handled globally + // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html + if (control === 'volume' && !browser.isIos) { // Set the attributes const attributes = { max: 1, -- cgit v1.2.3 From 299f712cc9363b1f8d26e4e049aabd9c25dcb9d7 Mon Sep 17 00:00:00 2001 From: ydylla Date: Wed, 29 Jan 2020 23:02:35 +0100 Subject: actually use the configured speed options --- src/js/controls.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 15c82716..33d5724b 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -1056,6 +1056,8 @@ const controls = { // Set the speed options if (is.array(options)) { this.options.speed = options; + } else if (is.array(this.config.speed.options)) { + this.options.speed = this.config.speed.options; } else if (this.isHTML5 || this.isVimeo) { this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]; } -- cgit v1.2.3 From c33f0995f97f3c332c2518b451437c2dfb2e7598 Mon Sep 17 00:00:00 2001 From: Code1110 Date: Fri, 7 Feb 2020 18:15:56 +0100 Subject: add download attribute to download button --- src/js/controls.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 15c82716..bfe1b61f 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -1580,6 +1580,7 @@ const controls = { element: 'a', href: this.download, target: '_blank', + download: '', }); const { download } = this.config.urls; -- cgit v1.2.3 From 90dc985657190f08e91686cdcf404a106c498511 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Sat, 8 Feb 2020 23:09:41 +0000 Subject: Clean up speed options logic --- src/js/controls.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 0b66d8f6..f93cb8a3 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -9,7 +9,7 @@ import captions from './captions'; import html5 from './html5'; import support from './support'; import { repaint, transitionEndEvent } from './utils/animation'; -import { dedupe } from './utils/arrays'; +import { dedupe, fillRange } from './utils/arrays'; import browser from './utils/browser'; import { createElement, @@ -1044,7 +1044,7 @@ const controls = { }, // Set a list of available captions languages - setSpeedMenu(options) { + setSpeedMenu() { // Menu required if (!is.element(this.elements.settings.panels.speed)) { return; @@ -1053,18 +1053,14 @@ const controls = { const type = 'speed'; const list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); - // Set the speed options - if (is.array(options)) { - this.options.speed = options; - } else if (is.array(this.config.speed.options)) { + // Determine options to display + // Vimeo and YouTube limit to 0.5x-2x + if (this.isVimeo || this.isYouTube) { + this.options.speed = fillRange(0.5, 2, 0.25).filter(s => this.config.speed.options.includes(s)); + } else { this.options.speed = this.config.speed.options; - } else if (this.isHTML5 || this.isVimeo) { - this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]; } - // Set options if passed and filter based on config - this.options.speed = this.options.speed.filter(speed => this.config.speed.options.includes(speed)); - // Toggle the pane and tab const toggle = !is.empty(this.options.speed) && this.options.speed.length > 1; controls.toggleMenuButton.call(this, type, toggle); -- cgit v1.2.3 From 74ba6a96fc5df9654766ac21593d5c8274d98fb2 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Sun, 9 Feb 2020 10:36:32 +0000 Subject: Set download attribute for HTML5 only --- src/js/controls.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index f93cb8a3..1cce51f6 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -1578,9 +1578,13 @@ const controls = { element: 'a', href: this.download, target: '_blank', - download: '', }); + // Set download attribute for HTML5 only + if (this.isHTML5) { + attributes.download = ''; + } + const { download } = this.config.urls; if (!is.url(download) && this.isEmbed) { -- cgit v1.2.3 From 1619510dcf9e3ccc1693caa20a173aaf2789e346 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Mon, 10 Feb 2020 18:34:05 +0000 Subject: Speed settings logic improvements --- src/js/controls.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 1cce51f6..66ec7139 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -9,7 +9,7 @@ import captions from './captions'; import html5 from './html5'; import support from './support'; import { repaint, transitionEndEvent } from './utils/animation'; -import { dedupe, fillRange } from './utils/arrays'; +import { dedupe } from './utils/arrays'; import browser from './utils/browser'; import { createElement, @@ -1053,13 +1053,8 @@ const controls = { const type = 'speed'; const list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); - // Determine options to display - // Vimeo and YouTube limit to 0.5x-2x - if (this.isVimeo || this.isYouTube) { - this.options.speed = fillRange(0.5, 2, 0.25).filter(s => this.config.speed.options.includes(s)); - } else { - this.options.speed = this.config.speed.options; - } + // Filter out invalid speeds + this.options.speed = this.options.speed.filter(o => o >= this.minimumSpeed && o <= this.maximumSpeed); // Toggle the pane and tab const toggle = !is.empty(this.options.speed) && this.options.speed.length > 1; -- cgit v1.2.3 From bc8a25d0da8720878fbb845b08e1f8170c3d24f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoi=CC=82t=20Burgener?= Date: Tue, 25 Feb 2020 10:46:31 +0100 Subject: Completely hide SVG icons to screen readers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVG icons should be ignored by screen readers since they have complimentary labels (aria-label or plyr__sr-only). The current « presentation » role simply makes the element behave like a « span » which is incorrect, aria-hidden prevents screen readers from taking care of these elements at all. --- src/js/controls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 66ec7139..37df497f 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -111,7 +111,7 @@ const controls = { setAttributes( icon, extend(attributes, { - role: 'presentation', + 'aria-hidden': 'true', focusable: 'false', }), ); -- cgit v1.2.3