×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    9

    MediaException Error when Playing mp3 files

    Hi,

    im had write a method which play mp3 files. This works, but at run time, in get every time an exception:

    javax.microedition.media.MediaException: AUD
    at com.nokia.mid.impl.isa.mmedia.audio.AudioOutImpl.openSession(+25)
    at com.nokia.mid.impl.isa.mmedia.MediaOut.openDataSession(+29)
    at com.nokia.mid.impl.isa.mmedia.MediaPlayer.doPrefetch(+66)
    at com.nokia.mid.impl.isa.amms.audio.AdvancedSampledPlayer.doPrefetch(+4)
    at com.nokia.mid.impl.isa.mmedia.BasicPlayer.prefetch(+64)
    at com.nokia.mid.impl.isa.mmedia.BasicPlayer.start(+56)
    at Nutrition.playSound(+61)
    at Nutrition$17.actionPerformed(+43)
    at com.sun.lwuit.util.EventDispatcher.fireActionSync(+24)
    at com.sun.lwuit.util.EventDispatcher.fireActionEvent(+92)
    at com.sun.lwuit.Button.fireActionEvent(+73)
    at com.sun.lwuit.Button.released(+20)
    at com.sun.lwuit.Button.keyReleased(+16)
    at com.sun.lwuit.Form.keyReleased(+114)
    at com.sun.lwuit.Display.handleEvent(+85)
    at com.sun.lwuit.Display.edtLoopImpl(+113)
    at com.sun.lwuit.Display.mainEDTLoop(+176)
    at com.sun.lwuit.RunnableWrapper.run(+245)

    I think it could deal with memory consumption, but don't have an idea where i could free memory there:


    [java]

    void playSound(String pathToSound)
    {
    InputStream in = this.getClass().getResourceAsStream(pathToSound);
    Player p = null;


    try {

    if(in != null ){

    try {
    p = Manager.createPlayer(in, "audio/mp3");


    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    catch (MediaException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    // p.deallocate();

    if(!(p.getState() == Player.STARTED ))


    p.start();
    }



    } catch (MediaException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }



    }

    [/java]


    Thx

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: MediaException Error when Playing mp3 files

    What device are you using?

    How big is the MP3?

    Have you checked that the MIME type you are using is listed by the device as supported? Try:

    Code:
    String[] supportedTypes = Manager.getSupportedContentTypes(null);
    Graham.

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    9

    Re: MediaException Error when Playing mp3 files

    Hi,

    thx for reply.

    My device is a Nokia 6212 classic. The size of file is between 10-50 kb.

    With
    String[] supportedTypes = Manager.getSupportedContentTypes(null);
    i get

    [Ljava.lang.Object;@1f02322a

    Maybe an out of memory exception, let crush the midlet, becouse this Media exception
    Last edited by Nunu008; 2011-02-10 at 14:46.

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: MediaException Error when Playing mp3 files

    OK... you need to look at the contents of the array, to see what's in it.

    Graham.

Similar Threads

  1. Problem with playing mp3 files
    By giaviv in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2010-03-16, 10:45
  2. MediaException when loading MP3
    By cjohnstone in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2008-03-04, 00:27
  3. Playing Mp3 and aac files
    By amitaggarwal in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2004-03-08, 07:59
  4. Playing MP3 files
    By pawans in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2003-03-31, 16:59

Posting Permissions

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