Is it possible to play video after detect image?

Greeting,

This is my first few experiments with ZapWorks, and I testing with Video now.
But I noticed that the video already start playing after I start the WebAR.

Is it possible for the video only start playing after the user scanned the Image Target?

1 Like

I assume you already found your answer but leaving this here in case anyone drops by as well.

So in your script i assume there’s this:

parent.on("seen", () => {

 });

ignore that, you can even delete it or comment it out using /* code between this */

Drag your image target into the script and itll create a variable for you. Rename it to whatever u want or remain as is:

Target.one("seen", () => {
        Video1.start();
});

i renamed my image target as Target. There’s a controller named “seen”. So what this does is plays the video only when your image target is in view of the camera. The function “one” only triggers it once even if image lost and found again, you can use “on” like Target.on() and whatever you set the script to do when image found will trigger again (like a reset).

1 Like

Tried this, but the start function doesn’t seem to exist. See screenshot. FYI - I am streaming the video.

Since the video itself is within a subsymbol, you’ll have to call the node within the subsymbol.
Below is what the code should look like :slight_smile:

1 Like

Worked great - thanks Abiro!

1 Like