Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to use the video player utility


Overview

The Video player utility is used to open, play, and obtain information from sampled video data. This functionality is implemented by the CVideoPlayerUtility class. The video data can be supplied either in a file, a descriptor or a URL.

[Top]


Description

The sequence diagram below explains the different functionalities of the Video Player Utility:

Video Player sequence diagram

Video Player sequence diagram

Using a video player utility involves the following tasks:


Construct utility object and open video source

The MMF provides a simple application level API called CVideoPlayerUtility. Using this interface, you can open, play, and obtain information from sample video data. The source of the video data can be files, descriptors, or URLs. You can create an object of this utility class using the CVideoPlayerUtility::NewL function. Unlike CMdaAudioPlayerUtility, the video clips cannot be opened during instantiation of the CVideoPlayerUtility class. Hence all the video clips must be opened using one of the following open functions:

As the opening of the video clip is complete, successfully or otherwise, the callback function MVideoPlayerUtilityObserver::MvpuoOpenComplete() is called. This notifies the client whether the video clip was successfully opened or not.

Once the video data is ready, call the CVideoPlayerUtility::Prepare() function. when the client receives the MVideoPlayerUtilityObserver::MvpuoPrepareComplete() callback, the video player utility will be in configured state.

To open and automatically play the video clips use the following open functions:

OpenAndPlayFileL(const TDesC& aFileName, TUid aControllerUid=KNullUid);

OpenAndPlayDesL(const TDesC8& aDescriptor, TUid aControllerUid=KNullUid);

OpenAndPlayUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8, TUid aControllerUid=KNullUid);


Configuration information and controls

This section lists different configuration and control related functions. Once the video clip is open and ready to play, configuration adjustments can be made using the following functions:


Video clip properties

This section lists functions used to query and set different properties of the video clip. Using these functions you can query or set properties of the video clip such as bit and frame rate, current playback position, MIME type, and codecs as shown below:

Bit and frame rate

Note: The presence of an audio track within a video clip can be determined using AudioEnabledL().

Current playback position

The current playback position can be queried and set using the following functions:

MIME and Codec type

This section explains the functions that reports and sets the MIME type and codecs for video and audio data that is already open. The functions are as stated below:


Play and related functions

This section explains various functions involved in the video play process. After configuring the properties, the CVideoPlayerUtility::play() function is called for the video clip to be played. The play can be paused for a small duration using CVideoPlayerUtility::pause() and later resumed by calling CVideoPlayerUtility::play() function once again. To halt the video play CVideoPlayerUtility::Stop()is called. In order to unload all related controllers and return, use CVideoPlayerUtility::close()

void CPlayVideo::Play() //Starts playback of the video clip
    {
    iVideoUtility->Play();
    } 

void CPlayVideo::PauseL() //Call to this function will maintain the current position
                         //playback can be resumed by calling Play function again
    {
    TRAPD(err,iVideoUtility->PauseL());
    } 

TInt CPlayVideo::Stop() //Stops playing
    {
    TInt err = iVideoUtility->Stop();
          return err;
    } 

Note: You must call the CVideoPlayerUtility::Prepare() function, before calling any of the functions used in the above given code.

To get the video frame currently being played, use the CVideoPlayerUtility::GetFrameL() function.

void CPlayVideo::GetFrameL(TDisplayMode aDisplayMode) //Returns the current frame
    {
    iVideoUtility->GetFrameL(aDisplayMode);
    } 

The current frame is sent to the client asynchronously via the MVideoPlayerUtilityObserver::MvpuoFrameReady()callback function.


Plug-in control

This section lists functions relevant to controlling the video controller plug-in. Using these functions you can query the progress of the video clip being loaded or rebuffered, and send custom commands to the plug-in directly without using the API.

Video clip loading or rebuffering

To get the progress of video clip loading/rebuffering, use the CVideoPlayerUtility::GetVideoLoadingProgressL() function.

TInt percentage;
percentage = iVideoPlayer->GetVideoLoadingProgressL() \\Returns the progress, as a percentage of video loading.

Custom command

Custom commands are used to pass the message directly to the controller plug-in instead of going through APIs such as Play(), Record(), and so on.

To send a synchronous custom command to the controller, use the CVideoPlayerUtility::CustomCommandSync()function.

To send a asynchronous custom command to the controller, use the CVideoPlayerUtility::CustomCommandAsync()function.