Can anyone help this engineering student to continue his j2me project?

Hi...Im doing project in J2ME...I got struck up in one module due to the problem of playing audio files..I wrote code and its playing fine in audio files like test-wav.wav and bark.wav..But if i use anyother audio file instead of test-wav.wav with the format like .mp3 and .wav...its playing but I cant hear the audio..I don know wat was the problem... i hav sent my code..Plz share ur idea and help me..The following code only im using now...

import java.io.*;

import javax.microedition.io.*;

import javax.microedition.lcdui.*;

import javax.microedition.media.*;

import javax.microedition.media.control.*;

import javax.microedition.midlet.*;

public class PlayerMIDlet extends MIDlet implements CommandListener, PlayerListener, Runnable

{

private Display display;

private Form form;

private Command start = new Command("Play",Command.SCREEN, 1);

private Command stop = new Command("Stop",Command.SCREEN, 2);

private Player player;

public PlayerMIDlet()

{

display = Display.getDisplay(this);

form = new Form("Demo Player");

form.addCommand(start);

form.addCommand(stop);

form.setCommandListener(this);

display.setCurrent(form);

}

protected void startApp()

{

try

{

if(player != null && player.getState() == Player.PREFETCHED)

{

player.start();

}

else

{

defplayer();

display.setCurrent(form);

}

}

catch(MediaException me)

{

reset();

}

}

protected void pauseApp()

{

try

{

if(player != null && player.getState() == Player.STARTED)

{

player.stop();

}

else

{

defplayer();

}

}

catch(MediaException me)

{

reset();

}

}

protected void destroyApp(boolean unconditional)

{

form = null;

try

{

defplayer();

}

catch(MediaException me) {}

}

public void playerUpdate(Player player,String event, Object data)

{

if(event == PlayerListener.END_OF_MEDIA)

{

try

{

defplayer();

}

catch(MediaException me) {}

reset();

}

}

public void commandAction(Command c, Displayable d)

{

if(c == start)

{

start();

}

else if(c == stop)

{

stopPlayer();

}

}

public void start()

{

Thread t = new Thread(this);

t.start();

}

// to prevent blocking, all communication should

// be in a thread

// and not in commandAction

public void run()

{

try

{

defplayer();

// create a player instance

InputStream is = getClass().getResourceAsStream("test-wav.wav");

player = Manager.createPlayer(is, "audio/X-wav");

player.addPlayerListener(this);

// realize the player

player.realize();

player.prefetch();

player.start();

}

catch(Throwable t)

{

reset();

}

}

void defplayer() throws MediaException

{

if (player != null)

{

if(player.getState() == Player.STARTED)

{

player.stop();

}

if(player.getState() == Player.PREFETCHED)

{

player.deallocate();

}

if(player.getState() == Player.REALIZED || player.getState() == Player.UNREALIZED)

{

player.close();

}

}

player = null;

}

void reset()

{

player = null;

}

void stopPlayer()

{

try

{

defplayer();

}

catch(MediaException me) {}

reset();

}

}

[3830 byte] By [kartikraajaa] at [2007-11-26 16:02:14]
# 1

i suppose that is the same problem than in this thread...

http://forum.java.sun.com/thread.jspa?threadID=5127765&tstart=0

why did you start a new one ?

why didn't you put the code in your previous thread ?

in your catch statement, please do a <exception>.printStackTrace() and you will see if

something appears.....

suparenoa at 2007-7-8 22:23:57 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
I didn get a proper response for my prevoius thread...Thats y i used new one...
kartikraajaa at 2007-7-8 22:23:57 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
and are you satisfied with this one?did you do what i told you or will you start a new one because you are not satisfied?
suparenoa at 2007-7-8 22:23:57 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
Yeah...U r rite...Im not satisfied...Do u hav any sample for playing audio?
kartikraajaa at 2007-7-8 22:23:57 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

Some advices, I cant help you with the code but I can help you to get better responses.

1.- Dont post the same thing more than once because people here wants to have an organized forum without crossed posts.

2.- When posting code you must do it using the code marks to let the forums put colors and index it. So its easy to understand.

3.- Specify your problem on ther post subject not "help me" but "help me to play audio files"

4.- No one likes to make other people work, but we are here to help. Post your problems to get an answer on how to solve it, not the code asking for someone to write code for you.

5.- As he/she said, the trace of the exceptions are most of time enough to see what is happeinng. We wont build a test case for you, but witht he exception trace we can know what is wrong.

MelGohana at 2007-7-8 22:23:57 > top of Java-index,Java Mobility Forums,Java ME Technologies...