fix timer resolution
This commit is contained in:
10
fgfm.js
10
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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user