Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Using MPX Playback Utility Symbian API

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleTested with
Devices(s): Tested on: Nokia N97,
Nokia N97 Mini, Nokia X6
Platform(s): S60 5th Edition
S60 5th Edition
Keywords: MMPXPlaybackUtility
Created: User:Kbwiki (23 Nov 2010)
Last edited: hamishwillee (01 Aug 2012)


MPX architecture provides clear and simple high level interfaces for multiple clients to manage collections, audio playback, and user interfaces. MMPXPlaybackUtility is an interface for the playback of audio content. Through this utility, clients can start the playback of media, retrieve the current playback state, retrieve playback properties such as volume and position, and send commands to control playback such as pause, stop, seek forward, backward, or skip to next track. Clients can retrieve other interfaces including MMPXPlayer and MMPXSource from the MMPXPlaybackUtility API. On the other hand, the class MMPXPlaybackObserver provides message and event call back respectively. The code below shows how to start the playback of a song.


The MPX APIs plug-in pack must be installed. It is available at:


  // MPXPlayback.h 
#include <mpxplaybackutility.h>
#include <mpxplaybackobserver.h>
#include <mpxmessagegeneraldefs.h>
#include <mpxplaybackmessage.h>
// Class declaration
class CMPXPlayback : public CBase, public MMPXPlaybackObserver
// Creates and Initializes the utility class with a song
void InitalizeL();
// From MMPXPlaybackObserver
void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
MMPXPlaybackUtility* iPlaybackUtility;
// Constructor
iPlaybackUtility = NULL;
// Destructor
if (iPlaybackUtility)
TRAP_IGNORE( iPlaybackUtility->CommandL( EPbCmdClose ) );
delete iPlaybackUtility;
iPlaybackUtility = NULL;
void CMPXPlayback::InitalizeL()
iPlaybackUtility = MMPXPlaybackUtility::NewL(KPbModeDefault);
// Add observer
iPlaybackUtility->AddObserverL(*this );
// Inititialises with a single item
//callback from MMPXPlaybackObserver, Handling Playback messages
void CMPXPlayback::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )
TMPXMessageId id(*aMessage->Value<TMPXMessageId>(KMPXMessageGeneralId));
// Get the current event
TInt event(*aMessage->Value<TInt> (KMPXMessageGeneralEvent));
TInt type(*aMessage->Value<TInt> (KMPXMessageGeneralType));
TInt data(*aMessage->Value<TInt> (KMPXMessageGeneralData));
// send the Play/Pause toggle command

A sample application can be downloaded from:

This page was last modified on 1 August 2012, at 04:41.
124 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.