content/hifi-content/caitlyn/scratch/messagesTestSend.js
2022-02-13 22:19:19 +01:00

24 lines
No EOL
796 B
JavaScript

var messageRate = 1500; // broadcast 1.5s
var videoURL = "https://www.youtube.com/watch?v=672kLAGig7s";
var videoParameters = "?html5=1&autoplay=1&start=";
var videoStartTime = 0;
var videoLength = 5880; // Hardcoded for now to 5880 seconds for this video. TO DO: Get time from API
var videoCurrentTime = videoStartTime;
function sendMessage(){
print(videoURL+videoParameters+videoCurrentTime);
Messages.sendMessage('messageTest',videoURL+videoParameters+videoCurrentTime);
videoCurrentTime++;
if (videoCurrentTime>videoLength) videoCurrentTime = videoStartTime; // loop
}
function cleanup(){
Script.clearInterval(messageInterval);
}
var messageInterval = Script.setInterval(function(){
sendMessage();
},messageRate);
Script.scriptEnding.connect(cleanup);