Skip to content

Commit

Permalink
Merge pull request #493 from Maxr1998/volume-up-fix
Browse files Browse the repository at this point in the history
Ensure that volume is always a Number
  • Loading branch information
iwalton3 authored Sep 17, 2023
2 parents 5391553 + 835de07 commit 2d138a2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions native/mpvVideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,12 +722,15 @@
}

setVolume(val, save = true) {
this._volume = val;
if (save) {
this.saveVolume((val || 100) / 100);
this.events.trigger(this, 'volumechange');
val = Number(val);
if (!isNaN(val)) {
this._volume = val;
if (save) {
this.saveVolume(val / 100);
this.events.trigger(this, 'volumechange');
}
window.api.player.setVolume(val);
}
window.api.player.setVolume(val);
}

getVolume() {
Expand Down

0 comments on commit 2d138a2

Please sign in to comment.