Problem with play audio file on my phone

Hello guys!

I have a problem with my little application:

I want to play an audio file on my phone (Sony Ericcson k618i).

On WTK2.5 my code runs ok, it play a simple audio file, but on my phone it doesn't work.

Why?

I don't know why!

Please help me.... :(

The code is:

public void run() {

try {

//instead the getResourceAsStream's parameter on wtk2.5 is "/file.wav"

InputStream in =getClass().getResourceAsStream("file:///C:/Music/file.wav");

Player p = Manager.createPlayer(in, "audio/x-wav");

p.realize();

VolumeControl vc = (VolumeControl)p.getControl("VolumeControl");

if (vc != null) {

vc.setLevel(100);

}

p.prefetch();

p.start();

} catch (IOException ioe) {

} catch (MediaException me) { }

}

[838 byte] By [fighter79@inwind.ita] at [2007-11-27 5:10:18]
# 1

InputStream in = getClass().getResourceAsStream("file:///C:/Music/file.wav");

Have you kept this same when you you are running the app in your phone? (It should not be)

NOTE: There is an example named AudioDemo in wtk 2.5 you can see it for your reference.

Hope it helps :)

diptaPBa at 2007-7-12 10:30:22 > top of Java-index,Java Mobility Forums,Java ME Technologies...