From 159d5a328c4ab5648bf441e81030282ab44f7f6d Mon Sep 17 00:00:00 2001 From: Chris Ham Date: Tue, 23 Oct 2018 11:52:26 -0700 Subject: [PATCH] fix timer resolution --- fgfm.js | 10 ++++++++++ lib/ghobs.js | 8 +++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/fgfm.js b/fgfm.js index 9dcdf54..0151f3b 100755 --- a/fgfm.js +++ b/fgfm.js @@ -156,6 +156,16 @@ const streamInit = (config, twitch) => { }, + showact: (cmd) => { + obs.showActivity().catch(console.error); + }, + + + hideact: (cmd) => { + obs.hideActivity().catch(console.error); + }, + + add: (cmd) => { // @TODO: DRY this out with the checks in vr let requestedVideoId = cmd.args[1] || false; diff --git a/lib/ghobs.js b/lib/ghobs.js index e5696d6..29b0ab8 100755 --- a/lib/ghobs.js +++ b/lib/ghobs.js @@ -52,12 +52,14 @@ function GHOBS(config) { // resolve Promise with a timer of when the video will finish playback // trigger user callback when the video finishes - resolve(setTimeout(() => { + let timer = setTimeout(() => { this.websocket.setSceneItemProperties({"item": video.sceneItem, "visible": false}); if (typeof callback !== 'undefined') { callback(); } - }, parseInt(video.length*1000))) + }, parseInt(video.length*1000)); + + resolve(timer); }) .catch(reject); }); @@ -79,7 +81,7 @@ function GHOBS(config) { this.websocket.setCurrentScene({"scene-name": scene}) .then(() => this.playVideo(video, handleVideoEnd)) - .then(timer => resolve) + .then(timer => { resolve(timer) }) .catch(reject); }); };