开发者

j2me audio player

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜