here is my code to play the three videos at a same but they all play in a single frame , one behind the other........
import processing.video.*;
import processing.serial.*;
Serial port;
Movie myMovie;
Movie yourMovie;
Movie ourMovie;
int state = 31;
int play1 = 1;
int play2 = 1;
int play3 = 1;
int play2 = 1;
int play3 = 1;
int val1 = 0;
int val2 = 0;
int val3 = 0;
int val2 = 0;
int val3 = 0;
void setup() {
size(620,440,P2D);
background(0);
myMovie = new Movie(this, "looper.mov");
yourMovie = new Movie(this, "totoro.mov");
ourMovie = new Movie(this, "animal_007-0-0.mov");
myMovie.loop();
yourMovie.loop();
ourMovie.loop();
println(Serial.list());
// print a list of all available ports
port = new Serial(this, Serial.list()[1], 9600);
// choose the port to which the Arduino is connected
// on the PC this is usually COM1, on the Macintosh
// this is usually tty.usbserial-XXX
}
myMovie.loop();
yourMovie.loop();
ourMovie.loop();
println(Serial.list());
// print a list of all available ports
port = new Serial(this, Serial.list()[1], 9600);
// choose the port to which the Arduino is connected
// on the PC this is usually COM1, on the Macintosh
// this is usually tty.usbserial-XXX
}
void draw() {
background(255);
if (play1 < port.available()) {
val1 = port.read();
}
image(myMovie, 0, 0);
if (val1 == 0) {
myMovie.speed(0);
} else {
myMovie.speed(1);
}
if (play2 < port.available()) {
val2 = port.read();
}
image(yourMovie, 0, 0);
if (val2 == 0) {
yourMovie.speed(0);
} else {
yourMovie.speed(1);
}
if (play3 < port.available()) {
val3 = port.read();
}
image(ourMovie, 0, 0);
if (val3 == 0) {
ourMovie.speed(0);
} else {
ourMovie.speed(1);
}
/*
play1 = state & 1;
play2 = (state & 2) >> 1;
play3 = (state & 4) >> 2;
*/
// print(play1);
//print(play2);
// print(play3);
}
background(255);
if (play1 < port.available()) {
val1 = port.read();
}
image(myMovie, 0, 0);
if (val1 == 0) {
myMovie.speed(0);
} else {
myMovie.speed(1);
}
if (play2 < port.available()) {
val2 = port.read();
}
image(yourMovie, 0, 0);
if (val2 == 0) {
yourMovie.speed(0);
} else {
yourMovie.speed(1);
}
if (play3 < port.available()) {
val3 = port.read();
}
image(ourMovie, 0, 0);
if (val3 == 0) {
ourMovie.speed(0);
} else {
ourMovie.speed(1);
}
/*
play1 = state & 1;
play2 = (state & 2) >> 1;
play3 = (state & 4) >> 2;
*/
// print(play1);
//print(play2);
// print(play3);
}
// Called every time a new frame is available to read
void movieEvent(Movie m) {
if(m == myMovie) {
myMovie.read();
} else if(m == yourMovie) {
yourMovie.read();
}
else {
void movieEvent(Movie m) {
if(m == myMovie) {
myMovie.read();
} else if(m == yourMovie) {
yourMovie.read();
}
else {
ourMovie.read();
}
}
}
1