class methods
- ~ofBaseVideoPlayer()
- firstFrame()
- getCurrentFrame()
- getDuration()
- getHeight()
- getIsMovieDone()
- getLoopState()
- getPosition()
- getSpeed()
- getTexturePtr()
- getTotalNumFrames()
- getWidth()
- isInitialized()
- isLoaded()
- isPaused()
- isPlaying()
- load()
- loadAsync()
- nextFrame()
- play()
- previousFrame()
- setFrame()
- setLoopState()
- setPaused()
- setPosition()
- setSpeed()
- setVolume()
- stop()
Extends
This class extends others, you can call their methods on an instance of ofBaseVideoPlayer too:
Documentation from code comments
A base class representing a video player.
~ofBaseVideoPlayer()
ofBaseVideoPlayer::~ofBaseVideoPlayer()
Documentation from code comments
Destroys the ofBaseVideoPlayer.
firstFrame()
void ofBaseVideoPlayer::firstFrame()
Documentation from code comments
Set the playhead position to the first frame.
This is functionally equivalent to setFrame(0) or setPosition(0.0).
getCurrentFrame()
int ofBaseVideoPlayer::getCurrentFrame()
Documentation from code comments
Get the current playhead position as a frame number.
Returns: The current playhead position as a frame number.
getDuration()
float ofBaseVideoPlayer::getDuration()
Documentation from code comments
Get the duration of the loaded video in seconds.
Returns: The duration of the loaded video in seconds.
getHeight()
float ofBaseVideoPlayer::getHeight()
Documentation from code comments
Get the height in pixels of the loaded video.
Returns: The height in pixels of the loaded video or 0 if none is loaded.
getIsMovieDone()
bool ofBaseVideoPlayer::getIsMovieDone()
Documentation from code comments
Returns true if the loaded video has finished playing.
Returns: True if the loaded video has finished playing.
getLoopState()
ofLoopType ofBaseVideoPlayer::getLoopState()
Documentation from code comments
Get the current loop state of the video.
See also: ::ofLoopType
getPosition()
float ofBaseVideoPlayer::getPosition()
Documentation from code comments
Get the current playhead position of the loaded video.
This value is a normalized floating point value between 0.0 and 1.0 that represents the position of the playhead. 0.0 maps to the first frame of the loaded video and 1.0 maps to the last frame of the loaded video.
Returns: A value between 0.0 and 1.0 representing playhead position.
getSpeed()
float ofBaseVideoPlayer::getSpeed()
Documentation from code comments
Get the playback speed of the video player.
When the loop state is OF_LOOP_NONE or OF_LOOP_NORMAL, positive speed will scale a forward playback rate while a negative speed will scale a a backward playback rate. When the loop state is OF_LOOP_PALINDROME, the direction of playback will change each loop, but the playback rate will still be scaled by the absolute value of the speed.
Returns: The playback speed of the video player.
getTexturePtr()
ofTexture * ofBaseVideoPlayer::getTexturePtr()
Documentation from code comments
Get a pointer to the video texture used internally if it exists.
If the video player implementation supports direct-to-texture rendering, this method will return a pointer to the internal texture. If direct-to-texture rendering is not supported, nullptr is returned.
Returns: A valid pointer to the internal texture, otherwise a nullptr.
getTotalNumFrames()
int ofBaseVideoPlayer::getTotalNumFrames()
Documentation from code comments
Get the total number of frames in the currently loaded video.
Returns: The total number of frames in the currently loaded video.
getWidth()
float ofBaseVideoPlayer::getWidth()
Documentation from code comments
Get the width in pixels of the loaded video.
Returns: The width in pixels of the loaded video or 0 if none is loaded.
isInitialized()
bool ofBaseVideoPlayer::isInitialized()
Documentation from code comments
Returns true if a video is loaded.
This is helpful when loading a video with loadAsync(). This is also an alias of isLoaded().
See also: loadAsync()
Returns: True if a video is loaded.
isLoaded()
bool ofBaseVideoPlayer::isLoaded()
Documentation from code comments
Returns true if a video is loaded.
This is helpful when loading a video with loadAsync(). This is also an alias of isInitialized().
See also: loadAsync()
Returns: True if a video is loaded.
isPaused()
bool ofBaseVideoPlayer::isPaused()
Documentation from code comments
Returns true if the video is paused.
Returns: True if the video is paused.
isPlaying()
bool ofBaseVideoPlayer::isPlaying()
Documentation from code comments
Returns true if the loaded video is playing.
Returns: True if the loaded video is playing.
load(...)
bool ofBaseVideoPlayer::load(string name)
Documentation from code comments
Load a video resource by name.
The list of supported video types and sources (e.g. rtsp:// sources) is implementation dependent.
Parameters:
name The name of the video resource to load.
Returns: True if the video was loaded successfully.
See also: loadAsync()
loadAsync(...)
void ofBaseVideoPlayer::loadAsync(string name)
Documentation from code comments
Asynchronously load a video resource by name.
The list of supported video types and sources (e.g. rtsp:// sources) is implementation dependent.
When this method is used to load a video resouce, users can determine when the video is loaded by calling isLoaded().
Parameters:
name The name of the video resource to load.
See also: isLoaded()
nextFrame()
void ofBaseVideoPlayer::nextFrame()
Documentation from code comments
Advance the playhead forward one frame.
This allows the user to advance through the video manually one frame at a time without calling play().
play()
void ofBaseVideoPlayer::play()
Documentation from code comments
Play the video from the current playhead position.
See also: getPosition()
See also: setPostion()
previousFrame()
void ofBaseVideoPlayer::previousFrame()
Documentation from code comments
Advance the playhead backward one frame.
This allows the user to advance backward through the video manually one frame at a time without calling play().
setFrame(...)
void ofBaseVideoPlayer::setFrame(int frame)
Documentation from code comments
Set the current frame by frame number.
Similar to setPosition(), but accepts a frame number instead of a normalized floating point value. Frame count begins with the first frame as 0 and the last frame as getTotalNumFrames() - 1.
Parameters:
frame The frame number to set the new playhead to.
setLoopState(...)
void ofBaseVideoPlayer::setLoopState(ofLoopType state)
Documentation from code comments
Set the video loop state.
Parameters:
state The loop state of the video.
See also: ::ofLoopType
setPaused(...)
void ofBaseVideoPlayer::setPaused(bool bPause)
Documentation from code comments
Set the paused state of the video.
Parameters:
bPause True to pause the video, false to play.
setPosition(...)
void ofBaseVideoPlayer::setPosition(float pct)
Documentation from code comments
Set the position of the playhead.
This value is a normalized floating point value between 0.0 and 1.0 that represents the position of the playhead. 0.0 maps to the first frame of the loaded video and 1.0 maps to the last frame of the loaded video.
Parameters:
pct A value between 0.0 and 1.0 representing playhead position.
setSpeed(...)
void ofBaseVideoPlayer::setSpeed(float speed)
Documentation from code comments
Set the video playback speed.
When the loop state is OF_LOOP_NONE or OF_LOOP_NORMAL, positive speed will scale a forward playback rate while a negative speed will scale a a backward playback rate. When the loop state is OF_LOOP_PALINDROME, the direction of playback will change each loop, but the playback rate will still be scaled by the absolute value of the speed.
To play a video forward at normal speed, set the loop state to OF_LOOP_NONE or OF_LOOP_NORMAL and a speed of 1.0. To double the playback rate, set the speed to 2.0. To play a video backward, set the speed to a negative number. A speed 0.25 will play the video at 1/4 the the normal rate and a rate of 0.0 will effectively stop playback.
Parameters:
speed The desired playback speed of the video.
setVolume(...)
void ofBaseVideoPlayer::setVolume(float volume)
Documentation from code comments
Set the volume of the video player.
This value is a normalized floating point value between 0.0 and 1.0 that represents the video player volume. 0.0 maps to silence and 1.0 maps to maximum volume.
Parameters:
volume A value between 0.0 and 1.0 representing volume.
stop()
void ofBaseVideoPlayer::stop()
Documentation from code comments
Pause and reset the playhead position to the first frame.
Last updated Tuesday, 19 November 2024 17:25:07 UTC - 2537ee49f6d46d5fe98e408849448314fd1f180e
If you have any doubt about the usage of this module you can ask in the forum.
If you want to contribute better documentation or start documenting this section you can do so here
If you find anything wrong with this docs you can report any error by opening an issue