stream video on second monitor

Hi All, i would be able to stream two video on two different monitor, at the same time. So far this is the code i written to stream one on the secondary monitor, but is not working:

import processing.video.*;

final PApplet projector0 = new ProjectorSketch();
final PApplet projector1 = new ProjectorSketch();

void setup() {
  size(300, 300, JAVA2D);
  smooth(4);
  noLoop();
  stroke(-1);

  runSketch(new String[] { "--display=1", "--present",  "--sketch-path=" + sketchPath(), "Projector" }, projector0);

}

void draw() {
  background(0);
}


class ProjectorSketch extends PApplet {
  Movie movie;


 void setup() {

   stroke(#FFFF00);
   movie = new Movie(this, "transit.mov");
  movie.loop();

   }


  public void settings() {
    size(displayWidth, displayHeight, JAVA2D);

  }

  void draw() {

  image(movie, 0, 0, width, height);
  }
}

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

Answers

  • No back ticks, instead edit your post (gear on top right side of any of your posts), select your code and hit ctrl+o. Leave an empty line above and below your block of code. Details here: https://forum.processing.org/two/discussion/15473/readme-how-to-format-code-and-text

    Kf

  • Done, any tips now?

  • Your subclass ProjectorSketch doesn't seem to have its own movieEvent(). :-?

  • edited May 4

    Try this. It works in my machine: Win 10. If you set the display to zero, it takes both screens. If you set it to 1, it loads in one screen. If 2 is selected, it is loaded in the other screen.

    Kf

    import processing.video.*;
    
    PApplet projector0;
    PApplet projector1;
    
    void settings() {
      size(300, 300);
    }
    
    void setup() {
      smooth(4);
      noLoop();
      stroke(-1);
    
      projector0 = new ProjectorSketch();
      projector1 = new ProjectorSketch();
    
      runSketch(new String[] {  "--display=1", "--present", "--sketch-path=" + sketchPath(), "Projector" }, projector0);
    }
    
    void draw() {
      background(150);
    }
    
    
    
    class ProjectorSketchX extends PApplet {
    
      color bc;
    
      void settings() {
        size(600, 400);
      }
    
      void setup() {
        bc=color(150, 150, 0);
      }
    
      void draw() {
        background(bc);
      }
    }
    
    public class ProjectorSketch extends PApplet {
      Movie movie;
    
      public void settings() {
        //size(displayWidth, displayHeight, JAVA2D);
        size(400, 600);
      }
    
      public void setup() {
        stroke(#FFFF00);
        movie = new Movie(this, dataPath("transit.mov"));
        movie.loop();
      }
    
      public void draw() {
    
        image(movie, 0, 0, width, height);
      }
    
    
      public void movieEvent(Movie m) {
        m.read();
      }
    }
    

    Keyword: kf_keyword mainSketch, runSketch, multiple windows, multiple PApplets, main function

Sign In or Register to comment.