Simple autoplay video script?

Hey all - just started using studio to work on a project that puts an alpha video on a business card. Got everything looking great except I just need the video to autoplay one time. Any easy way for a newbie?
MANY THANKS!

1 Like

Hello @andyzilker,

Try this:

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

    symbol.nodes.video.start();

});

This will make your video plays when the experience finish the loading screen.

If you want to your video plays only when the tracking image is recog. you should try this:

let isFirst:boolean = false;

Tracking_pngzpt.on("seen", ()=>{
    if(!isFirst){
        symbol.nodes.video.start();
        isFirst = true;
    }
});

This code will check if is the first time that the tracking is seen and then will play the video.

att, HigĂŁo.

1 Like

Thank you!!! so add this script to the video file itself? Do I need to add the name or anything to this script?

1 Like

Hello @andyzilker,

The first script you may put anywhere in your project. The second script needs the tracking to be working so I recomend you to insert it in the main script where your tracking is. About changes, yes. You have to change the name of what’s dif in your project. Like the tracking name, the video node’s name and etc.

I made then very generic just for your understanding.

att, HigĂŁo.

1 Like

OK - I would just need the 1st script. I might add that I have the video on a plane (to make it look like it’s coming up from the page) The video is named just “bookmark.mp4”.

1 Like

rigor - any chance you could further explain what is being replaced in the code? What did you put in that is generic. Any help is appreciated!

1 Like

Hi @keith_pace,

It looks like you may have solved this here:

Just thought I’d share in case this was helpful to anybody!

Have a great day! :blush:
Francesca