automated commercials
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
"commercialSceneName": "commercial",
|
"commercialSceneName": "commercial",
|
||||||
"videoPollSize": 5,
|
"videoPollSize": 5,
|
||||||
"currentActivitySceneItemName": "now-showing-txt",
|
"currentActivitySceneItemName": "now-showing-txt",
|
||||||
"commercialInterval": 60,
|
"commercialInterval": 3600,
|
||||||
"vods": [
|
"vods": [
|
||||||
{
|
{
|
||||||
"id": "ot-seg-escape",
|
"id": "ot-seg-escape",
|
||||||
|
|||||||
40
fgfm.js
40
fgfm.js
@@ -154,31 +154,33 @@ const streamInit = (config, obs, twitch) => {
|
|||||||
// Show a "commercial break" if it's been long enough since the last one
|
// Show a "commercial break" if it's been long enough since the last one
|
||||||
let secondsSinceLastCommercial = (Date.now() - lastCommercialShownAt) / 1000;
|
let secondsSinceLastCommercial = (Date.now() - lastCommercialShownAt) / 1000;
|
||||||
console.log(`It has been ${secondsSinceLastCommercial} seconds since the last commercial`);
|
console.log(`It has been ${secondsSinceLastCommercial} seconds since the last commercial`);
|
||||||
/* if (secondsSinceLastCommercial >= config.commercialInterval) {
|
if (secondsSinceLastCommercial >= config.commercialInterval) {
|
||||||
console.log(`Showing commercial now...`);
|
console.log(`Showing commercial now...`);
|
||||||
// @TODO: Add a random chance here for it to be "everybody wow"
|
// @TODO: Add a random chance here for it to be "everybody wow"
|
||||||
let commercial = config.memes.sort(randSort)[0];
|
let commercial = config.memes.sort(randSort)[0];
|
||||||
obs.setCurrentScene({"scene-name": config.commercialSceneName})
|
obs.setCurrentScene({"scene-name": config.commercialSceneName})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
return playVideoInScene(commercial, config.commercialSceneName, () => {
|
return playVideoInScene(commercial, config.commercialSceneName, () => {
|
||||||
// hide video
|
// hide video
|
||||||
obs.setSceneItemProperties({"item": commercial.sceneItem, "scene-name": config.commercialSceneName, "visible": false})
|
obs.setSceneItemProperties({"item": commercial.sceneItem, "scene-name": config.commercialSceneName, "visible": false})
|
||||||
// unmute songrequest audio
|
// unmute songrequest audio
|
||||||
twitch.editorChat.say(to, '!volume 50');
|
twitch.editorChat.say(twitchChannel, '!volume 50');
|
||||||
// show next video in queue
|
// show next video in queue
|
||||||
lastCommercialShownAt = Date.now();
|
lastCommercialShownAt = Date.now();
|
||||||
nextVideo();
|
nextVideo();
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
.then(res => {
|
||||||
.then(res => {
|
// mute songrequest audio
|
||||||
// mute songrequest audio
|
twitch.editorChat.say(twitchChannel, '!volume 0');
|
||||||
twitch.editorChat.say(to, '!volume 0');
|
})
|
||||||
})
|
.catch(console.error);
|
||||||
.catch(console.error);
|
|
||||||
}*/
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Keep track of recently played videos
|
// Keep track of recently played videos
|
||||||
if (recentlyPlayed.length === 3) {
|
if (recentlyPlayed.length === 5) {
|
||||||
recentlyPlayed.shift();
|
recentlyPlayed.shift();
|
||||||
}
|
}
|
||||||
recentlyPlayed.push(currentVideo.id);
|
recentlyPlayed.push(currentVideo.id);
|
||||||
@@ -195,6 +197,8 @@ const streamInit = (config, obs, twitch) => {
|
|||||||
});
|
});
|
||||||
currentVideo = freshVods.sort(randSort).slice(0, 1).shift();
|
currentVideo = freshVods.sort(randSort).slice(0, 1).shift();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @TODO: if a commercial/meme is playing (manually triggered), wait until it's done
|
||||||
showVideo(currentVideo);
|
showVideo(currentVideo);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user