Start playing video at a specific time

How can I start playing a video at a certain time using gamma’s VideoPlayer?

There is seek time and seek, but how do I start the video at a certain time? I can seek as soon as the video starts playing, but that means there is a frame delay and you can see 1 frame of the start of the video.

I can’t seek as soon as I change the path, because you can only seek once the video has loaded.

Background: I have a list of videos that I want to play in a row, one after the other. I have a counter that GetSlices one of the paths. I create a random Seek time every time I change the videos.

The problem is that it takes an indeterminate amount of frames to load a video, can be anywhere from 1 to 9 frames for my videos.

I can seek as soon as play is back on using a TogEdge up edge and then seek, but that means there is a 1 frame delay and you can usually see 1 frame flash before it seeks to the desired point.

So my question: is there a way to start a video at a certain time?

Okay, I think it comes down to the fact that my random seek time is based on the duration of the video, which introduces a frame delay. I guess there is no other way than to find the duration of all videos beforehand, so I can create a random seek time before playing of the video even starts. Then I can set the loop start time to that random value until the video starts playing and then switch back to the original loop start value.

So the question becomes, is there a way to find out the duration of a video without actually loading it in the videoplayer?

Some Hacks to offer - use a second Player which doesn’t Play but read Data before the Other one - If you are using ImagePlayer count Files - Play a stored Image (LastBefore the jump or Alpha100%) as first frame - make a list before the App Starts (Like read all Files and save it in a XML)

Do you blend between 2players? hard jump from one File to another Video? …

Many Hacks out there - what is the UseCase?

Hope you got some inspiration ;-)

1 Like

Yes, I guess I will switch to a system where I have 2 videoplayers and fade between them. Then I can effectively pre-load the next video and create the random start time from the duration. Then I set the loop start time to the random time and switch back to the original loop time once it has started playing.

Or I guess I could get the durations when changing the folder of videos and scan them all once and get their durations that way.

I’ll probably go for the first approach as it allows for crossfading, which is probably better, even if its just for a few frames.

Thanks!

In case anyone comes across this in the future looking for a similar thing, here is my take at a 2 videoplayer solution so it crossfades between 2 players seemlessly and you can randomize the start position of each video. Seems to work well.

ABVideoPlayer.vl (82.5 KB)

2 Likes

Man, the VideoPlayer is so weird. It doesn’t have stop, so you just stop playing and then it pauses? If you change the loop start time it will go to that position, but only if the loop start time is higher than the current time!? If you want to set it lower while it is paused you have to now set the seek time and trigger seek. Why can’t it be one or the other - either we always have to seek to set a new time while paused or we just set a new loop start time. Having this conditional thing now means you have to build around that constantly.