Hello,
I'm fairly new to Processing so please forgive my ignorance in advance. I'm trying to use the system variables mouseX and mouseY to navigate through a number of quicktime movies, 9 movies in total. The plan is use mouseX to switch between movie clips and mouseY to jump to a specific frame within the clip. It's been a long process to get to this point but to cut a long story short I'm using an array to preload the movie clips as discussed in this forum entry: http://processing.org/discourse/yabb2/YaBB.pl?board=Video;action=display;num=1221263317
Prior to using an array I was using the mouseY variable to successfully jump to a specific frame within a movie clip:
float ratio = mouseY/ (float) height;
myMovie.jump(ratio*myMovie.duration());
myMovie.read();
image(myMovie, 0, 0);
Unfortunately now I get the following error message: "Cannot invoke duration() on the array type Movie[]"
This is just slightly beyond my knowledge level, so if someone would be kind enough to point me in the right direction I'd be very grateful. The eventual plan with this sketch is to use JMyron/motion detection in place of mouseX/mouseY and then link to a separate Pure Data sound patch (fingers crossed). The full code so far is as follows:
import processing.video.*;
//the film array, the films will be pre loaded
Movie[] phoneFilm = new Movie[9]; //array of movies
void setup() {
size(640,480); //the application window will measure 640px x 480px
background(255);
//create the film array, "testFilm0.mov" to "testFilm11.mov"
for (int i = 0; i < phoneFilm.length; i ++ ) {
phoneFilm[i] = new Movie(this, "testFilm" + i + ".mov");
phoneFilm[i].loop();
}
}
void draw() {
//work out the zones, X axis switches between movie clips
int zRange = (width/9);
int zone0 = 0;
int zone1 = (zRange * 1);
int zone2 = (zRange * 2);
int zone3 = (zRange * 3);
int zone4 = (zRange * 4);
int zone5 = (zRange * 5);
int zone6 = (zRange * 6);
int zone7 = (zRange * 7);
int zone8 = (zRange * 8);
int Xaxis = mouseX;
image(phoneFilm[5],0,0);
//pick which movie clip to switch to
if ((Xaxis > zone0) && (Xaxis < zone1)) { //if the cursor is in the first zone (zone0)
image(phoneFilm[0],0,0);
}
if ((Xaxis > zone1) && (Xaxis < zone2)) {
image(phoneFilm[1],0,0);
}
if ((Xaxis > zone2) && (Xaxis < zone3)) {
image(phoneFilm[2],0,0);
}
if ((Xaxis > zone3) && (Xaxis < zone4)) {
image(phoneFilm[3],0,0);
}
if ((Xaxis > zone4) && (Xaxis < zone5)) {
image(phoneFilm[4],0,0);
}
if ((Xaxis > zone5) && (Xaxis < zone6)) {
image(phoneFilm[5],0,0);
}
if ((Xaxis > zone6) && (Xaxis < zone7)) {
image(phoneFilm[6],0,0);
}
if ((Xaxis > zone7) && (Xaxis < zone8)) {
image(phoneFilm[7],0,0);
}
if (Xaxis > zone8) {
image(phoneFilm[8],0,0);
}
//using the Y axis mouse cursor location to move through the frames of the film
float ratio = mouseY/ (float) height;
phoneFilm.jump(ratio*phoneFilm.duration());
phoneFilm.read();
image(phoneFilm, 0, 0);
}
Thanks in advance for any help.
I'm fairly new to Processing so please forgive my ignorance in advance. I'm trying to use the system variables mouseX and mouseY to navigate through a number of quicktime movies, 9 movies in total. The plan is use mouseX to switch between movie clips and mouseY to jump to a specific frame within the clip. It's been a long process to get to this point but to cut a long story short I'm using an array to preload the movie clips as discussed in this forum entry: http://processing.org/discourse/yabb2/YaBB.pl?board=Video;action=display;num=1221263317
Prior to using an array I was using the mouseY variable to successfully jump to a specific frame within a movie clip:
float ratio = mouseY/ (float) height;
myMovie.jump(ratio*myMovie.duration());
myMovie.read();
image(myMovie, 0, 0);
Unfortunately now I get the following error message: "Cannot invoke duration() on the array type Movie[]"
This is just slightly beyond my knowledge level, so if someone would be kind enough to point me in the right direction I'd be very grateful. The eventual plan with this sketch is to use JMyron/motion detection in place of mouseX/mouseY and then link to a separate Pure Data sound patch (fingers crossed). The full code so far is as follows:
import processing.video.*;
//the film array, the films will be pre loaded
Movie[] phoneFilm = new Movie[9]; //array of movies
void setup() {
size(640,480); //the application window will measure 640px x 480px
background(255);
//create the film array, "testFilm0.mov" to "testFilm11.mov"
for (int i = 0; i < phoneFilm.length; i ++ ) {
phoneFilm[i] = new Movie(this, "testFilm" + i + ".mov");
phoneFilm[i].loop();
}
}
void draw() {
//work out the zones, X axis switches between movie clips
int zRange = (width/9);
int zone0 = 0;
int zone1 = (zRange * 1);
int zone2 = (zRange * 2);
int zone3 = (zRange * 3);
int zone4 = (zRange * 4);
int zone5 = (zRange * 5);
int zone6 = (zRange * 6);
int zone7 = (zRange * 7);
int zone8 = (zRange * 8);
int Xaxis = mouseX;
image(phoneFilm[5],0,0);
//pick which movie clip to switch to
if ((Xaxis > zone0) && (Xaxis < zone1)) { //if the cursor is in the first zone (zone0)
image(phoneFilm[0],0,0);
}
if ((Xaxis > zone1) && (Xaxis < zone2)) {
image(phoneFilm[1],0,0);
}
if ((Xaxis > zone2) && (Xaxis < zone3)) {
image(phoneFilm[2],0,0);
}
if ((Xaxis > zone3) && (Xaxis < zone4)) {
image(phoneFilm[3],0,0);
}
if ((Xaxis > zone4) && (Xaxis < zone5)) {
image(phoneFilm[4],0,0);
}
if ((Xaxis > zone5) && (Xaxis < zone6)) {
image(phoneFilm[5],0,0);
}
if ((Xaxis > zone6) && (Xaxis < zone7)) {
image(phoneFilm[6],0,0);
}
if ((Xaxis > zone7) && (Xaxis < zone8)) {
image(phoneFilm[7],0,0);
}
if (Xaxis > zone8) {
image(phoneFilm[8],0,0);
}
//using the Y axis mouse cursor location to move through the frames of the film
float ratio = mouseY/ (float) height;
phoneFilm.jump(ratio*phoneFilm.duration());
phoneFilm.read();
image(phoneFilm, 0, 0);
}
Thanks in advance for any help.
1