Hiya
Am aiming to permit play and stop of video from human interaction.
Have been playing with this code and reached point of video playing looped until key depressed. Video just stays at same frame. I'm aiming to: keypress & play video until finish otherwise if keyreleased then reset video..
Where am I going wrong, any ideas?
Thanks
Code:import processing.video.*;
int i=0;
Movie theMov;
boolean isPlaying;
boolean isLooping;
void setup() {
size(640, 480);
background(0,0,0);
theMov = new Movie(this, "2.mp4");
theMov.play(); // tried loop, just plays movie again and again
//isPlaying = true;
//isLooping = true;
}
void draw() {
if (keyPressed == true) {
i++;
fill(0,0,0,i); //i is used for transperancy
rect(0,0,width,height);
//the 60 stands for 4 seconds seeing as its 4x15
if (i > 60) {
i = 0;
}
image(theMov, 0, 0);
}
else if (keyPressed == false) {
theMov.stop();
i++;
fill(255,255,255,i); //i is used for transperancy
rect(0,0,width,height);
//the 60 stands for 4 seconds seeing as its 4x15
if (i > 60) {
i = 0;
}
}
}
void movieEvent(Movie m) {
m.read();
}