Why does video start playing before it is called in a pathway?

edited December 2017 in Library Questions

Hello,

I am trying to get the video to not begin playing until stage 1, but it starts right away. Any suggestions? Thank you!

PImage old;
import processing.video.*;
Movie movie;
int stage = 0;


void setup(){
size(500,500);
old = loadImage("old.png");
old.resize(500,500);
  movie = new Movie(this, "full.mov");
  movie.loop();
}

void draw(){
if (stage == 0){
  fill (255,0,0);
  rect (0,0,500,500);
  if ((mousePressed)&& (mouseX > 0) && (mouseX < 250)&& (mouseY > 0) && (mouseY < 250)){ //button on upper left side
    stage = 1;
  }
}

if (stage == 1){ 
 image(movie,0,0,500,500);
 image(old,0,0,500,500); 

}

}

void movieEvent(Movie m){
  m.read();
}
Tagged:

Answers

  • @koogs is this solution as easy as the one you just gave me about the audio file? :)

  • Answer ✓

    I solved my own problem based on another post! It must start off in pause mode for zero and then play mode in stage 1.

    PImage old;
    import processing.video.*;
    Movie movie;
    int stage = 0;
    
    
    void setup(){
    size(500,500);
    old = loadImage("old.png");
    old.resize(500,500);
    movie = new Movie(this, "full.mov");
    movie.loop();
    }
    
    void draw(){
    if (stage == 0){
      movie.pause();
      fill (255,0,0,20);
      rect (0,0,500,500);
      if ((mousePressed)&& (mouseX > 0) && (mouseX < 250)&& (mouseY > 0) && (mouseY < 250)){ //button on upper left side
        stage = 1;
      }
    }
    
    if (stage == 1){ 
      movie.play();
     image(movie,0,0,500,500);
     image(old,0,0,500,500); 
    
    }
    
    }
    
    void movieEvent(Movie m){
      m.read();
    }
    
  • Don't know how to mark it as resolved.

  • Answer ✓

    movie.loop() starts the video iirc.

  • Thank you @koogs!!!

  • That's right, movie.loop() means "play now, and also repeat when done", not "turn the repeat flag on."

Sign In or Register to comment.