diff options
author | Florrie <towerofnix@gmail.com> | 2019-05-28 18:56:05 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-05-28 18:56:05 -0300 |
commit | 6f84b15e76591c4519927966c6fbcafd074ead8f (patch) | |
tree | 1b79e193ce5c2cbe72918d13ec18de6277c1e772 | |
parent | 5698c5fd74951c14603e2e5b4ec51a32467c99f1 (diff) |
Support isPaused, setPause/setLoop functions
-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() |