# Movie file doesn't load

**URL:** https://discourse.processing.org/t/movie-file-doesnt-load/11169
**Category:** Libraries
**Created:** [May 12, 2019, 12:56pm UTC](https://discourse.processing.org/t/movie-file-doesnt-load/11169 "2019-05-12T12:56:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dehyde](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dehyde/32/5153_2.png) [@dehyde](https://discourse.processing.org/u/dehyde)
#### Post date: [May 12, 2019, 12:56pm UTC](https://discourse.processing.org/t/movie-file-doesnt-load/11169/1 "2019-05-12T12:56:47Z")

</div>

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

```auto
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++;
    
  }
}

```

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [May 13, 2019, 1:19am UTC](https://discourse.processing.org/t/movie-file-doesnt-load/11169/2 "2019-05-13T01:19:38Z")

</div>

hi, thanks for posting ( good formatted code ),  
but if i understand correctly,  
the whole question is NOT

- about reading a table from csv file ( id , filename )
- storing it to array of class

it is about loading a movie and get its duration?

```auto
    tempMov = new Movie(this, temp_fileName);
    println(tempMov.duration(), "tempMov");
    clips[rowCount].clipDuration = clips[rowCount].movieObject.duration();

```

i think there is a misunderstanding in that 3 lines,  
-a- you load a movie from file to tempMov  
-b- print its duration  
? is that info at that line correctly shown?  
-c- you want store the clip duration,  
but you store something you not have loaded!

i think

```auto
    clips[rowCount].clipDuration = tempMov.duration();

```

might work better.  
( but untested )
