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

Video playlist not incrementing!

$
0
0
Please someone help I cannot understand. Every single example I have used that other users say is working for them does nothing for myself. I can not get an index to increment and play the next video in a playlist. I have tried about twenty different examples yet none of them work.

I believe (mt == md) is never showing as true but cannot work out why.

  1. import processing.video.*;

  2. int maxMovies = 4; // Total number of movies
  3. int myMoviesIndex = 0; // Initial movie to be displayed
  4. Movie[] myMovies;

  5. void setup() {
  6.     size(720,480, P2D);
  7.  myMovies = new Movie[maxMovies]; //array of movies

  8.   for (int i = 0; i < myMovies.length; i ++ ) {
  9.     println(i);
  10.     myMovies[i] = new Movie(this, i+1 + ".mp4");
  11.     myMovies[i].loop();
  12.     myMovies[i].pause();
  13.   }
  14. }

  15. void draw() {
  16.   myMovies[myMoviesIndex].play();
  17.   image(myMovies[myMoviesIndex],0,0); // Displays image
  18.   println(myMovies[myMoviesIndex].time());
  19.   float mt = myMovies[myMoviesIndex].time();
  20.   float md = myMovies[myMoviesIndex].duration();
  21.   if(mt == md) {
  22.     myMovies[myMoviesIndex].pause();
  23.     myMoviesIndex ++;
  24.     println("done");
  25.     if (myMoviesIndex == maxMovies) {
  26.       myMoviesIndex = 0;
  27.     }
  28.        myMovies[myMoviesIndex].jump(0);
  29.    myMovies[myMoviesIndex].play();
  30.   }
  31. }

  32. void movieEvent(Movie myMovies) {
  33.   myMovies.read();
  34. }

Viewing all articles
Browse latest Browse all 1768

Trending Articles