Alpha Video Plays Early

Right now the alpha video is starting as soon as the experience finishes loading. I need it to start once the trainer image is triggered. Any help? I am not much of a coder.
Here is a snapshot of the show code:
const display_shown = symbol.controllers.display.elements.shown;
const display_hidden = symbol.controllers.display.elements.hidden;
var Zappar_1_mp4 = symbol.nodes.Zappar_1_mp4;

parent.on(“show”, parent_show);
function parent_show() {

// Make sure we start from fully hidden
display_hidden.reset();

// Move to the shown state
display_shown.activate();

// Start the video
Screen Shot 2021-12-17 at 4.29.40 PM

Zappar_1_mp4.start();

}

Hallo, you should use a -seen- script for the target… it’s easy… click on the target and find new script> Seen
regards
Luca

I appreciate the response. Any chance I could get more detail? Sorry - newbie here.

Also, how do I get the video to stop auto play once the experience loads?

Hallo, i think this should help

https://docs.zap.works/studio/tutorials/streaming-video-in-the-3d-view/

Luca

I got a response from Zappar support that helped. See below:

The reason your video starts playing as soon at the experience is loading is because your .start() code is in the ’show’ script/function. This means that whenever the experience is shown, we will carry out these specific behaviours.

To play the video when the target is seen, you can create a separate script. Simply right click on your target image and then left click on New > Script > Seen. This will create a new script for when your target image is seen (I’ve attached a diagram of this to the email). You can then write your behaviour in this new script.

1 Like

Hi everyone!

This resource may also be helpful when it comes to ‘On Seen’ and ‘On Not Seen’ events: https://docs.zap.works/studio/getting-started/image-tracking/#target-events

Have a great day!
Francesca :blush: