I was looking over the YouTube API example that explained how to use a button to start and pause a youtube video. In addition, the script displays the current state of the video in a text object. I tried adding several youtube videos to this example, but it seems that the script only run once, so only the first video works. I know absolutely nothing about JavaScript, so I am clueless on how to make the script repeat for other videos. I am adding something like the following for the iframe url(varSource &"?enablejsapi=1"&"&autoplay="&1) I have read through the documentary and I tried implementing the following code to the example, without any success:
runOnStartup(async runtime =>
{
runtime.addEventListener("tick", () => Tick(runtime));
});
function Tick(runtime)
{
// Code to run every tick.
// Note 'runtime' is passed.
}
This is the original script below