Video playlist not incrementing!
in
Core Library Questions
•
2 months ago
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.
- import processing.video.*;
- int maxMovies = 4; // Total number of movies
- int myMoviesIndex = 0; // Initial movie to be displayed
- Movie[] myMovies;
- void setup() {
- size(720,480, P2D);
- myMovies = new Movie[maxMovies]; //array of movies
- for (int i = 0; i < myMovies.length; i ++ ) {
- println(i);
- myMovies[i] = new Movie(this, i+1 + ".mp4");
- myMovies[i].loop();
- myMovies[i].pause();
- }
- }
- void draw() {
- myMovies[myMoviesIndex].play();
- image(myMovies[myMoviesIndex],0,0); // Displays image
- println(myMovies[myMoviesIndex].time());
- float mt = myMovies[myMoviesIndex].time();
- float md = myMovies[myMoviesIndex].duration();
- if(mt == md) {
- myMovies[myMoviesIndex].pause();
- myMoviesIndex ++;
- println("done");
- if (myMoviesIndex == maxMovies) {
- myMoviesIndex = 0;
- }
- myMovies[myMoviesIndex].jump(0);
- myMovies[myMoviesIndex].play();
- }
- }
- void movieEvent(Movie myMovies) {
- myMovies.read();
- }
1