We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Play video on MousePressed (Read 1057 times)
Play video on MousePressed
May 1st, 2010, 9:03am
 
Hello,

Sorry for this basic question but I haven't found solution on Processing.org... I'm trying to play video when mouse is pressed or on a specific position.

The video is playing automatically once the sketch is launched. And if put my commands in the draw section, the mousePressed command works but I have only the sound.

I imagine there's a simple solution but I can't find it. Here's my code. Thank you very much for your help.

********************************

import processing.video.*;
Movie myMovie;

boolean on = false;

void setup(){
 size(1024,768);
 background(0);
 frameRate(30);
 smooth();
 myMovie = new Movie(this, "essaifilm1.mov");
 myMovie.play();
}


void draw()
{

 if (mousePressed){on=true;}
 
 if(on)
   {
   image(myMovie,0,0);
   }
}
         
         
void movieEvent (Movie myMovie) {
 myMovie.read();
}
 
Page Index Toggle Pages: 1