Issue with loading movie on multiple windows

I am trying to create two windows, and play the movie on the sub-window.
So far I’ve made the sub-window appear with Applet, but it does not play the movie.
The mp4 file is located in the data file, and it appears fine on the main window.
Please can someone help me with how to solve this?

import processing.video.*;
 Movie Mov;

void settings(){
  fullScreen(P3D);
}
void setup() { 
      
  String[] args = {"SecondApplet"};   
  SecondApplet sa = new SecondApplet();
  PApplet.runSketch(args, sa);
  
}
 
void draw() {
  background(0);
}   

    

public class SecondApplet extends PApplet {

  public void settings() {
    fullScreen(P3D);
  }
  
 void setup(){
   Mov = new Movie(this, "movie.mp4");
   Mov.play();
  }
  
void draw() {
   background(255);
   image(Mov,0,0);
    }
   
  void movieEvent(Movie m) {
   m.read();
  }
  }

Thanks for the replay,
So there is no way I can make it work?

Forum.Processing.org/two/discussion/16457/size-method-for-intial-window-not-working-when-more-windows-are-are-added#Item_1

1 Like

Yes I’ve implemented "–sketch-path=” argument passed to PApplet.runSketch():
But it didn’t make any change. Works on the main window but not on the sub-window…

  • Can you post your most recent attempt?
  • Notice that only the main PApplet knows the correct sketchPath.
  • The others need to know it from the main PApplet via "–sketch-path=”.

Have you tried with the default renderer? Using more than one window with P2D or P3D is a recipe for disaster as there’s a bunch of static stuff that isn’t thread safe. The other issue is that the integration between GStreamer and OpenGL in the latest video library is, to put it mildly, a complete mess!

1 Like
final SecondApplet sa = new SecondApplet();
import processing.video.*;
 
void settings() {
  size(500,500);
  smooth(3);
 
  final String[] switches = { "--sketch-path=" + sketchPath(), "" };
  runSketch(switches, sa);
}
 
void setup(){
}
void draw() {
}

static class SecondApplet extends PApplet {
  Movie Mov;
  
  void settings() {
    size(500,500);
  }
  void setup(){
    background(255);
    Mov = new Movie(this, "movie.mp4");
    Mov.play();
  }
 
  void draw() {
   image(Mov,0,0,width,height);
  }
  
  void movieEvent(Movie m) {
 m.read();
 }

}

public static class SecondApplet extends PApplet {

2 Likes

It finally worked!! and this is exactly what I wanted to create.
Thank you so much for the help!! :smile:

1 Like