×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    12

    MediaException when loading MP3

    I'm trying to import a .mp3 file but I'm hitting a MediaException. I'm using:

    InputStream audioSource = getClass().getResourceAsStream(fileLocation);
    Player audio = Manager.createPlayer(audioSource,"audio/mp3");

    Can anyone spot any faults / things I should be doing different? The file definitely exists and is definitely an MP3 file.

  2. #2
    Registered User
    Join Date
    Feb 2008
    Posts
    12

    Re: MediaException when loading MP3

    Okay, I can get it to load and play using a WAV file. Any suggestions on how to get it working with an MP3?

  3. #3
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,429

    Re: MediaException when loading MP3

    As the API docs says, MediaException will be thrown if a Player cannot be created for the given stream and type. Which phone are you using ?

    Give a try with the mime type "audio/mpeg" ?

    Also have a look at MIDP: Mobile Media API Support In Nokia Devices v2.0

    MIDP: Mobile Media API Developer's Guide v2.1

    Regards
    Gopal

  4. #4
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    220

    Re: MediaException when loading MP3

    Hi,

    may i know which phone your are trying and what exactly is the exception message.

    as you mentioned, if you can run the WAV file then its sure that there is no issue as far as the file reading and player creation logic is concerned.

    the possible ghosts may be the mime type or your phone's media support!

    Regards

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    12

    Re: MediaException when loading MP3

    It's the Java Wireless toolkit emulator.

    I will try changing the type to MPEG, shortly.

  6. #6
    Registered User
    Join Date
    Feb 2008
    Posts
    12

    Re: MediaException when loading MP3

    No success with mpeg on the J2ME WTK emulator. WAV is all that will seem to work.

    I can't get the Nokia emulator to run (JAR file could not be initialized), so I have no way to test it with that.

Similar Threads

  1. Compilation series 60 3rd edition
    By asmobease in forum Symbian Tools & SDKs
    Replies: 32
    Last Post: 2006-09-13, 09:46
  2. Compilation series 60 3rd edition
    By asmobease in forum Symbian
    Replies: 3
    Last Post: 2006-09-10, 14:08

Posting Permissions

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