videoPlayer.play() waits for one frame

I’m trying to develop a kinect controlled fashion show. One of the musts is having seamless transition between videos. ( Enterance to loop , loop to exit )

There seems after I change video there is an empty frame. ( one frame delay in another words ) If i play the videos on background and just setPosition to 0 when the changing occurs I don’t see that empty frame.

My update function contains a test which controls the state of the currentVideo and changes the players state.

  
  
  
ofVideoPlayer   *currentEnteranceVideo;  
ofVideoPlayer   *currentLoopVideo;  
ofVideoPlayer   *currentExitVideo;     
ofVideoPlayer   *currentVideo;  
  
  

UPDATE

  
  
  
    if(currentVideo->getIsMovieDone()){  
        switch (currentState) {  
            case Enterance:  
                ofLog()<<"enterance to loop";  
                currentVideo    = currentLoopVideo;  
                currentState    = Loop;  
                break;  
                  
            case Loop:  
                ofLog()<<"loop to exit";                  
                currentState    = Exit;  
                currentVideo    = currentExitVideo;  
                break;  
              
            default:  
                break;  
        }  
        currentVideo->play();  
        currentVideo->setLoopState(OF_LOOP_NONE);  
  
    }  
      
    currentVideo->idleMovie();  
  
  

DRAW

  
  
      
    ofSetHexColor(0xffffff);  
    currentVideo->draw(30, 30.0f, 668.0f, 1024.0f);  
  

I’m new to cpp so I’m not sure that this is a bug or I’m doing smt wrong. Thanks for your help.

I solved this issue with stopping drawing while changing the video.

Hi Etamina,

a (belated) welcome to the openFrameworks forum! glad you found us, this is the main place for getting support with using openFrameworks. there’s also an IRC channel #openframeworks on freenode, you can use a web interface to access it here http://en.irc2go.com/webchat/?net=freenode&room=openframeworks . it’s not always very full but you can try asking for help there also. and there’s documentation and tutorials on the website at http://openframeworks.cc although i guess you’ve found those already. and for programming problems not specific to openFrameworks but more about, how would i achieve this effect in code in general, you could try also asking your question in the Processing forums at http://forum.processing.org/ (Processing and openFrameworks are very similar so a solution that works in Processing can usually be adapted to work in openFrameworks) and StackOverflow at http://stackoverflow.com .

it seems like you solved your problem already, but here’s another method i would suggest in case anyone else has the same problem. have two video players running simultaneously, with some preroll/postroll on the videos you want to play. when it comes time to switch from one to the other start the second one playing then crossfade over a few frames, maybe 0.5-1 second. you can do this by using a float alpha that changes gradually from 0 to 1 over the duration, then use ofSetColor() to set the alpha for each video, ie

  
ofSetColor(ofColor::white, alpha*255);   
firstVideo.draw();  
ofSetColor(ofColor::white, (1.0f-alpha)*255);  
secondVideo.draw();  
  

hope this is helpful!
cheers
damian