I created a audio player using following code.
try {
InputStream is = getClass().getResourceAsStream("bell.wav");
player = Manager.createPlayer(is, "audio/X-wav");
player.realize();
player.prefetch();
player.start();
}
catch (IOException ex) {
ex.printStackTrace();
}
catch (MediaException ex) {
ex.printStackTrace();
}
This code works on the simulator without any problem. But it is not working in the phone. MediaException is thrown. I think phone does not support for this player. Have there any solutions for this ?
It might help to check what mime types are supported by the device by checking
Manager.getSupportedContentTypes(String protocol);
and
Manager.getSupportedProtocols(String content_type);
You can also try using an URL instead of InputStream
Manager.createPlayer(String url);