import processing.video.*; Movie currMovie; int currMovieNumber; String movieDir = "/Users/enguyen/Documents/Projects/split personality reorder/faceplayer/data/movies"; HashMap fileTree = new HashMap(); // maps each file number to an array of children HashMap fileNames = new HashMap(); // keyed by number boolean movieLoading = false; // for "thread safety" void setup() { size(640, 480, P2D); loadNextMovie(); } void draw() { // if it's time to move on to next movie // there are some weird states that the time() method gets into // 1. it can be -Infinity. we check for that // 2. time doesn't always hit the duration exactly. the negative offset // seems to be necessary to keep the movie from playing again. if (currMovie.time() > 0 && currMovie.time() >= (currMovie.duration()-.05)) { currMovie.stop(); currMovie = null; System.gc(); // doesn't seem to help loadNextMovie(); // if we're still drawing the movie } else { image(currMovie, 0, 0, width, height); } } // Called every time a new frame is available to read void movieEvent(Movie m) { m.read(); } void loadNextMovie() { // play the next movie currMovie = new Movie(this, "movies/face3r1.mov"); currMovie.play(); }