sorry but in the documentation i don't see a dispose() method.
that should work, because never really close a video, it keep them in a list so it can be reused:
import processing.serial.*;
import processing.video.*;
Serial myPort; // The serial port
HashMap <String, Movie> listOfMovie = new HashMap<String, Movie>();//the list of open movie
Movie playingMovie; //the pointer to the actual playing movie, no movie = null
void setup() {
size(400,400,P3D);
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[1], 2400);
myPort.buffer(10);//that means don't call serialEvent until 10 carater are recived
background(0);
//here load and put all movie in the map.
listOfMovie.put("3600A9C9F8", new Movie(this, "file1.mov") );
listOfMovie.put("0000000000", new Movie(this, "file2.mov") );
///etc etc
}
void draw() {
synchronized(playingMovie) {//to be sure we don't change video while it is changed by Serial command
if (playingMovie != null) { //if video is rendering
if ( playingMovie.available() ) { //if a new frame is available
playingMovie.read(); //load it
}
image(playingMovie, 0, 0); //show the frame
}
}
}
void serialEvent(Serial p) {
synchronized(myPort) {//to be sure only one thread at time can enter here
while (myPort.available() >= 10) {
//Video Code:
String command = "";
for (int i=0;i<10;i++) {
command += myPort.readChar();
}
println(command);//here you should have the correct command
//myMovie.setSize();
if ( listOfMovie.containsKey(command) ) {//if the command is related to a video
synchronized(playingMovie) {//to be sure we don't change video while it is drawn
playingMovie.stop(); //stop old video
playingMovie = listOfMovie.get(command); //get the command's video
playingMovie.jump(0); //restart video from beginning
playingMovie.play(); //play it
}
}
}
}
}