How would I control the playing of several videos?

My apologies if this is already covered in the forum, I looked for a while and couldn’t see a similar question.

I have never used C++, but just installed OF with dev-c++ on a winxp PC. I’m trying to write a code to play videos based on the keyboard letter pressed, just to get used to the programming language. Does anyone have tips for getting started?

Thanks,
Nick

UPDATE:

I compiled a working code to play two videos whether the “a” or “s” key is pressed, and it pauses them when released. I used the loadmovie command, but the videos get choppy when both keys are released and pressed quickly. Would this be my coding or my ram? Also I tried to setTexture(false) when keyReleased, but after compiling no video showed up at all.

Hello everybody,

I want to do something like this too but I have a different problem. I’m new in C++ dev and I just installed OF 3.4.2.
I want to make a fullscreen interactive movie, using hundreds of short videos, but I don’t want any pause between each video, it has to be very fast. If the user don’t do anything, the movie continues normally.
If I preload all the videos in the start of the program, the ram is overflowed and of course it doesn’t work. So I wrote something like this, to try to preload the next video during the playing of the first one :

at start:

  
vid1.loadMovie("vid1.mov");  
vidTemp.loadMovie("vid2.mov");  
vid1.play();  

when keyPressed :

  
vid1=vidTemp;  
vid1.play();  
vidTemp.loadMovie("vid1.mov");  

when keyReleased :

  
vid1=vidTemp;  
vid1.play();  
vidTemp.loadMovie("vid2.mov");  

But then the program crashes :frowning: I’m sure that is because of the loading of vidTemp during the playing of vid1. But I don’t know how to fix this.
In any case, have someone a solution to play a lot of videos, without any latency between each video ?

Thank you very very much :smiley:

nabontra, maniaxm - can you post a zip with the movies and code?

nabontra - applying setusetexture = false would cause them not to update the texture, so you wont see anything. useful if you just want to play and get pixel values to manipulate but not draw, but not useful for what you are doing…

maniaxm - I think you are doing something wrong with the = operator, it doesn’t work to use it for ofMoviePlayer (you can’t copy via =) or for any other object in OF for example… Using “=” in c++ with objects just copies all of the member fields and honestly, we hadn’t planned for people to use it like that — there are plenty of things inside the movie player that can’t be copied over including texture IDs, quicktime handles, etc. I think you had better use a boolean variable and just switch between two movies, In the meantime, we will take a look at coding ofMoviePlayer to prevent you from doing this =, which is likely to cause some problems…

also, you can take a look at the discussions with number27 about playing lots of small movies at once, he wound up doing it w/ textures, and I’m sure he’d be happy to help you with a sample…

take care,
-z

zach-

Sorry I did not see your reply sooner. Thank you for the texture tip, its the little things I keep tripping up on.