< back to all how-tos

Load and play a video

In your header file (*.h), add this line:

ofVideoPlayer videoPlayer;

In your .cpp file, there are only a few more lines of code we need, this is what you'll need to add to the setup() function:

videoPlayer.load("myLovelyVideo.mp4");

In your update() function:

videoPlayer.update();

In your draw() function:

videoPlayer.draw(0, 0, 400, 300);