We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, so right now I am playing a video via the usual method of
import processing.video.*;
Movie myMovie;
void setup() {
size(1920, 1080);
background(0);
myMovie = new Movie(this, "movie.mp4");
myMovie.loop();
}
and then pausing it with mouse clicks like so
void mousePressed() {
myMovie.pause();
background(249, 227, 162);
}
How can I make it display the background or a jpeg while the video is paused?
Answers
Taking a look at its source code @ "Movie.java", we can see these 3
protectedfields:Dunno why but that library doesn't provide us any methods to read those important informations! :-w
booleanflag field.So here's a sample of the idea:
P.S.: The other way is hack the Movie class by extending it. Then create a method to spit out current paused field's state! ;-)
Thank you. That was very helpful. However, I still have have trouble displaying the image when it's paused. Right now I'm using
void draw() { if (isPaused) { image(blank, 0, 0); } else { image(myMovie, 0, 0); } }but it just flashes the background color then goes back to showing the paused movie frame.
Nevermind. I forgot to place the isPaused variable in the functions that actually pause the movie. Thanks again!
Glad it's finally work! As another extra, a shorter version for which PImage to display: :ar!
set(0, 0, isPaused? blank : myMovie);Or even w/ background() if both PImage objects got exactly the same width & height as the canvas': :P
background(isPaused? blank : myMovie);