« get me outta code hell

fix setPause not working for MPV player - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-10-10 10:41:29 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-10-10 10:41:29 -0300
commit3fdb4b7961f55a6b0fa24a3f271c3c8090497856 (patch)
tree9bd39a593bd0af629787b9747c74fe9cabbb1bee
parent24ed3e0bf3542f8cf32ed03399dd455be4d5435f (diff)
fix setPause not working for MPV player
This fixes the "Paused" option in the menubar!
-rw-r--r--players.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/players.js b/players.js
index 77f1246..1d64061 100644
--- a/players.js
+++ b/players.js
@@ -255,8 +255,15 @@ module.exports.ControllableMPVPlayer = class extends module.exports.MPVPlayer {
   }
 
   setPause(val) {
+    const wasPaused = this.isPaused
     this.isPaused = !!val
-    this.sendCommand('set', 'pause', this.isPaused)
+
+    if (this.isPaused !== wasPaused) {
+      this.sendCommand('cycle', 'pause')
+    }
+
+    // For some reason "set pause" doesn't seem to be working anymore:
+    // this.sendCommand('set', 'pause', this.isPaused)
   }
 
   setLoop(val) {