We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello
I was trying to make a code for playing my project. But I couldn't figure out how to make the same video play and after finished showing few second (maybe 5 seconds) of how many times video played. and again playing the video.
It could be a very obvious question, but few days of searching, I still couldn't find the solution...
please anyone can advise on this problem?
import processing.video.Movie;
Movie vid;
boolean ended;
void setup() {
frameRate(30);
textSize(050);
textAlign(CENTER, BASELINE);
fill(0);
vid = new Movie(this, "StudioOutside.mov") {
@ Override public void eosEvent() {
super.eosEvent();
myEoS();
}
};
vid.play();
while (vid.width == 0 | vid.height == 0) delay(10);
surface.setSize(vid.width, vid.height); // P3
//size(vid.width, vid.height); // P2
}
void draw() {
if (!ended) background(vid);
else {
if (key == ' ' || key == ' ') {
keyPressed = true;
if (keyPressed == true) {
background(vid);
vid.play();
}
} else {
vid.stop();
background(255);
text("Playback has finished!", width>>1, height>>1);
}
}
}
void movieEvent(final Movie m) {
m.read();
}
void myEoS() {
ended = true;
frameRate(1);
}
Answers
keyPressed is a reserved variable. probably best to use another name.
you know the condition is true, you've just set it to true
what's this do?
you have to rewind() a video before playing it again, it's like a tape.
Check the following modifications.
Kf