« get me outta code hell

basic command relay across socket clients - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/players.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2020-07-10 20:52:13 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-16 18:45:31 -0300
commite6698a135099348b62d295e904580f4341447958 (patch)
treee9422919b5b1af0643f7bc53d7145d109d6cbcf8 /players.js
parent90cad535c470fffa5c34c48737e44c1641416f0d (diff)
basic command relay across socket clients
Diffstat (limited to 'players.js')
-rw-r--r--players.js15
1 files changed, 5 insertions, 10 deletions
diff --git a/players.js b/players.js
index 959bf27..7b11a3b 100644
--- a/players.js
+++ b/players.js
@@ -255,20 +255,15 @@ export class ControllableMPVPlayer extends MPVPlayer {
   }
 
   setPause(val) {
-    const wasPaused = this.isPaused
-    this.isPaused = !!val
-
-    if (this.isPaused !== wasPaused) {
-      this.sendCommand('cycle', 'pause')
+    if (!!val !== this.isPaused) {
+      this.togglePause()
     }
-
-    // For some reason "set pause" doesn't seem to be working anymore:
-    // this.sendCommand('set', 'pause', this.isPaused)
   }
 
   setLoop(val) {
-    this.isLooping = !!val
-    this.sendCommand('set', 'loop', this.isLooping)
+    if (!!val !== this.isLooping) {
+      this.toggleLoop()
+    }
   }
 
   async kill() {