diff options
Diffstat (limited to 'players.js')
-rw-r--r-- | players.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/players.js b/players.js index 2f7a574..0c296b3 100644 --- a/players.js +++ b/players.js @@ -141,12 +141,17 @@ module.exports.ControllableMPVPlayer = class extends module.exports.MPVPlayer { } volUp(amount) { - this.volume = Math.min(100, this.volume + amount) - this.sendCommand(`set volume ${this.volume}`) + this.setVolume(this.volume + amount) } volDown(amount) { - this.volume = Math.max(0, this.volume - amount) + this.setVolume(this.volume - amount) + } + + setVolume(value) { + this.volume = value + this.volume = Math.max(0, this.volume) + this.volume = Math.min(100, this.volume) this.sendCommand(`set volume ${this.volume}`) } |