Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

play a random list of videos by keypress, exhaust

$
0
0

I need help please, how could make according to press a key "1" play in random select from a list of videos, while its pressed? (the video start playing on loop, so that the list is just a video. Not play the next, until you release the key (else background = 0) or (stop all), when press key "1" (or 2) again then random looks again in "one" list).

--any ideas?, is not important for my use array-- code:

import processing.video.*;

String[] one = {"1.mov","2.mov","3.mov"};
String[] two = {"4.mov","5.mov","6.mov"};
String[] three = {"7.mov","8.mov","9.mov"};

Movie myMovie; //Movie

int a = 0;
float md = 0;
float mt = 0;

void setup() {
 size(400, 400);
}
void draw(){
 if (keyPressed) {
    if (key == '1'  {
      for (int i = 1; i < myMovie.length; i ++ ) {    myMovies[i] = new Movie(this, one);
      myMovies[i].loop();
    }
    }
  } else  background(0);
//////////////////////////
  if (keyPressed) {
    if (key == '2'  {
      for (int i = 1; i < myMovie.length; i ++ ) {    myMovies[i] = new Movie(this, two);
      myMovies[i].loop();
    }
    }
  } else  background(0);
/////////////////////////////
 if (keyPressed) {
    if (key == '3'  {
      for (int i = 1; i < myMovie.length; i ++ ) {    myMovies[i] = new Movie(this, three);
      myMovies[i].loop();
    }
    }
  } else  background(0);
 //myMovie = new Movie(this, one[int(random(i.length))]);
    // myMovie.play();
    }

Viewing all articles
Browse latest Browse all 2896

Trending Articles