video on new window
in
Core Library Questions
•
2 years ago
Hey, Im trying to make a code that imports video via browser and then plays it on a new screen, however I cannot figure out how to get the video playing on the other window (it just overplays on the controlling window) was wondering if anyone knows how to do this. Thanks.
Heres what I have thus far.
PFrame f;
secondApplet s;
import processing.video.*;
Movie movie;
int tileCountX = 12;
int tileCountY = 16;
float tileWidth, tileHeight;
int imageCount = tileCountX*tileCountY;
int currentImage = 0;
int gridX = 0;
int gridY = 0;
//variables for rect
float x;
float y;
float w;
float h;
void setup() {
size(320, 240);
PFrame f = new PFrame();
x = width/2+112.5;
y = height/2-40;
w = 200;
h = 200;
}
void draw() {
s.redraw();
}
public class PFrame extends Frame {
public PFrame() {
setBounds(100,100,1000,1000);
s = new secondApplet();
add(s);
s.init();
show();
}
}
public class secondApplet extends PApplet {
public void setup() {
size(400, 300);
noLoop();
}
public void draw() {
{
//the main browse rectangle
stroke(4,26,85,200);
strokeWeight(1.3);
fill(210);
rect(x,y,w,h);
}
//mouseClicks
if(mousePressed){
if(mouseX>x && mouseX <x+w && mouseY>y && mouseY <y+h){ // if the mouse is in box space + pressed
println("The mouse is pressed and over the button");
//do stuff
// select path and load video
String path = selectInput("select a video file ...");
movie = new Movie(this, path);
movie.play();
movie.loop();
movie.frameRate(125);
}
{
movie.read(); // read frame
image(movie,0,0); // display frame
// calculate the current time in movieclip
float moviePos = map(currentImage, 0,imageCount, 0,movie.duration());
}
}
}
}
Heres what I have thus far.
PFrame f;
secondApplet s;
import processing.video.*;
Movie movie;
int tileCountX = 12;
int tileCountY = 16;
float tileWidth, tileHeight;
int imageCount = tileCountX*tileCountY;
int currentImage = 0;
int gridX = 0;
int gridY = 0;
//variables for rect
float x;
float y;
float w;
float h;
void setup() {
size(320, 240);
PFrame f = new PFrame();
x = width/2+112.5;
y = height/2-40;
w = 200;
h = 200;
}
void draw() {
s.redraw();
}
public class PFrame extends Frame {
public PFrame() {
setBounds(100,100,1000,1000);
s = new secondApplet();
add(s);
s.init();
show();
}
}
public class secondApplet extends PApplet {
public void setup() {
size(400, 300);
noLoop();
}
public void draw() {
{
//the main browse rectangle
stroke(4,26,85,200);
strokeWeight(1.3);
fill(210);
rect(x,y,w,h);
}
//mouseClicks
if(mousePressed){
if(mouseX>x && mouseX <x+w && mouseY>y && mouseY <y+h){ // if the mouse is in box space + pressed
println("The mouse is pressed and over the button");
//do stuff
// select path and load video
String path = selectInput("select a video file ...");
movie = new Movie(this, path);
movie.play();
movie.loop();
movie.frameRate(125);
}
{
movie.read(); // read frame
image(movie,0,0); // display frame
// calculate the current time in movieclip
float moviePos = map(currentImage, 0,imageCount, 0,movie.duration());
}
}
}
}
1