« get me outta code hell

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:
Diffstat (limited to 'players.js')
-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 {