O'Reilly logo

openFrameworks Essentials by Denis Perevalov, Igor Tatarnikov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing a video file

openFrameworks supports video files of various formats, including MP4, MOV, and AVI. The class for playing videos is ofVideoPlayer.

Note

For playing videos with openFrameworks on Windows, you need to have Apple's QuickTime installed. It's free to download from apple.com. (Please, restart Windows after installing.)

Let's load a video file and play it on the screen in the following way:

  1. Add the video object definition to the ofApp class:
    ofVideoPlayer video;
  2. Add the commands to load the video from the flowing.mp4 file and starting it to play by inserting the following lines to setup():
    video.loadMovie( "flowing.mp4" );
    video.play();
  3. Add the command to update video objects regularly by inserting the following line to update():
    video.update(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required