« get me outta code hell

Seek, pause - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-12-22 14:06:22 -0400
committerFlorrie <towerofnix@gmail.com>2018-12-22 14:06:22 -0400
commit8d8747e57a3c4c235160002b1e32c71023823786 (patch)
tree98a773a1cfbbaab1c8a3907278c7fab943ee3935
parent6fd767ec7aa32adab4143a4057f58a71d6205c6f (diff)
Seek, pause
-rw-r--r--players.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/players.js b/players.js
index cc20667..7810cde 100644
--- a/players.js
+++ b/players.js
@@ -90,6 +90,22 @@ module.exports.WebPlayer = class extends Player {
       this.audioEl.addEventListener('ended', handleEnded)
     })
   }
+
+  seekAhead(secs) {
+    this.audioEl.currentTime += secs
+  }
+
+  seekBack(secs) {
+    this.audioEl.currentTime -= secs
+  }
+
+  togglePause() {
+    if (this.audioEl.paused) {
+      this.audioEl.play()
+    } else {
+      this.audioEl.pause()
+    }
+  }
 }
 
 module.exports.MPVPlayer = class extends Player {