Video Time Event


#1

I’m trying to trigger an event at time X during video playback. I have this event handler generated.

symbol.nodes.MyVideo.on("time", () => {
    // Runs when time occurs on the A R Graduation.mp4 node
    if (time >= 5000) 
    {
    // do something
   }
});

This link,
https://docs.zap.works/studio/scripting/reference/video/events/time/, says " When the time event is fired, attached handler functions are called with a single argument, the current seek position in milliseconds."

So what’s the name of the argument so I can use in my event handler?


#2

Hi @eric1,

Could you give this a try -

symbol.nodes.MyVideo.on("time", (e) => {
    // Runs when time occurs on the A R Graduation.mp4 node
    if (e >= 5000) 
    {
    // do something
   }
});

The parameter of this event is the current seek position in milliseconds. If you notice, ‘e’ is passed as the parameter, therefor e is the current seek position in milliseconds. It doesn’t have to be e , you can name it anything you want just like all other function/event parameters.

Hope this helps.

George


#3

Thanks George. It’s working and I feel like that is something I should have known. I believe I was adding an extra “, (e)”.