Hi
I’m trying to create an array of objects
Each object contains some variables and a movie object
For some reason, when calling on the movies duration() I’m getting information that doesn’t make sense (shows as 0.0), and the movies don’t play
import processing.video.*;
Table table;
class clip{
String fileName;
int clipNumber;
String type;
float clipDuration;
Movie movieObject;
//function to assign data from new clip
clip(String fileName_, int clipNumber_){
fileName = fileName_;
clipNumber = clipNumber_;
}
}
clip[] clips;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void setup() {
size(640, 360);
background(0);
loadData();
//verify that clips were loaded into array
for(clip A : clips){
print(A.fileName, " ");
println(A.clipDuration);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void movieEvent(Movie movie) {
movie.read();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void draw() {
image(clips[1].movieObject, 0, 0);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void loadData() {
table = loadTable("EPIGEN_data.csv", "header");
clips = new clip[table.getRowCount()];
int rowCount = 0;
for (TableRow row : table.rows()) {
String temp_fileName = row.getString("title");
int temp_clipNumber = row.getInt("index");
clips[rowCount] = new clip(temp_fileName, temp_clipNumber);
clips[rowCount].movieObject = new Movie(this, temp_fileName);
tempMov = new Movie(this, temp_fileName);
println(tempMov.duration(), "tempMov");
clips[rowCount].clipDuration = clips[rowCount].movieObject.duration();
println(temp_clipNumber, " " , temp_fileName);
rowCount++;
}
}