Game Development Reference
In-Depth Information
Pausing, resuming, and stopping video
playback
Again the parallels with the s3eAudio API are apparent when it comes to
controlling video playback. The functions s3eVideoPause , s3eVideoResume ,
and s3eVideoStop all take no parameters and are used to pause, resume, and
finish video clip playback respectively.
End of video notification
We have the choice of polling or callbacks once more for detecting the end of video
playback. Let's start with the polled method that involves a call to the function
s3eVideoIsPlaying , which will return S3E_TRUE if a video is playing or S3E_FALSE
if a video is paused or stopped. Quite simple really!
If we want to use the callback approach, the following code snippet illustrates what
to do:
int32 VideoFinished(void* apSystemData, void* apUserData)
{
// apSystemData will always be NULL as there is no data associated
// with this callback.
// Return value is unimportant.
return 0;
}
// To set up the callback function
s3eVideoRegister(S3E_VIDEO_STOP, (s3eCallback) VideoFinished, NULL);
// And to cancel it again...
s3eVideoUnRegister(S3E_VIDEO_STOP, (s3eCallback) VideoFinished);
The callback will be triggered whenever video playback stops, either because we
explicitly call s3eVideoStop , an error in playback such as a corrupted video file
occurs, or if an audio track is started using s3eAudioPlay . Note that the callback is
not triggered between repetitions of the video clip if we are looping it.
For most games, video clips will probably only be used during introductory
sequences or tutorials, since using video in the game itself is probably not practical.
With this in mind, a polled approach for detecting when a video clip is finished is
normally sufficient.
 
Search WWH ::




Custom Search