From 6e1606b5ecd7ece3aa69af75253cf44baab3ca89 Mon Sep 17 00:00:00 2001 From: deurstann <tristan.derouet@gmail.com> Date: Mon, 16 Nov 2020 16:55:25 +0100 Subject: [PATCH] Play button does now play/pause the video in admin interface --- common/lkt.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/common/lkt.js b/common/lkt.js index c62ac0d..87e4b3b 100644 --- a/common/lkt.js +++ b/common/lkt.js @@ -134,7 +134,25 @@ class LktClient { } static commandPlay() { - return LktClient.__execSimple('play'); + var status= LktClient.commandStatus(); + return status.then(LktClient.changePlayStatus,LktClient.errorStatus); + } + static changePlayStatus(status) + { + switch(status.state) + { + case "play": + return LktClient.__execSimple("pause 1"); + break; + case "pause": + return LktClient.__execSimple("pause 0"); + break; + case "stop": + return LktClient.__execSimple("play"); + break; + default: + logger.info("Unknown play state"+status.state); + } } static commandStop() { return LktClient.__execSimple('stop'); @@ -155,6 +173,10 @@ class LktClient { static commandQueueDelId(id) { return LktClient.__execSimple(`deleteid ${id}`); } + static errorStatus(error) + { + logger.error("Unable to access lektor status:" + error); + } } function __mpdToObject(string) { -- GitLab