YouTube volume fix

This commit is contained in:
Sam Potts
2017-11-05 18:40:41 +11:00
parent 4d417d0396
commit 60084a17f8
9 changed files with 63 additions and 69 deletions

View File

@ -7,7 +7,6 @@ import captions from './captions';
import controls from './controls';
import fullscreen from './fullscreen';
import listeners from './listeners';
import storage from './storage';
const ui = {
addStyleHook() {
@ -72,7 +71,6 @@ const ui = {
// Set volume
this.volume = null;
ui.updateVolume.call(this);
// Set playback speed
this.speed = null;
@ -169,19 +167,19 @@ const ui = {
updateVolume() {
// Update the <input type="range"> if present
if (this.supported.ui) {
const value = this.media.muted ? 0 : this.media.volume;
const value = this.muted ? 0 : this.volume;
if (this.elements.inputs.volume) {
if (utils.is.htmlElement(this.elements.inputs.volume)) {
ui.setRange.call(this, this.elements.inputs.volume, value);
}
}
// Toggle class if muted
utils.toggleClass(this.elements.container, this.config.classNames.muted, this.media.muted);
utils.toggleClass(this.elements.container, this.config.classNames.muted, this.muted);
// Update checkbox for mute state
if (this.supported.ui && this.elements.buttons.mute) {
utils.toggleState(this.elements.buttons.mute, this.media.muted);
if (this.supported.ui && utils.is.htmlElement(this.elements.buttons.mute)) {
utils.toggleState(this.elements.buttons.mute, this.muted);
}
},