MediaException Using BlackBerry Media Player

蓝咒 提交于 2019-12-11 05:57:40

问题


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");
volume.setLevel(30);
//videoControl.setVisible(true);
player.start();

回答1:


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.



来源:https://stackoverflow.com/questions/7145477/mediaexception-using-blackberry-media-player

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!