Array of videos

Hello
I have actually two questions.

I am not all sure how to creat an array and especielly not an array with videos. Can anyone tell me how do i do that?

Then the next question is how do i create an array in an array? Maybe i can figure that out my self if somebody can help me with my first question.

Thanks
Jo

To create an array of videos, you need to create an array of ofVideoPlayer:

in testApp.h add:

  
ofVideoPlayer videoPlayers[10];  

to create an array of 10 videoPlayers, then to use them, in setup, update draw…

when you used:

  
videoPlayer.loadMovie(...)  
videoPlayer.draw()  
...  

change it to

  
videoPlayer[0].loadMovie(...)  
videoPlayer[0].draw()  
...  

of course you will need to substitute 0 with some variable to access all the videoPlayers like in:

  
  
for(int i=0;i<10;i++){  
    videoPlayer[i].draw();  
}  

also take a look at this post:

http://www.openframeworks.cc/forum/view-…-imensional

there’s a super good explanation about arrays in c++ by damian and also how to create an array of arrays, and why you should avoid it :slight_smile:

thanks i’ll have a look at it!

How I have to name the files? how I call them at the loadMovie? Can someone give me an example? Thanks!

You can try this

string diskPath = "path to the movie folder/";

	for(int i=0;i<10;i++){
          videoPlayer[i].loadMovie(diskPath + ofToString(i)+".mov");
     }

You will have to replace “path to the movie folder/” with the path to the folder of movies. You will ahve to name all the movies 0.mov 1.mov etc.