Please help..can not play audio with CMdaAudioPlayerUtility

Login to reply to this topic.
Mon, 2008-05-12 14:27
Joined: 2008-05-12
Forum posts: 3

Hi All

I want to play an audio file wav or mp3 with the use of CMdaAudioPlayerUtility but I don't know why it doesn't play it.
I wrote a class called AudioTest

and in AudioTest.h :

class CAudioTest : public CBase,public MMdaAudioPlayerCallback

.
.

private:
enum TState
{
ENotReady,
EReady,
EPlaying
};

TState iState;

and in AudioTest.cpp:

void CAudioTest::Play()
{
if(iState==EReady)
{
iState=EPlaying;
iMdaPlayer->Play();
}

and for implementation of metthods of MMdaAudioPlayerCallback I wrote like this:

void CAudioTest::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
{
iState = aError ? ENotReady : EReady;
}

void CAudioTest::MapcPlayComplete(TInt aError)
{
iState = aError ? ENotReady : EReady;
}

the program runs without error but it doesnt play the audio file,and I realizad that I can not enter to if statement in function CAudioTest::Play() and the reason is because CAudioTest::MapcInitComplete(..) is not called,but I have read that it is called automatically,please help me to know that.


Mon, 2008-05-12 15:41
Joined: 2003-12-05
Forum posts: 587
Re: Please help..can not play audio with CMdaAudioPlayerUtility

Care to show how you actually select the file to be played etc.? Have you checked out any of the examples of using CMdaAudioPlayerUtility?

Mon, 2008-05-12 15:56
Joined: 2008-05-12
Forum posts: 3
Re: Please help..can not play audio with CMdaAudioPlayerUtility

void CAudioTest::ConstructL()
{

iMdaPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(KFilename, *this);
}
that KFilename is _LIT(KFilename,"C:\\Documents and Settings\\audio.wav"); for example

but I have not checked out any example of CMdaAudioPlayerUtility ,I found one (sound1 )in this site but it is gui and I don't undersatnd the gui application structure..

Mon, 2008-05-12 18:26
Joined: 2003-12-05
Forum posts: 587
Re: Please help..can not play audio with CMdaAudioPlayerUtility

And does NewFilePlayerL succeed or not? Does it leave? I guess that with the path you showed as an example it will - the windows paths are not usable in the emulator. The emulator emulates the C: drive in [your-sdk-installation-path]\epoc32\winscw\c. So if you try to open a file in your Symbian application from c:\MyFile.txt, in the PC that is actually in my case, for example, located in: F:\Symbian\9.2\S60_3rd_FP1_2\Epoc32\winscw\c\MyFile.txt.

Mon, 2008-05-12 19:34
Joined: 2008-05-12
Forum posts: 3
Re: Please help..can not play audio with CMdaAudioPlayerUtility

Thanks Andreas for the reply.

Mon, 2008-05-19 06:57
Joined: 2008-04-23
Forum posts: 34
Re: Please help..can not play audio with CMdaAudioPlayerUtility

hi,
you go through the SDK documentation you will find the answer.


ravinder singh rawat

  • Login to reply to this topic.