Play from different positions of a Video?


At the moment I’m trying to figure out how to set loop-points within a recorded video, based on position.

Starting with the video recorder example I can record the video in, and using key input I can manually select the starting position of the video ( Using .setPosition(Pos[i]); ). This is working perfectly fine.

However… What I would like is a new (for now determined by ofRandom) starting point determined automatically when the section of the video reaches its end.

So I have something like…

  snap = true;

if (snap == true){
    select = ofRandom((int)0, 7);
    snap = false;
if (select == 0){
    if(recordedVideoPlayback.getPosition() >= Pos[1]){
        snap = true;

(I have this 8 times with each sequential number up from 0 to 7, where the final .getPosition is 0 - i.e if the playhead loops back to the start again).

Yet it crashes.

I’ve debugged it as far as I can by removing the random number and the boolean ‘snap’ that is used to call then .setPositions(); stripping it down to the follow:

if (recordedVideoPlayback.getPosition() >= 0.5){


Which should play the video halfway and then start from the beginning again… but it doesn’t (It only plays once and then hangs and crashes… ).

I don’t know why as it works perfectly fine to call .setPosition(0.5) when I use it in keyPressed();

Anyone able to help? Or offer advice?

Would be greatly appreciated…