Simple autoplay video script?


#1

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!


#2

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.


#3

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


#4

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.


#5

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”.