Looping Videos in ZapWorks Studio


Hi ZapWorks Community,

Following on from George’s tutorial on playing videos in ZapWorks Studio, I have created a guide on how to loop videos in ZapWorks Studio. This does require a little bit of scripting, however, it’s super easy to set up following the steps below.

This guide will follow on from the Importing and Assigning a Video section of George’s tutorial.

  1. Right click on the Root node, select New -> Script -> Ready

  1. In the Root-ready script, drag the video node into the top of the script environment and select Insert Local Variable. Using the video name, call the start function in the ready event (this will set the video to autoplay on launch, if you want the video to start later in the experience, call the start function in a different event).

3.We now need to create an event for when the video ends. We can do this by using the snippet Forest_mp4.on("finished", videoFinished);. We can then create a function for when the video ends with function videoFinished().

  1. In the videoFinished function, we can add our videos restart function, in this instance it’s Forest_mp4.restart();. With this, once the videoFinished event is fired, the video will restart. Your video will now loop.

Preview / Publish your project.

Hope this helps! Let us know if there are any other quick from forum tutorials you want to see.