diff options
-rw-r--r-- | players.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/players.js b/players.js index 0c980e7..98fff09 100644 --- a/players.js +++ b/players.js @@ -36,6 +36,8 @@ class Player extends EventEmitter { volDown(amount) {} togglePause() {} toggleLoop() {} + setPause() {} + setLoop() {} async kill() { if (this.process) { @@ -147,6 +149,7 @@ module.exports.ControllableMPVPlayer = class extends module.exports.MPVPlayer { } togglePause() { + this.isPaused = !this.isPaused this.sendCommand('cycle pause') } @@ -155,6 +158,16 @@ module.exports.ControllableMPVPlayer = class extends module.exports.MPVPlayer { this.sendCommand('cycle loop') } + setPause(val) { + this.isPaused = !!val + this.sendCommand('set pause ' + (val ? 'yes' : 'no')) + } + + setLoop(val) { + this.isLooping = !!val + this.sendCommand('set loop ' + (val ? 'yes' : 'no')) + } + kill() { if (this.fifo) { this.fifo.close() |