MediaException Using BlackBerry Media Player
I'm facing problem playing a video through a URL. The URL does not have .xyz extension but gives response in inputstream of a .3gpp video. On prefeching media player it throws exception-net.rim.internal.media.rimmediaexception:media unloaded while initialising.
I can't understand the reason of exception, please help me. this is my code-
con = HttpRequestHelper.service(url, null);
inputStream = con.openInputStream();
final Player player = javax.microedition.media.Manager.createPlayer(inputStream, "video/3gpp");
player.realize();
player.prefetch();
UiApplication.getUiApplication().invokeLater(new Runnable(){
public void run() {
VideoControl videoControl = (VideoControl)player.getControl("VideoControl");
videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,
"net.rim.device.api.ui.Field");
videoControl.setVisible(true);
}
});
VolumeControl volume = (VolumeControl) player.getControl("VolumeControl");开发者_Go百科
volume.setLevel(30);
//videoControl.setVisible(true);
player.start();
From the documentation of Player.prefetch():
If the Player cannot obtain all of the resources it needs, it throws a MediaException. When that happens, the Player will not be able to start. However, prefetch may be called again when the needed resource is later released perhaps by another Player or application.
You don't specify your URL, I suspect you are trying to stream over HTTP. In that case you may find the information you need in this developer video from RIM.
精彩评论