Skip to content

Commit

Permalink
fix(UI): Fix weird behaviour when volume was 0, and we unmute (#8186)
Browse files Browse the repository at this point in the history
Fixes #8184
  • Loading branch information
avelad authored Feb 28, 2025
1 parent 5debddc commit 3ff0e28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 9 additions & 3 deletions ui/mute_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ shaka.ui.MuteButton = class extends shaka.ui.Element {
if (this.ad && this.ad.isLinear()) {
this.ad.setMuted(!this.ad.isMuted());
} else {
this.video.muted = !this.video.muted;
if (!this.video.muted && this.video.volume == 0) {
this.video.volume = 1;
} else {
this.video.muted = !this.video.muted;
}
}
});

Expand Down Expand Up @@ -117,7 +121,8 @@ shaka.ui.MuteButton = class extends shaka.ui.Element {
if (this.ad) {
label = this.ad.isMuted() ? LocIds.UNMUTE : LocIds.MUTE;
} else {
label = this.video.muted ? LocIds.UNMUTE : LocIds.MUTE;
label = (this.video.muted || this.video.volume == 0) ?
LocIds.UNMUTE : LocIds.MUTE;
}

this.button_.ariaLabel = this.localization.resolve(label);
Expand All @@ -133,7 +138,8 @@ shaka.ui.MuteButton = class extends shaka.ui.Element {
if (this.ad) {
icon = this.ad.isMuted() ? Icons.UNMUTE : Icons.MUTE;
} else {
icon = this.video.muted ? Icons.UNMUTE : Icons.MUTE;
icon = (this.video.muted || this.video.volume == 0) ?
Icons.UNMUTE : Icons.MUTE;
}
this.icon_.textContent = icon;
}
Expand Down
5 changes: 0 additions & 5 deletions ui/volume_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
this.ad.setVolume(this.getValue() / 100);
} else {
this.video.volume = this.getValue() / 100;
if (this.video.volume == 0) {
this.video.muted = true;
} else {
this.video.muted = false;
}
}
}

Expand Down

0 comments on commit 3ff0e28

Please sign in to comment.