10 Working with Video

Sketch 80: Playing a Video

We can use Processing to play videos but, as was the situation with audio, Processing does not have its own facility for doing so. Instead, we use the Movie class from the processing.video library, which in turn uses the underlying Java-based video functions. As a first example, this sketch will load and display a short video.

First, we import the processing.video library 1 as the first line in the program:

import processing.video.*;

Now we can declare an instance of the Movie class 2, one for each movie we want to play:

Movie movie;

We load the video file when we initialize the class instance ...

Get An Artist's Guide to Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.