ControlP5 - want to play two movies both in main window and extrawindow
in
Contributed Library Questions
•
1 year ago
i want to play two movies in both main and extrawindow. I am getting sound but there is no display they both are blank.
Here is my code
import controlP5.*;
import processing.opengl.*;
import codeanticode.gsvideo.*;
import codeanticode.glgraphics.*;
ControlP5 controlP5;
ControlWindow controlWindow;
ControlWindowCanvas cc;
GSMovie myMovie;
GSMovie myMovie2, nowPlaying;
GLTexture tex;
// this example demonstrates how to use a ControlWindowCanvas
// which can from different windows.
// click the mouse in both windows to see the effect.
// your controlWindowCanvas class
class MyCanvas extends ControlWindowCanvas {
public void draw(PApplet theApplet) {
theApplet.background(255);
if(mousePressed) {
myMovie2.pause();
myMovie2.jump(0);
nowPlaying = myMovie;
nowPlaying.loop();
}
if(theApplet.mousePressed) {
myMovie.pause();
myMovie.jump(0);
nowPlaying = myMovie2;
nowPlaying.loop();
}
}
}
void setup() {
size(960, 540, GLConstants.GLGRAPHICS);
background(0);
tex = new GLTexture(this);
myMovie2 = new GSMovie(this, "dino.mov" );
myMovie = new GSMovie(this, "solar.mov" );
nowPlaying = myMovie;
nowPlaying.loop();
controlP5 = new ControlP5(this);
controlWindow = controlP5.addControlWindow("controlP5window",width,height);
controlWindow.setUpdateMode(ControlWindow.NORMAL); // It updates the previous value
// create a control window canvas and add it to
// the previously created control window.
cc = new MyCanvas();
// cc.pre(); // use cc.post(); to draw on top of existing controllers.
controlWindow.addCanvas(cc); // add the canvas to controlWindow
}
void draw(){
image(nowPlaying,0,0,width,height);
}
void movieEvent(GSMovie _mov){
_mov.read();
}
thanking you in anticipation.....
1