BlackBerry API docsを見ると、使用している のバージョンが次のように表示されcreatePlayer()
ます。
MediaException - 指定されたロケータに対して Player を作成できない場合にスローされます。
また、次のようにも述べています。
locator - メディア コンテンツを記述する URI 構文のロケーター文字列。
ロケーター ( "abc.mp3"
) は URI 構文にあるようには見えません。のようなものに変更してみてください"file:///SDCard/some-folder/abc.mp3"
。
または、mp3 ファイルがアプリ リソースの場合、通常は次のコードを使用します。
try {
java.io.InputStream is = getClass().getResourceAsStream("/sounds/abc.mp3");
javax.microedition.media.Player p =
javax.microedition.media.Manager.createPlayer(is, "audio/mpeg");
p.realize();
// get volume control for player and set volume to max
VolumeControl vc = (VolumeControl) p.getControl("VolumeControl");
if (vc != null) {
vc.setLevel(100);
}
// the player can start with the smallest latency
p.prefetch();
// non-blocking start
p.start();
} catch (javax.microedition.media.MediaException me) {
// do something?
} catch (java.io.IOException ioe) {
// do something?
} catch (java.lang.NullPointerException npe) {
// this happened on Tours without mp3 bugfix
}