×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    12

    CMdaAudioPlayerUtility KErrInUse

    Hi!

    I've created an audio player application. My player derives from MMdaAudioPlayerCallback and instantiates a CMdaAudioPlayerUtility object as follows:

    iPlayer=CMdaAudioPlayerUtility::NewL(*this,EMdaPriorityMax);

    The user can select any of the following options when this application is opened:

    -Play(plays file if already selected OR prompts to select a file)
    -Pause
    -Stop
    -Open File (drop down menu to select a file)

    I try to play mp3 files (using inbuilt Nokia mp3 controller/decoder plugins). The player selects a file successfully and MapcInitComplete returns KErrNone. However when I try to Play, MapcPlayComplete returns KErrInUse most often(though on some tries it has played!!)

    I even tried setting EMdaPriorityPreferenceTime/EMdaPriorityPreferenceQuality. Capability is ALL -TCB.

    This problem arises on the target (it works fine on the emulator).

    I am using S60_5th_Edition_SDK_v0.9

    How can I get rid of KErrInUse??

    Any suggestions would be appreciated. Thanks!!!

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: CMdaAudioPlayerUtility KErrInUse

    close the file and delete any instance of the player after you have done with it, so the file is not left open, also check that other apps are not keeping the file open.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    12

    Re: CMdaAudioPlayerUtility KErrInUse

    hi! thanks!

    in the destructor i am doin Stop() and Close() on the file and then destroy the iPlayer.

    how would i knw if other applications keep the file open? there is a media gallery(inbuilt) which can play mp3 songs. Is tht causing a problem?

    I will check it nevertheless.Thanks agn!

  4. #4
    Registered User
    Join Date
    Dec 2008
    Posts
    12

    Unhappy Re: CMdaAudioPlayerUtility KErrInUse

    hi yucca!

    i restarted the target and opened my application (before opening any other). But i still get the KErrInUse.

    how do check if other apps have opened any mp3 file? (if an application like media gallery hasnt been opened, it wudnt hv the file open either, is it not?)

    thanks!

  5. #5
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: CMdaAudioPlayerUtility KErrInUse

    Hi,

    Which phone are you using? Is it a 5th Edition device (if not you're using the wrong SDK and that might be the problem).

    It's nothing to do with other apps doing something with mp3s, it's about competing for the audio device. Something else in the phone is using audio - is it something else in your application? Have you got any other 3rd party applications running?

    This really shouldn't be happening. It works fine on all the devices I've ever tried.

    Sorcery

  6. #6
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    95

    Re: CMdaAudioPlayerUtility KErrInUse

    hi,
    1.)i dont understand why r u setting its priorty as max...
    2.)use 3rd edition sdk...i dont know which mobile u r using...ur SDK must be compatible with ur mobile.
    3.)MapcPlayComplete() which is the CMdaAudioPlayerUtility class function returns callback of stoping the song not playing has been started while MapcInitComplete () returns callback of that playing has been started ...then the point is why r u getting error in MapcPlayComplete()...it must return error in MapcInitComplete()if its not playing the song...


    4)ur class must me somewhat like this:

    MapcPlayComplete()//function of observer class
    {
    Stop();//called through object of CMdaAudioPlayerUtility
    }

    MapcInitComplete ()//function of observer class
    {
    Play(); //called through object of CMdaAudioPlayerUtility
    }

    5.) no capabilities are required to play the song.

    6.) u cannot check it on emulator

  7. #7
    Registered User
    Join Date
    Dec 2008
    Posts
    12

    Re: CMdaAudioPlayerUtility KErrInUse

    Hi!

    Sorcery, i am using a 5th ed phone (development board).

    Neelsoft,
    1.)i was settin priority to max since KErrInUse means a higher priority application is using the sound device. hence i wanted to raise my priority
    2.)i'm using OSv9.5 (my company has a development board for a 5th ed phone)
    3.)4.)As i mentioned earlier, the functionality that i want my player to have is :
    - when u select OpenFile, a new file is opened and initialised
    -when u press Play, the opened file plays/or/ if no file was selected, user is prompted to select a file

    hence, i do not want to call Play in MapcInitComplete. I just set the state to EReady. When play is pressed, it checks the state is EReady and plays. If MapcPlayComplete is successful, i set the State to EReady again.

    5.) "no capabilities are required to play the song." (Ok thanks!)

    6.) "u cannot check it on emulator" (i was playing .wav files on emulator )

    I will look into my player once again and get back to you tomorrow. Thanks a lot for your help!

  8. #8
    Regular Contributor
    Join Date
    Apr 2008
    Location
    India
    Posts
    477

    Re: CMdaAudioPlayerUtility KErrInUse

    if u can show some code snippet then it will be helpful for us to solve ur problem...

    Thanx and Regards,
    pawan

  9. #9
    Registered User
    Join Date
    Dec 2008
    Posts
    12

    Re: CMdaAudioPlayerUtility KErrInUse

    hi!

    i tried what neelsoft said abt doin Play in MapcInitComplete and that worked fine. so i modified my utility such that everytime i want to play i do

    OpenFileL
    --------------MapcInitComplete{ PlayL}
    PlayL
    ---------------MapcPlayComplete{ StopL}

    But once i do Pause and then try to resume Play, again i get KErrInUse. (So im saving the position and doin OpenFileL and Play with the saved position as a work around for the problem).

    Can anyone tell me why my player plays only just after it has been initialised?

  10. #10
    Regular Contributor
    Join Date
    Apr 2008
    Location
    India
    Posts
    477

    Re: CMdaAudioPlayerUtility KErrInUse

    how r u pausing and playing the song... can u plz describe...

  11. #11
    Registered User
    Join Date
    Dec 2008
    Posts
    12

    Re: CMdaAudioPlayerUtility KErrInUse

    hi pawan!

    What i was trying to do was:

    void PauseL()
    {
    if (iState==EPlaying)
    {
    iPlayer->GetPosition(iPosition);
    iPlayer->Pause();
    iState=EPaused;
    }
    }

    and in PlayL
    {
    if (iState==EPaused)
    {
    iPlayer->SetPosition(iPosition);
    iState=EPlaying;
    iPlayer->Play();
    }

    Since the Play was returnin KErrInUse, now what i do is in PlayL, i close the file and call OpenFileL again, SetPosition and then Play. That works alrite.

    Thanks!
    Last edited by imradhika28; 2008-12-15 at 12:18.

  12. #12
    Regular Contributor
    Join Date
    Apr 2008
    Location
    India
    Posts
    477

    Re: CMdaAudioPlayerUtility KErrInUse

    i dont know whts happening to the play and pause of the song as it is pretty simple.... if u are pausing the song then ur framework will take care of the position of the song and when u say play() again it will start play again from the same position...
    why dont u try with NewFilePlayerL() API of the same class....

    because i read the SDK and found....
    NewL():
    Constructs and initialises a new instance of the audio player utility.
    The function leaves if the audio player utility object cannot be created.
    No callback notification is made upon completion of NewL().
    Last edited by pawan_G; 2008-12-15 at 12:43.

  13. #13
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    95

    Re: CMdaAudioPlayerUtility KErrInUse

    i m not able to understand ur problem..
    r u not able to pause the player and get it resumed back from same position....or u want to resume play after pause without calling the OpenFileL() ..plz make it clear..

  14. #14
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    95

    Re: CMdaAudioPlayerUtility KErrInUse

    hi,
    plz also be sure that u r getting correct state....otherwise it will not work..



    try out Duration()...i m not sure ..
    plz reply..

Similar Threads

  1. CMdaAudioPlayerUtility help
    By aayushgarg in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2006-11-30, 11:03
  2. CMdaAudioPlayerUtility class help
    By aayushgarg in forum Symbian
    Replies: 2
    Last Post: 2006-11-28, 06:07
  3. CMdaAudioPlayerUtility n CMdaAudioPlayerUtility
    By Shilpa13 in forum Symbian User Interface
    Replies: 5
    Last Post: 2006-11-18, 13:44
  4. sound && CMdaAudioPlayerUtility Help
    By qibinyi in forum Symbian
    Replies: 1
    Last Post: 2003-08-07, 03:51
  5. sound && CMdaAudioPlayerUtility Help
    By qibinyi in forum Symbian
    Replies: 2
    Last Post: 2003-08-06, 12:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×