Skip to main content

Widget actions

Play

To play a video in the current scena banner, use the following code:

window.scena = window.scena || [];
window.scena.push({ type: "play" });

Pause

Similarly, you can pause the video with the following code:

window.scena = window.scena || [];
window.scena.push({ type: "pause" });

Open

It might be useful to change widget content as reaction to click on page's element. To switch scene from JavaScript, pass key-id value:

window.scena = window.scena || [];
window.scena.push({ type: "open", "key-id": "aaaaabbbbbb" });

Reference specific widget

If you have multiple video banners on a page and want to execute actions on a specific one, use the following code:

window.scena = window.scena || [];
window.scena.push({ type: "play", element: document.querySelector("scena-ai-banner[key-id=aaaaabbbbb]") });

Replace key-id "aaaaabbbbb" value with the ID of the banner you want to target.