Loading...
Logo
Processing Forum
I'm looking to play a few videos inside void draw. These videos are going to be created after void setup, so I can't initialise them first. To simplify things, I've taken the basic play movie example and swapped the video initialisation into the void draw. This is pretty much how my sketch works. I get this error message and the video doesn't seem to play.

 "java(1109,0xac0b62c0) malloc: *** error for object 0x130d950: double free
*** set a breakpoint in malloc_error_break to debug"

when the simplified code is:

Copy code
  1. import processing.video.*;
  2. Movie myMovie;
  3. int counter = 0;

  4. void setup() {
  5.   size(350, 260, P2D);
  6.  
  7. }

  8. void draw() {
  9.    myMovie = new Movie(this, "drawing"+counter+".mov");
  10.   myMovie.play();
  11.   image(myMovie, 0, 0);
  12. }

  13. void movieEvent(Movie m) {
  14.   m.read();
  15. }

Replies(3)

Have you searched the forum? I have seen this error message a few times.
And I don't think it is a good idea to unconditionally load and start a movie 60 time per seconds (the number of times draw() is called each second by default).
I had a search but couldn't find anything resolved.

How would I load the movie once in void draw?

Thanks
Yes, I am not sure the problem was solved, alas...

Note that when loading the video, your sketch will be halted until the operation is completed.
And to load the movie once, you need a condition, an if for example, checking for some state, like user has pressed a key, previous video has finished, frameCount has reached a number, a given time (checked with millis()) is spent, etc.