Controlling Video Playback

This tutorial describes how to control video playback.

Purpose

The purpose of this tutorial is to show you how to use the video player to control video playback.

Required Background

The Video Client Overview introduces the video client utilities.

Introduction

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.

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

Figure 1. Video Player sequence diagram

Using Video Player

The following tasks will be covered in this tutorial:

Playing Video Clips

The high level steps to play video clips are shown here:

  1. After configuring the properties, the CVideoPlayerUtility::Play() function is called for the video clip to be played.

  2. The play can be paused for a small duration using CVideoPlayerUtility::PauseL() and later resumed by calling CVideoPlayerUtility::Play() function once again.

  3. To halt the video play CVideoPlayerUtility::Stop() is called.

  4. In order to unload all related controllers and return, use CVideoPlayerUtility::Close() .

These high level steps are shown in the following example code:

       
        
       
       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.

Getting the Current Frame

The high level steps to get the current frame are shown here:

  1. 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);
        }
            
  2. The current frame is sent to the client asynchronously via the MVideoPlayerUtilityObserver::MvpuoFrameReady() callback function.