export async function createVideo(iframeId) {
Globals.ytPlayer[iframeId]["player"] = await YouTube.CreatePlayer(iframeId, {
"onStateChange": e => { Globals.ytPlayer[iframeId]["state"] = e.data; },
"onReady": e => {}
});
return true;
};
How do I use the state to change a global variable at an event sheet?
I want something like this, but I cant find the way to mix both examples:
const stateTextInst = runtime.objects.StateText.getFirstInstance();
const ytPlayer = await YouTube.CreatePlayer("youtubeIframe", {
"onStateChange": e =>
{
// When the player state changes, show it in the StateText object.
stateTextInst.text = "" + e.data;
}
});
Thanks for the links.