Starting the video at time x



Trying to get the video to start in a couple of seconds in the video. What am i doing wrong here?

videoplayer.on("video:playing", () => {

videoplayer.nodes.control.time(t: 9000); 


using this: and working based on this demo:


Hi there,

If you have a Z.Video object in your scene you can use the time(...) function to seek the video to the specified time.

The time function takes in the time you’d like to seek the video to (in milliseconds) as an argument so you should use .time(9000) instead.

Also, the .time() function is being called within the .on("playing") event handler, which is fired once the video is already playing.

Instead, you could set the time to seek the video to with the .time(...) function first, and then use the .start() function to play the video from the time specified.

Hope this helps.



Thanks Sebastian for taking the time to reply. Trying to learn here so that really helps :slight_smile: While the docs is really helpfull, i’m hoping to find some more coding examples here on the forum.

Because there’s not that many coding examples I’m having problems understanding how to use code to for example initiate things. I’m not new to coding (Python) and i learn best from reading other code examples. Is there any way to write it out in an example? For example, i don’t have a object. What i’ve found working easiest is just have the video loaded from a URL in a videoplayer symbol.

How would you use a object in a script, have the video loaded from a URL maybe in to a videoplayer and then have it start 9 seconds in?

And then, how can i initiate/start a video based on a button?

Thanks in advance!

edit example:

const videoplayer = symbol.nodes.videoplayer0;

const video = Z.Video("")

parent.on("pointerdown", (e) => {
	// Runs when pointerdown occurs on the parent node
	// The argument e contains useful info about this event:
	video.start(); // how do i know where this is positioned? can i make it invisible untill it starts?
	videoplayer.start(); // start funtion doesn't exist for a videoplayer symbol, right? 


Hi again,

The start() and time() functions can’t be called directly on the video player symbol, these are exported by the subsymbol which you can access from a parent symbol.

The method is described here, under the ‘Exported Functions’ section.

To create a button that holds this functionality you’ll need to create a pointerdown script and add the video player functions within the pointerdown event handler.

This docs article on creating a button in Studio should come in handy.

Hope this helps.

All the best,