Video library: why does read() need to be written as a statement in a function?

edited November 2015 in Library Questions

I've been learning how to use the video library, and I noticed that when you write;

by itself and not as a statement in a function (as in the code below), then the playback is jittery. I wondered if someone could explain why that is.

Movie myMovie; 

void setup() {
  size(624, 352);
  myMovie = new Movie(this, "1.mp4");

void draw() {
  if (myMovie.available() == true) {;
  image(myMovie, 0, 0);      


  • edited November 2015
    • You mean w/o 1st checking whether a new frame is available()?
    • Remember that draw() is called back @ ~60 FPS.
    • And method read() copies the actual Movie's buffer into pixels[].
    • Moreover, read() is synchronized. It means while it's being executed, it also halts Movie.
    • IMO, it's more "comfortable" to place read() inside movieEvent() than checking for available() all the time inside draw().
Sign In or Register to comment.