how to use "random" for playing videos randomly
in
Contributed Library Questions
•
10 months ago
Hello @all,
I'm a beginner at processing. So sorry in advance for these maybe banal questions. How it is possible to play video sequences by processing itself randomly? In addition I would like to have the video sequences in an array or arraylist?!
The code shows one video implementation, but I'd like to have multiple.
Thanks for your help ;) I've tried so many things till now... :/
- import SimpleOpenNI.*;
- import org.json.*;
- import processing.video.*;
- int BeamerWidth = 1024;
- int BeamerHeight = 768;
- void setup() {
- size(BeamerWidth, BeamerHeight);
- background(0);
- AdultMan1 = new Movie(this, "probesequenz01.ogg");
- //allVideos[1] = new Movie(this, "probesequenz03.ogg");
- }
- Movie AdultMan1;
- //Movie[] allVideos = new Movie[1];
- // Called every time a new frame is available to read
- void movieEvent(Movie AdultMan1) {
- AdultMan1.read();
- }
- void draw() {
- // A new time position is calculated using the current mouse location:
- float f = constrain((float)mouseX / width, 0, 1);
- float destination = AdultMan1.duration() * f;
- float current = AdultMan1.time();
- println("current: " + current + ", destination: " + destination);
- if (current < destination)
- AdultMan1.speed(1);
- else
- AdultMan1.speed(-1);
- AdultMan1.play();
- println("speed: " + 15.0*abs(destination-current)/abs(destination+current)+1);
- image(AdultMan1, 0, 0, width, height);
- rect(0, 0, AdultMan1.time()/AdultMan1.duration()*width, 10);
- frame.setTitle("scratch (" + round(frameRate) + " fps)");
- }
1