×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    27

    Question Error playing sound (wav).

    Hi all, I'm having problems right now trying to play my sound.. This is the code..

    Code:
     try {
          InputStream in = getClass().getResourceAsStream("/relax.wav");
          Player player = Manager.createPlayer(in, "audio/x-wav");
          player.start();
        } catch (Exception e) {
          showException(e);
          return;
        }
    When I used a internet url for streaming the wav file as an argument in getResourceAsStream(); it worked fine, but when i try to use the local wav file it gave me an error (IllegalArgumentException). I don't know if the path is fine, according to "/relax.wav" the file should be located in the 'res' folder which is added as a Resource Path in the MIDlet's configuration? If not, where should I put the file?

    Thanks in Advance,
    Regards,

    Armando León

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: Error playing sound (wav).

    Hello lparmy,

    well using res folder for the purpose should work...

    Do you get the Exception if you place the audio file on same folder together with src code and modify the code as follows?:

    InputStream in = getClass().getResourceAsStream("relax.wav");


    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

Similar Threads

  1. Replies: 1
    Last Post: 2009-08-06, 05:12
  2. Help! Playing wav files error in 6600
    By brianmei in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2004-07-01, 10:39
  3. Playing wav
    By sseres in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2003-12-30, 03:29
  4. nokia sound api and playing wav on 6800 (series 40)(?)
    By maxxxis in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2003-07-14, 19:23
  5. Playing wav sound with the nokia api
    By yuvalgeva in forum Mobile Java General
    Replies: 0
    Last Post: 2002-12-18, 12:50

Posting Permissions

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