VideoComponent load() - delay in getting info on video

#1

I can’t seem to get any info from the loaded video until some indeterminate time after the call to vid.load(). It seems like the calling function has to exit before the video has any info about it’s duration, size etc. Even adding a Thread::Sleep() didn’t help (yes, I know that’s naughty).

Is this deliberate or a known issue?
Is there some callback system I haven’t found?

This code never finds a valid duration:

Result rsltN = newVideo.load(testFile);

if (rsltN.wasOk() && newVideo.isVideoOpen()) {
    while(newVideo.getVideoDuration() <= 0.0){
        DBG("video duration is " << newVideo.getVideoDuration());
    }
}
0 Likes

#2

The VideoComponent needs the OS widget on the screen. Juce itself has no reading of video implemented, but it can query that OS widget, once it was created. So you can only get your information asyncronously.
It’s not the time, it’s a few more messages on the message queue that you have to wait for.

0 Likes

#3

I see.
I got it working using loadASync() with a lambda in the end… but a blocking load() would be nice to simplify things.

0 Likes