video input with elements
in
Core Library Questions
•
10 months ago
for my assignment, i had to upload a video, thus the code below works, the major problem that i have is that now i need to add elements into it such as pulses and designs, but every time i add anything the output is zero, the movie won't play nor can i add anything extra.....any suggestions? ...i am not a pc genius, just taking this class.
thank you
diana
import processing.video.*;
Movie theMov;
boolean isPlaying;
boolean isLooping;
void setup() {
size(840, 680);
theMov = new Movie(this, "ballet.mov");
theMov.loop(); //plays the movie over and over
isPlaying = false;
isLooping = true;
}
void draw() {
background(0);
image(theMov, mouseX-theMov.width/2, mouseY-theMov.height/2);
}
void movieEvent(Movie m) {
m.read();
}
void keyPressed() {
if (key == 'p') {
// toggle pausing
if (isPlaying) {
theMov.pause();
} else {
theMov.play();
println(5);
}
isPlaying = !isPlaying;
} else if (key == 'l') {
// toggle looping
if (isLooping) {
theMov.noLoop();
} else {
theMov.loop();
}
isLooping = !isLooping;
} else if (key == 's') {
// stop playing
theMov.stop();
isPlaying = false;
} else if (key == 'j') {
// jump to a random time
theMov.jump(random(theMov.duration()));
}
}
1