Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Video playback + display image when finished

$
0
0
muchos gracias.. well i got it to work partially, so to say :)

i like it how it looks, now the image kind of flickers on top of the video, which is not bad either. 

But I still need to figure out how to tell the program to display image fully after the playback



import processing.video.*;
Movie myMovie;

PImage fragment;
int rand;

void setup() {
  size(640, 480);
  myMovie = new Movie(this, "swan-1.mp4");
  myMovie.play();
   rand = int(random(0,9)); //HERE YOU CHOOSE BETWEEN 10 DIFFERENT IMAGES
 takerandomimage("frag_" + nf(rand, 3) + ".jpg"); //CALL YOUR FUNCTION 'takerandomimage'
 //REMEMBER TO NAME YOUR IMAGES "frag_000.jpg"
}

void draw() {
  image(myMovie, 0, 0);
  
}

void movieEvent(Movie m) {
  m.read();
      if (myMovie.available())
    myMovie.read();
    
else image(fragment,0,0);
  
}

// THIS IS THE FUNCTION
void takerandomimage(String fn) {
   fragment = loadImage(fn); //LOAD RANDOM IMAGE
   image(fragment,0,0);//DISPLAY RANDOM IMAGE
}


Viewing all articles
Browse latest Browse all 1768

Trending Articles