Hello, I wrote this class dedicated to a video player. I want to read videos when I click on 3d spheres in my main tab. How should I proceed to choose my videos inside the videoList, (they have the same names than the spheres) with an index ? I click on a sphere, it plays the full screen video wich has the same name than the sphere, then the video stop, window closes and go back to interface with the spheres and so on... Do someone know how I should start? Thanks a lot in advance for your help ;)
class Movie {
int currentMovieIndex;
int STATE_PLAYING_SELECTED_MOVIE;
int currentState = STATE_PLAYING_SELECTED_MOVIE, STATE_WAITING_FOR_CLICK;
float movieEndDuration = 0.039719;
String [] stateLabels = {"waiting for click", "playing selected movie"};
String [] videoList= {"obscurité", "sombre"};
Movie[] movies;
Movie(movies, String[]videoList) {
Movie[] movies = new Movie[videoList.length];
for (int i=0; i < videoList.length; i++) {
movies[i] = new Movie(this, videoList[i]+".mp4");
movies[currentMovieIndex].play();
}
}
void drawMovie() {
background(0);
image(movies[currentMovieIndex], 0, 0);
}
void playSelectedMovie() {
currentState = STATE_PLAYING_SELECTED_MOVIE;
movies[currentMovieIndex].play();
}
void movieEvent (Movie m) {
if (currentState == STATE_PLAYING_SELECTED_MOVIE) {
if ((m.time()+ movieEndDuration) < m.duration) {
m.read();
movies[currentMovieIndex].play();
} else if ((m.time() +movieEndDuration)>= m.duration()) {
m.stop();
currentState = STATE_WAITING_FOR_CLICK;
println("movie at index " + currentMovieIndex + " finished playback, current state: " + stateLabels[currentState]);
}
}
}
}