Enabling/Disabling Audio or Video Playback Separately

This tutorial describes how to enable/disable audio or video playback.

Purpose

The purpose of this tutorial is to show you how to enable/disable audio or video playback separately in a video clip.

Required Background

The Video Client Overview introduces the video client utilities.

Introduction

You can enable/disable the audio and video separately when playing video clips. This means you can:

  • Watch a video clip without the audio track.

  • Listen only to the audio track of a video clip.

Note: By default, audio and video are enabled.

This functionality is made available through the CVideoPlayerUtility::SetAudioEnabledL() and CVideoPlayerUtility::SetVideoEnabledL() methods.

Using Audio and Video Playback

The following tasks are covered in this tutorial:

Basic Procedure

The high level steps to enable/disable audio or video playback are shown here:

  1. Create a new video player utility object.

  2. Open a video clip to play.

  3. Enable/disable audio playback using the CVideoPlayerUtility::SetAudioEnabledL() method:

    • To enable audio playback set the aAudioEnabled parameter to ETrue.

    • To disable audio playback set the aAudioEnabled parameter to EFalse.

  4. Enable/disable video playback using the CVideoPlayerUtility::SetVideoEnabledL() method:

    • To enable video playback set the aVideoEnabled parameter to ETrue.

    • To disable video playback set the aVideoEnabled parameter to EFalse.

  5. Call the CVideoPlayerUtility::Prepare() method.

  6. Control playback normally.

Example

//Create new video player utility object (iVideoPlayer) 
// Open the video clip

iVideoPlayer->SetAudioEnabledL(EFalse); // disable audio playback

iVideoVideoPlayer->SetVideoEnabledL(ETrue); // enable video playback

// Audio has been disabled
// Playback will be video only
// Call Prepare() and then Play() to control playback normally