We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
playing 2 videos (Read 474 times)
playing 2 videos
Sep 28th, 2008, 4:30am
 
hi! help please why when i press the second key for the second video to play, it just have finished?
it seems that they where played at the same time, i mean they start and end at the same time even if the second isn`t "on"

the code


import processing.video.*;
Movie myMovie;
Movie myMovie2;

void setup() {
 size(200, 200);
 myMovie = new Movie(this, "station.mov");
 
 myMovie2 = new Movie(this, "station2.mov");
;
 
}
void draw (){
 image(myMovie, 0, 0);
 image(myMovie2, 10, 20);
}

void keyPressed() {
 if (key == 's'){
   myMovie.play();
 
 }
  if (key == 'd'){
   myMovie2.play();
 
 }

}

void movieEvent(Movie m) {
 m.read();
 

}
Re: playing 2 videos
Reply #1 - Oct 21st, 2008, 1:28pm
 
import processing.video.*;
Movie myMovie;
Movie myMovie2;

void setup() {
 size(200, 200);
 myMovie = new Movie(this, "station.mov");
 myMovie2 = new Movie(this, "station2.mov");
}
void draw (){
   if (key == 's'){
   myMovie.play();
 } else {
   myMovie.stop();
 }
  if (key == 'd'){
   myMovie2.play();
 } else {
   myMovie2.stop();
 }
 
 image(myMovie, 0, 0);
 image(myMovie2, 10, 20);
 
//Testing to see if they play at the same time.
println("Movie 1: " + myMovie.time());
println("Movie 2: " + myMovie2.time());
}

void movieEvent(Movie m) {
 m.read();
 

}


Hey, I had the exact same problem as you and I have no clue why it ignores the syntax that tells it only do action if catalyst is enabled, but, regardless, I found an else statement that stops or pause it fixes the problem, only problem is that it has to be in the draw function because -- well I don't know why it has to be in the draw function.

But it works, so good luck.
Page Index Toggle Pages: 1