Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Playing many movies at once

$
0
0
I'm able to play the same 10 videos at once using C/OpenGL/ffmpeg so I don't think my computer hardware is the issue.

Threading sounds interesting, but I'm not very familar with Thread in processing. Can I draw to the screen from a thread?

I'm running processing 2.0b8, my code which I guess is naive is below:
--

import processing.video.*;
import java.util.*;


ArrayList<Movie> movieList = new ArrayList<Movie>();

String mfiles[] = {
        "/Users/drlandy/Movies/file1.mpg",
        "/Users/drlandy/Movies/file2.ts",
        "/Users/drlandy/Movies/file3.ts",
        "/Users/drlandy/Movies/file4.ts",
        "/Users/drlandy/Movies/file5.ts"
};


void setup() {
  size(displayWidth, displayHeight, OPENGL);

  for (String movFile : mfiles) {
    Movie movie = new Movie(this, movFile);
    movie.loop();
    movieList.add(movie);
  }
  textureMode(NORMAL);
}

boolean sketchFullScreen() {
  return  true;
}

void draw() {
  background(0);

  for (int i =0; i<5; i++) {
    pushMatrix();
    float yPos = 150 + 240*(i/10);
    float xPos = 150 + 240*(i%10);
    translate(xPos, yPos,0);
    scale(120, 120);
    
    beginShape(QUADS);
    texture(movieList.get(i));
    vertex(-1,-1, 1,0,0); vertex( 1,-1, 1,1,0); vertex( 1, 1, 1,1,1); vertex(-1, 1, 1,0,1);
    endShape();
    
    popMatrix();
  }
  
}


void movieEvent(Movie m) {
  m.read();
}

Viewing all articles
Browse latest Browse all 1768

Trending Articles