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.
IndexProgramming Questions & HelpSyntax Questions › cannot load video into array...
Page Index Toggle Pages: 1
cannot load video into array... (Read 908 times)
cannot load video into array...
Apr 27th, 2009, 11:16am
 
I can't seem to get my videos loaded into an array and playing on a mouse click. The videos are all labeled right and no errors when running just don't know why no video's comming up. Its probably somethin stupid that i can't see.. I've 6 videos just named tester 1-6 .mov in the data folder

Code:

import processing.video.*;

int maxmyMovies = 5; // Total # of movies
int myMoviesIndex = 0; // Initial movie to be displayed is the first
Movie[] myMovies = new Movie[maxmyMovies]; //array of movies

void setup() {

size(640,480);
// Loading the movies into the array
// Don't forget to put the .mov files in the data folder!
for (int i = 0; i < myMovies.length; i ++ ) {
myMovies[i] = new Movie(this, "tester" + i + ".mov");
//myMovies.read();
}
}

void movieEvent(Movie myMovies) {
myMovies.read();
myMovies.loop();
}

void draw() {
image(myMovies[myMoviesIndex],0,0, 200, 200); // Displaying one image
}


void mousePressed() {
// A new movie is picked randomly when the mouse is clicked
// Note the index to the array must be an integer!
myMoviesIndex = int(random(myMovies.length));
}

Re: cannot load video into array...
Reply #1 - Apr 27th, 2009, 1:40pm
 
Does adding "myMovies[i].loop();" to the for loop in setup() help?

And removing it from movieEvent()?
Re: cannot load video into array...
Reply #2 - Apr 27th, 2009, 5:57pm
 
It does i figured it out just after posting - now i need to mask the video as they come out but can't seem to mask from the myMovies array.....

heres the relevant part of the code


void display() {
     brushMask = loadImage("b-vignette.jpg");
     myMovies.mask(brushMask);
     brushMask.resize(myMovies.width, myMovies.height);
     image(myMovies[myMoviesIndex],x+16,y+14,D-33,D-33);
     image(bubble, x+16,y+14,D-33,D-33);
   
   // overlay bubble reflection image
   //noTint();
   //image(myMovies[myMoviesIndex],x+16,y+14,D-33,D-33)
   //image(bubble,x+16,y+14,D-33,D-33);
 }

Anyone any ideas
Re: cannot load video into array...
Reply #3 - Apr 27th, 2009, 10:03pm
 
Masking the array would not work, but you should be able to use "myMovies[myMoviesIndex].mask(brushMask);" for the visible one.

A hint: if display() will be called repeatedly, use loadImage() in setup() to only load the picture once.
Page Index Toggle Pages: 1