Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.video.*;
- Movie[] mov = new Movie[2];
- int current = 0;
- int totalMovies = 4;
- // assumes 0.mp4 1.mp4 2.mp4 3.mp4
- void setup() {
- size(720, 480);
- newRandomMovie();
- }
- void movieEvent(Movie m) {
- m.read();
- if(m.time() > m.duration() - 0.5) {
- m.stop();
- newRandomMovie();
- }
- }
- void draw() {
- image(mov[current], 0, 0, width, height);
- }
- void newRandomMovie() {
- int which = (int)random(totalMovies);
- current = (current + 1) % 2;
- mov[current] = new Movie(this, which + ".mp4");
- mov[current].play();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement