aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js')
-rw-r--r--src/js/controls.js25
-rw-r--r--src/js/listeners.js15
-rw-r--r--src/js/plugins/vimeo.js2
3 files changed, 20 insertions, 22 deletions
diff --git a/src/js/controls.js b/src/js/controls.js
index 503aecb8..7b1eada6 100644
--- a/src/js/controls.js
+++ b/src/js/controls.js
@@ -542,12 +542,7 @@ const controls = {
switch (setting) {
case 'captions':
- value = this.captions.language;
-
- if (!this.captions.enabled) {
- value = '';
- }
-
+ value = this.captions.enabled ? this.captions.language : '';
break;
default:
@@ -578,19 +573,19 @@ const controls = {
list = pane && pane.querySelector('ul');
}
+ // Update the label
+ if (!utils.is.empty(value)) {
+ const label = this.elements.settings.tabs[setting].querySelector(`.${this.config.classNames.menu.value}`);
+ label.innerHTML = controls.getLabel.call(this, setting, value);
+ }
+
// Find the radio option
const target = list && list.querySelector(`input[value="${value}"]`);
- if (!utils.is.htmlElement(target)) {
- return;
+ if (utils.is.htmlElement(target)) {
+ // Check it
+ target.checked = true;
}
-
- // Check it
- target.checked = true;
-
- // Find the label
- const label = this.elements.settings.tabs[setting].querySelector(`.${this.config.classNames.menu.value}`);
- label.innerHTML = controls.getLabel.call(this, setting, value);
},
// Set the looping options
diff --git a/src/js/listeners.js b/src/js/listeners.js
index 7f64375c..186dd70d 100644
--- a/src/js/listeners.js
+++ b/src/js/listeners.js
@@ -282,6 +282,12 @@ const listeners = {
);
}
+ // Volume change
+ utils.on(this.media, 'volumechange', () => {
+ // Save to storage
+ storage.set.call(this, { volume: this.volume, muted: this.muted });
+ });
+
// Speed change
utils.on(this.media, 'ratechange', () => {
// Update UI
@@ -302,14 +308,11 @@ const listeners = {
// Caption language change
utils.on(this.media, 'languagechange', () => {
- // Save to storage
- storage.set.call(this, { language: this.language });
- });
+ // Update UI
+ controls.updateSetting.call(this, 'captions');
- // Volume change
- utils.on(this.media, 'volumechange', () => {
// Save to storage
- storage.set.call(this, { volume: this.volume, muted: this.muted });
+ storage.set.call(this, { language: this.language });
});
// Captions toggle
diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js
index 21d34beb..4ac2ce99 100644
--- a/src/js/plugins/vimeo.js
+++ b/src/js/plugins/vimeo.js
@@ -275,8 +275,8 @@ const vimeo = {
player.media.buffered = data.percent;
utils.dispatchEvent.call(player, player.media, 'progress');
+ // Check all loaded
if (parseInt(data.percent, 10) === 1) {
- // Trigger event
utils.dispatchEvent.call(player, player.media, 'canplaythrough');
}
});