Can Play audio file from SDCard in emulator but not in Handphone
Hi everyone, please help me to solving my problem.
I have some codes like shown below. My code can play audio file from emulator but not in Handphone.
[QUOTE]
private void playLagu(String nada) {
Player p = null;
try {
FileConnection connection = (FileConnection) Connector.open("file:///" + nada);
InputStream inStream = connection.openInputStream();
if (p == null || p.getState() != Player.STARTED) {
p = Manager.createPlayer(inStream, "audio/x-wav");
p.start();
}
nada = "";
} catch (IOException ex) {
ex.printStackTrace();
} catch (MediaException ex) {
ex.printStackTrace();
}
}
[/QUOTE]
Thank you very muh
Re: Can Play audio file from SDCard in emulator but not in Handphone
What happens instead? On what device? How comes SDCard to the question? Does it play files well from the internal memory?
What about the wav? Is it using some fancy encoding? Can you play it on the device?
Re: Can Play audio file from SDCard in emulator but not in Handphone
Also just to make ure you first might want to check the specific external memory directory name, like described here : [url]http://www.developer.nokia.com/Resources/Library/Java/#!implementation-notes/jsr-75-fileconnection-api-optional-package/runtime-environment-notes/system-properties.html[/url]
So something like :
String url = System.getProperty("fileconn.dir.memorycard") + "nada.jpg";