Video stuck problem

Hello,

I am having problems with videos when I try to use different classes to read videos than testApp. I use a vector in a separate class called “ClipList” and I instantiate it this way:

ClipList::ClipList(int nb){
numberClips = nb;
for(int i = 0;i<nb;i++){
ofVideoPlayer video;
clips.push_back(video);
}
}

and then I simply load the movies the normal way:

void ClipList::loadClips(){
clips.at(0).loadMovie(“movies/wide-shot.m4v”);
clips.at(1).loadMovie(“movies/chords-hand.m4v”);
clips.at(2).loadMovie(“movies/pickin-hand.m4v”);
clips.at(3).loadMovie(“movies/TV-edit.m4v”);
for(int i = 1;i<4;i++){
clips.at(i).setVolume(0);
}
for(int i = 0;i<4;i++){
clips.at(i).play();
}
}

Unluckily, though there is no error in compilation, the program just get stuck here “class ofBaseDraws” and just never stops. I need to kill it then, as the window doesn’t show up. The App.cpp is quiet similar to the moviePlayerExample excepts that instead of loading and playing the movies, it calls my class ClipList.

I have tried hundreds of variables with arrays and such and it always got stuck here at some point. Can someone help me?

What you want to do is either create all the ofVideoPlayers as properties of the class in the class declaration, i.e.

  
class testApp : public ofBaseApp {  
 ofVideoPlayer p1;  
 // ...etc bunch of videos  
 vector<ofVideoPlayer> clips;  
}  

and then push those into the vector OR make the vector a vector of pointers to movie players and then allocate them with the new keyword:

  
vector<ofVideoPlayer*> clips;  

and then

  
ofVideoPlayer* p = new ofVideoPlayer();  
clips.push_back(p);  
// later on...  
clips.at(0)->loadMovie("movies/wide-shot.m4v");  

Hope that helps