# Issue with loading movie on multiple windows

**URL:** <https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653>\
**Category:** Libraries\
**Created:** [April 26, 2021, 2:25pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653 "2021-04-26T14:25:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![toto](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@toto](https://discourse.processing.org/u/toto)\
**Post date:** [April 26, 2021, 2:25pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/1 "2021-04-26T14:25:09Z")

</div>

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?

```auto
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();
  }
  }

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 26, 2021, 2:36pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/2 "2021-04-26T14:36:27Z")

</div>

> [@Using custom \`main(String\[\] args)\` breaks file reading functions in Windows (e.g. \`loadShader()\`, \`loadImage()\`)](https://discourse.processing.org/t/using-custom-main-string-args-breaks-file-reading-functions-in-windows-e-g-loadshader-loadimage/2572/14):
>
> By default, field PApplet::sketchPath would point to the “Current Working Directory” (CWD): Unless a special “–sketch-path=” argument is passed to PApplet.runSketch(): [Forum.Processing.org/two/discussion/16457/size-method-for-intial-window-not-working-when-more-windows-are-are-added#Item\_1](http://Forum.Processing.org/two/discussion/16457/size-method-for-intial-window-not-working-when-more-windows-are-are-added#Item_1) I believe the PDE (Processing’s IDE) creates its own customized main(String[] args) which passes all of those custom args to the compiled sketch. And when we override it by making our own main(String[…

---

<div class="post-metadata">

**Author:** ![toto](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@toto](https://discourse.processing.org/u/toto)\
**Post date:** [April 26, 2021, 3:14pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/3 "2021-04-26T15:14:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 26, 2021, 3:29pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/4 "2021-04-26T15:29:02Z")

</div>

[Forum.Processing.org/two/discussion/16457/size-method-for-intial-window-not-working-when-more-windows-are-are-added#Item\_1](http://Forum.Processing.org/two/discussion/16457/size-method-for-intial-window-not-working-when-more-windows-are-are-added#Item_1)

---

<div class="post-metadata">

**Author:** ![toto](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@toto](https://discourse.processing.org/u/toto)\
**Post date:** [April 26, 2021, 3:39pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/5 "2021-04-26T15:39:26Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 26, 2021, 3:56pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/6 "2021-04-26T15:56:31Z")

</div>

- 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=”.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [April 26, 2021, 4:01pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/7 "2021-04-26T16:01:00Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![toto](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@toto](https://discourse.processing.org/u/toto)\
**Post date:** [April 26, 2021, 4:05pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/8 "2021-04-26T16:05:16Z")

</div>

```auto
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();
 }

}

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 26, 2021, 4:20pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/9 "2021-04-26T16:20:04Z")

</div>

> [@toto](#):
>
> `static class SecondApplet extends PApplet {`

`public static class SecondApplet extends PApplet {`

---

<div class="post-metadata">

**Author:** ![toto](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@toto](https://discourse.processing.org/u/toto)\
**Post date:** [April 26, 2021, 4:22pm UTC](https://discourse.processing.org/t/issue-with-loading-movie-on-multiple-windows/29653/10 "2021-04-26T16:22:00Z")

</div>

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