From 6f84b15e76591c4519927966c6fbcafd074ead8f Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 28 May 2019 18:56:05 -0300 Subject: Support isPaused, setPause/setLoop functions --- players.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'players.js') 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() -- cgit 1.3.0-6-gf8a5