We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have figured out how to play and stop a movie.
Here I would like to know 2 things.
I dont want screen to become black when I stop a movie.
I would like to play full movie every time when I touch yellow rectangle. In other words, I dont want to stop a movie in a middle of video.
Thank You, Arigato m()m
import processing.video.*;
Movie movie;
void setup() {
colorMode(HSB, 360, 100, 100);
size(1280, 720);
movie = new Movie( this, "movie.avi");
frameRate(60);
}
void ellipseFront() {
fill(0, 100, 100);
ellipse(width*1/3, height/2, 100, 100);
}
void ellipseBack() {
fill(120, 100, 100);
ellipse(width*2/3, height/2, 100, 100);
}
void movieEvent( Movie m ) {
m.read();
}
void playMovie() {
fill(60, 100, 100);
rect(100, 100, 200, 200); //yellow rectangle
image( movie, 0, 0, width, height);
if (mouseX > 100 && mouseX <300 && mouseY > 100 && mouseY <300) { //when I touch yellow rect play movie
movie.play();
} else {
movie.stop();
}
}
void draw() {
background(360);
ellipseBack();
playMovie();
ellipseFront();
}
Answers
The best advice we can give you is to break your problem down into smaller pieces.
You've already split it into two separate steps, and that's great. Now you should create small example programs that test out each step by themselves.
What exactly do you mean when you say you don't want the screen to go to black when you stop the movie? Create an example sketch that deals only with this step.
Separate from that, create another example sketch that shows a yellow button. Print something to the console when you detect a click on the button. Iterate on that until you have a more complete program.
But just looking at the code you have, it looks like you want to have a check inside the button click: if the movie is already playing, then don't stop it, right? What happens when you try that?
@KevinWorkman
Thank you for your advices! arigato!
It shows "black" screen for a moment when I start playing a movie and when I stop a movie.
I have figured out how to play full movie every time when I wanted.
This Japanese web site helped me how to play movie in Processing. http://mslabo.sakura.ne.jp/WordPress/make/processing
Here is a code I wrote, based on the web site above.
Check this post: https://forum.processing.org/two/discussion/23419/video-play-random-video-sequence#latest
Kf