Playing a video file
The openFrameworks's ofVideoPlayer
class is intended for playing and controlling video. The basic usage of the ofVideoPlayer
video object is the following:
Loading video file, specifying its name:
video.loadMovie( "video.mov" );
Starting video to play:
video.play();
Decoding the needed frame to show and playing the corresponding sound chunk (best to call it in
testApp::update()
):video.update();
Drawing the current video frame:
video.draw( x, y );
or
video.draw( x, y, w, h );
While drawing a video frame, you can think of the current frame of video as if it were an ordinal ofImage
object. So, you can use the video.width
, video.height
values and set anchor using video.setAnchorPercent( percentX, percentY )
, video.setAnchorPoint( x, y )
, and video.resetAnchor()
.
The following example shows the basic usage of ofVideoPlayer
. It is based on an emptyExample
project in openFrameworks. Before running it, copy the handsTrees.mov
file into the bin/data
folder of your project.
Note
This is example...