Processing GSVideo Library arraylist to play videos on the random part of the screen, please help
I am creating a processing sketch where I would like several videos to appear on screen at once and then new ones added every 30 seconded kind of creating a collage of videos. I am using the GSVideo Library. I would like to use GSMovie because it’s less finicky then the movie library. However when I draw it I want the x and y quadrants to be random, but the movie is being re-drawn several times. I would just like the movie to be placed on a random part of the screen once.
import codeanticode.gsvideo.*;
//data/movie1.mov
//GSMovie movie;
ArrayList<GSMovie> movies = new ArrayList();
void setup() {
size(300, 300);
for (int i=1; i<=3; i++) {
String filename = i + ".mp4"; // movie1.mp4
println(filename);
GSMovie m = new GSMovie(this, filename);
movies.add(m);
// testing
m.loop();
}
}
void draw() {
boolean still =false;
//GSMovie m = movies.get(0); // like with arrays, movies[0]
float r = random(300);
float x = 0;
float y = 0;
for (GSMovie m : movies) {
if (!still){
// for (int i=0; i < movies.size(); i++) {
// GSMovie m = movies.get(i);
image(m, int (random(300)), int (random (300)), 100, 100);
// x += (100);// moves over by 100
y += (100);
still = true;
}
}
}
// automatically trigger event
void movieEvent(GSMovie m) {
m.read();
}