You Are Here:

Community: Wiki

This page was last modified on 6 September 2009, at 18:52.

Audio Playback APIs

From Forum Nokia Wiki

Reviewer Approved   


The MMF(Multimedia Framework) provides a simple API for audio playback that is independent of the format or type of audio being played. The same API is used for playback of both local and streaming contents and is supported by the following classes:

--CMdaAudioPlayerUtility - The Audio Player API that supports audio playback operations and simple metadata retrieval operations.This class provides most of the audio playback operations and supports both local audio playback and streaming audio playback. Other than audio playback operations, this class also provides methods for more advanced operations such as metadata information retrieval and audio balancing.

--MMdaAudioPlayerCallback - The Callback API for the CMdaAudioPlayerUtility class that reports errors and notifies the application of the status of file-open operations or when play has completed.This class is a mixing class that provides feedback to applications that make use of the CMdaAudioPlayerUtility class. It is responsible for notifying the application about any error situations that occur during file opening and playback.

These classes are found in the MediaClientAudio.lib library.

Header files.

#include <MdaAudioSamplePlayer.h>

Libraries.

LIBRARY        mediaclientaudio.lib

Audio Playback Operations: The following operations are done using CMdaAudioPlaybackUtility class:

  • Select a file to be played.
  • Start audio playback.
  • Change playback volume.
  • Pause playback.
  • Stop playback.
  • Query metadata information.

Note that since all operations in the CMdaAudioPlaybackUtility class are asynchronous operations, it is necessary to inherit from MMdaAudioPlayerCallback so that the audio playback operations can be observed. The observer callback API consists of the following two methods:

void MapcInitComplete(TInt aError, const TTImeIntervalMicroSeconds& aDuration);
void MapcPlayComplete(TInt aError);


The callback methods will be invoked after playback initialization is completed and when the audio track playback is completed. In order to carry out the playback operations, it is first necessary to create an instance of the CMdaAudioPlayerUtility class using:

CMdaAudioPlayerUtility* iPlayer = CMdaAudioPlayerUtility::NewL(*this);
iPlayer->OpenFileL( aFilename);
iPlayer->OpenDesL( aDescriptor);
iPlayer->OpenUrlL( aUrl );

The above file-open operations can be done in the other way as well(like as follows):

CMdaAudioPlayerUtility* iPlayer = 
CMdaAudioPlayerUtility::NewFilePlayerL(aFilename, *this);
 
CMdaAudioPlayerUtility* iPlayer =
CMdaAudioPlayerUtility::NewDesPlayerL(aDescriptor, *this);
 
CMdaAudioPlayerUtility* iPlayer =
CMdaAudioPlayerUtility::NewDesPlayerReadOnlyL(aDescriptor, *this);


After file-open operations are completed, then playback operation can be started and playback operation properties can be set.

iPlayer->Play();
iPlayer->SetVolume( aVolume );
iPlayer->SetRepeats( aRepeatNumberOfTimes, aTrailingSilenceMicroSeconds );
iPlayer->SetVolumeRamp( aRampDuration );
iPlayer->SetPriority( aPriority );
iPlayer->SetPosition( aPositionMicroSeconds );


To query the playback information of the opened audio clip:

TTimeIntervalMicroSeconds aDuration = iPlayer->Duration();
TTimeIntervalMicroSeconds apposition = iPlayer->Position();
TInt aVolume = iPlayer->MaxVolume();


Playback is paused, resumed, stopped and closed using:

iPlayer->Pause();
iPlayer->Play();
iPlayer->Stop();
iPlayer->Close();



Links

Audio Recording APIs

Full Duplex Audio

Audio Proxy Server

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fProfilesE5fE45ngineE5fE45E78tendedE5fAPIX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxProfilesE20E45ngineE20E45E78tendedE20APIE20E2dE20ForumE20NokiaE20WikiX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2fX qfnZtopicQUqfnTopicZaudioQRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtopicQUqfnTopicZmultimediaQRqmarsZrelevanceQNx100X qfnZtopicQUqfnTopicZseriesE5f60QRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZupdatedQDx2008E2d10E2d02X qfnZuserE5ftagQSxaudioX qfnZuserE5ftagQSxmultimediaX qfnZuserE5ftagQSxs60X qmarsZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ