Fix display for current language on change
This commit is contained in:
parent
cda574e627
commit
fd77831303
2
demo/dist/demo.css
vendored
2
demo/dist/demo.css
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.css
vendored
2
dist/plyr.css
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.js
vendored
2
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.js.map
vendored
2
dist/plyr.js.map
vendored
File diff suppressed because one or more lines are too long
23
src/js/controls.js
vendored
23
src/js/controls.js
vendored
@ -542,12 +542,7 @@ const controls = {
|
|||||||
|
|
||||||
switch (setting) {
|
switch (setting) {
|
||||||
case 'captions':
|
case 'captions':
|
||||||
value = this.captions.language;
|
value = this.captions.enabled ? this.captions.language : '';
|
||||||
|
|
||||||
if (!this.captions.enabled) {
|
|
||||||
value = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -578,19 +573,19 @@ const controls = {
|
|||||||
list = pane && pane.querySelector('ul');
|
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
|
// Find the radio option
|
||||||
const target = list && list.querySelector(`input[value="${value}"]`);
|
const target = list && list.querySelector(`input[value="${value}"]`);
|
||||||
|
|
||||||
if (!utils.is.htmlElement(target)) {
|
if (utils.is.htmlElement(target)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check it
|
// Check it
|
||||||
target.checked = true;
|
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
|
// Set the looping options
|
||||||
|
@ -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
|
// Speed change
|
||||||
utils.on(this.media, 'ratechange', () => {
|
utils.on(this.media, 'ratechange', () => {
|
||||||
// Update UI
|
// Update UI
|
||||||
@ -302,16 +308,13 @@ const listeners = {
|
|||||||
|
|
||||||
// Caption language change
|
// Caption language change
|
||||||
utils.on(this.media, 'languagechange', () => {
|
utils.on(this.media, 'languagechange', () => {
|
||||||
|
// Update UI
|
||||||
|
controls.updateSetting.call(this, 'captions');
|
||||||
|
|
||||||
// Save to storage
|
// Save to storage
|
||||||
storage.set.call(this, { language: this.language });
|
storage.set.call(this, { language: this.language });
|
||||||
});
|
});
|
||||||
|
|
||||||
// Volume change
|
|
||||||
utils.on(this.media, 'volumechange', () => {
|
|
||||||
// Save to storage
|
|
||||||
storage.set.call(this, { volume: this.volume, muted: this.muted });
|
|
||||||
});
|
|
||||||
|
|
||||||
// Captions toggle
|
// Captions toggle
|
||||||
utils.on(this.media, 'captionsenabled captionsdisabled', () => {
|
utils.on(this.media, 'captionsenabled captionsdisabled', () => {
|
||||||
// Update UI
|
// Update UI
|
||||||
|
@ -275,8 +275,8 @@ const vimeo = {
|
|||||||
player.media.buffered = data.percent;
|
player.media.buffered = data.percent;
|
||||||
utils.dispatchEvent.call(player, player.media, 'progress');
|
utils.dispatchEvent.call(player, player.media, 'progress');
|
||||||
|
|
||||||
|
// Check all loaded
|
||||||
if (parseInt(data.percent, 10) === 1) {
|
if (parseInt(data.percent, 10) === 1) {
|
||||||
// Trigger event
|
|
||||||
utils.dispatchEvent.call(player, player.media, 'canplaythrough');
|
utils.dispatchEvent.call(player, player.media, 'canplaythrough');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
padding: @plyr-control-spacing;
|
padding: @plyr-control-spacing;
|
||||||
transform: translateY(-(@plyr-control-spacing * 4));
|
transform: translateY(-(@plyr-control-spacing * 4));
|
||||||
transition: transform 0.4s ease-in-out;
|
transition: transform 0.4s ease-in-out;
|
||||||
|
animation: plyr-fade-in 0.3s ease;
|
||||||
color: @plyr-captions-color;
|
color: @plyr-captions-color;
|
||||||
font-size: @plyr-font-size-captions-small;
|
font-size: @plyr-font-size-captions-small;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -19,3 +19,13 @@
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes plyr-fade-in {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user