×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    3

    Audio Player in J2ME

    Hi,
    I am new to J2ME. I want to play an audio song in my application. I have written

    Code:
     
                   Player p = null;
    				
    		try {			
    			p = Manager.createPlayer(getClass().getResourceAsStream("aa.wav"),"audio/x-wav");
    			p.start();
    			
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		} catch (MediaException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    where "aa.wav" is a wav format song placed in resource folder. when i debug this code
    Code:
    Manager.createPlayer(getClass().getResourceAsStream("aa.wav"),"audio/x-wav");
    return null.

    Can you please Help me thanks

  2. #2
    Registered User
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868

    Re: Audio Player in J2ME

    Hi Hassan Ashraf ,

    Welcome to Forum Nokia Discussion Board!!
    Manager.createPlayer(getClass().getResourceAsStream("/aa.wav"),"audio/x-wav");
    Please change this code and try . Reading of the file is wrong. it should be /aa.wav

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    3

    Re: Audio Player in J2ME

    I have use this code. It is gettting data. But player didnot start song. Can you please Help

    Code is:

    Form m = new Form("aaa");
    m.show();

    InputStream is = getClass().getResourceAsStream("/aa.wav");

    Player p = null;

    try {

    p = Manager.createPlayer(is,"audio/x-wav");
    p.realize();
    p.start();

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

    Console Error or exception is:

    []
    JVMJNCK001I JNI check utility installed. Use -Xcheck:jni:help for usage
    IBM J9 2.3 Symbian x86-32 (JIT disabled)
    J9VM - 20071105_14638_lHdFGV
    GC - 200710_17
    MIDlet: MIDlet-1
    JVMJNCK038E JNI error in FromReflectedMethod: Argument #2 (0x4EC5EDD0) is not a valid object reference. It's type is: unknown

    JVMJNCK080E Error detected in the outermost frame of an attached thread

    JVMJNCK023E JNI error detected. Continuing...
    javax.microedition.media.MediaException: Prefetch error: -5
    at com.nokia.microedition.media.PlayerImpl.doPrefetch(PlayerImpl.java:211)
    at com.nokia.microedition.media.SourcePlayer.doPrefetch(SourcePlayer.java:92)
    at com.nokia.microedition.media.PlayerBase.prefetch(PlayerBase.java:161)
    at com.nokia.microedition.media.PlayerImpl.start(PlayerImpl.java:247)
    at com.urfilez.ui.PlayerClass.abc(Unknown Source)
    at com.urfilez.Start.startApp(Unknown Source)
    at javax.microedition.midlet.MIDletInvoker.invokeStartApp(MIDletInvoker.java:30)
    at com.symbian.j2me.midp.runtimeV2.Application.startAction(Application.java:520)
    at com.symbian.j2me.midp.runtimeV2.Application.startRequest(Application.java:447)
    at com.symbian.j2me.midp.runtimeV2.Application.event(Application.java:298)
    at com.symbian.j2me.midp.runtimeV2.ApplicationEvent.dispatch(ApplicationEvent.java:90)
    at com.symbian.j2me.midp.runtimeV2.ApplicationThread.run(ApplicationThread.java:30)


    Can you please help. What should i do know. It opens page but didn't play song

  4. #4
    Registered User
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868

    Re: Audio Player in J2ME

    Hi Hassan Ashraf ,

    Go through the code samples in forum nokia wiki section . It will helps you how to use the MMAPI.

    http://wiki.forum.nokia.com/index.ph...media_Articles
    http://wiki.forum.nokia.com/index.ph...one_in_Java_ME

Similar Threads

  1. audio player not working in handset
    By nathviswa in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2010-12-29, 08:11
  2. j2me audio streaming in audio call
    By wasantha.uwu in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2010-06-08, 11:33
  3. add multiple file in default audio player.
    By ashutosh12 in forum Symbian
    Replies: 3
    Last Post: 2008-11-03, 13:03
  4. Audio player plugin example in 3.1
    By kakakakaka in forum Symbian
    Replies: 1
    Last Post: 2008-07-09, 11:39
  5. J2me mobile audio player
    By Onesizefitsall in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2007-10-15, 04:48

Posting Permissions

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