Load multiple videos in one videoplayer instance?

Im trying to change the video filename through some bool logic. I have some short videos that need to change depending on what my cv see’s.

I have tryed testing with this code thats running in update, after 10secs I want swap to the string leave.

can I load different videos within one instance of video player or do I need multiple instances?

//setup
// vidPlayer setup
    ofSetVerticalSync(true);
    ofSetFrameRate(60);
    vidPlayer.load(attract);
    vWidth = vidPlayer.getWidth();
    vHeight = vidPlayer.getHeight();
    vidPlayer.play();
    vidPlayer.setLoopState(OF_LOOP_NORMAL);

//update
 if (ofGetElapsedTimeMillis()%10000 == 0) {
         vidPlayer.load(leave);
    }

thanks

Hi,

can I load different videos within one instance of video player or do I need multiple instances?

Yes you can.
I think your problem is ofGetElapsedTimeMillis()%10000 == 0
There are very few chances that ofGetElapsedTimeMillis() is evaluated exactly 10000 ms after the program start. If ofGetElapsedTimeMillis() == 99999 or ofGetElapsedTimeMillis == 10001, the new video is not loaded.

1 Like

ok I will use a counter instead, thanks