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

Re : video playlist

$
0
0
Hey
I am trying to work with a videoplaylist. I would like to choose one video out of an array, play it and if the clip is finished, play the next video.

If the current time of the first clip is bigger than the 90 percent of the durration, the current clip stops, but no other movie clip out ouf the array starts to play. Why?

I have even tried to paint a image over the last frame of the clip. But even this does not work.
Do you know if my if-claus? And if not, why not?

It would be great if anyone could help me :)

Many thanks

  1. import processing.video.*;
    //PImage img;
    Movie[] movies = new Movie[5];
    int rnd = int(random(0, 4));
    int w = 640;
    int h = 480;

    void setup()
    {
      size(w, h);

      background(255);

      //img = loadImage("screenshot_320.jpg");
      movies[0] = new Movie(this, "Sequence 01_1_1.mov");
      movies[1] = new Movie(this, "Sommer.mov");
      movies[2] = new Movie(this, "Sequence 01_1_1.mov");
      movies[3] = new Movie(this, "Sommer.mov");
      movies[4] = new Movie(this, "Sequence 01_1_1.mov");

      movies[rnd].play();
    }

    void draw()
    {

      background(255);
      image(movies[rnd], 0, 0);

      float currTime = movies[0].time();
      float duration = movies[0].duration();
      if (currTime > duration*0.9) {
        movies[rnd].stop();
        rnd = int(random(0, 4));
        movies[rnd].play();
        image(movies[rnd], 0, 0);
       // image(img, 0, 0);
      }
    }


    // Called every time a new frame is available to read
    void movieEvent(Movie m) {
      m.read();
    }


Viewing all articles
Browse latest Browse all 1768

Trending Articles