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) => {
|
add: (cmd) => {
|
||||||
// @TODO: DRY this out with the checks in vr
|
// @TODO: DRY this out with the checks in vr
|
||||||
let requestedVideoId = cmd.args[1] || false;
|
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
|
// resolve Promise with a timer of when the video will finish playback
|
||||||
// trigger user callback when the video finishes
|
// trigger user callback when the video finishes
|
||||||
resolve(setTimeout(() => {
|
let timer = setTimeout(() => {
|
||||||
this.websocket.setSceneItemProperties({"item": video.sceneItem, "visible": false});
|
this.websocket.setSceneItemProperties({"item": video.sceneItem, "visible": false});
|
||||||
if (typeof callback !== 'undefined') {
|
if (typeof callback !== 'undefined') {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}, parseInt(video.length*1000)))
|
}, parseInt(video.length*1000));
|
||||||
|
|
||||||
|
resolve(timer);
|
||||||
})
|
})
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
});
|
});
|
||||||
@@ -79,7 +81,7 @@ function GHOBS(config) {
|
|||||||
|
|
||||||
this.websocket.setCurrentScene({"scene-name": scene})
|
this.websocket.setCurrentScene({"scene-name": scene})
|
||||||
.then(() => this.playVideo(video, handleVideoEnd))
|
.then(() => this.playVideo(video, handleVideoEnd))
|
||||||
.then(timer => resolve)
|
.then(timer => { resolve(timer) })
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user