&引用;“不支持的类型”;在BlackBerry上播放实时视频流时
我正试图在我的黑莓设备上通过ip摄像头播放实时视频。 我尝试播放视频时遇到不支持的类型异常&引用;“不支持的类型”;在BlackBerry上播放实时视频流时,blackberry,Blackberry,我正试图在我的黑莓设备上通过ip摄像头播放实时视频。 我尝试播放视频时遇到不支持的类型异常 package com.bb.play; import javax.microedition.media.Player; import javax.microedition.media.Manager; import javax.microedition.media.control.VideoControl; import net.rim.device.api.ui.container.MainScre
package com.bb.play;
import javax.microedition.media.Player;
import javax.microedition.media.Manager;
import javax.microedition.media.control.VideoControl;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.system.Characters;
/**
*
*/
public final class PlayVideo extends UiApplication
{
private Player player;
private VideoControl videoControl;
public static void main(String[] args)
{
PlayVideo theApp = new PlayVideo();
theApp.enterEventDispatcher();
}
public PlayVideo()
{
MainScreen ms = new MainScreen(){
public boolean onClose()
{
//Clean up the player resources.
player.close();
videoControl.setVisible(false);
close();
return true;
}
//Override keyChar to capture key commands used to control video playback.
protected boolean keyChar(char c, int status, int time)
{
boolean retVal = false;
if (c == Characters.SPACE)
{
if (player.getState() == Player.STARTED)
{
//Stop playback.
try
{
player.stop();
}
catch (Exception ex)
{
System.out.println("Exception: " + ex.toString());
}
}
else
{
//Start playback.
try
{
player.start();
}
catch (Exception ex)
{
System.out.println("Exception: " + ex.toString());
}
}
retVal = true;
}
return retVal;
}
};
ms.setTitle(new LabelField("Let's play some video..."));
LabelField lf = new LabelField("Press space to start/stop/resume playback.");
ms.add(lf);
pushScreen(ms);
try
{
//Create a new Player pointing to the video file.
//This can use any valid URL.
player = Manager.createPlayer("http://camera1.mairie-brest.fr/axis-cgi/mjpg/video.cgi");
player.realize();
//Create a new VideoControl.
videoControl = (VideoControl)player.getControl("VideoControl");
//Initialize the video mode using a Field.
videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
//Set the video control to be visible.
videoControl.setVisible(true);
}
catch (Exception ex)
{
System.out.println(ex.toString());
}
}
}
我还试图在黑莓手机上通过IP摄像头播放现场视频,但遇到了同样的问题。当我提供一个liveview url或指向远程服务器中托管的视频文件的链接时,Manager.createPlayer(url)正在抛出MediaException。但是,当我尝试从手机内存播放视频文件时,并没有引发这样的异常。这可能与播放器API有关 我的方法是打开一个从HttpConnection到liveview url的InputStream,并从InputStream连续读取JPEG数据。这在诺基亚手机中起作用,但在黑莓手机中不起作用。从InputStream部件读取数据不工作。我在Blackberry开发者论坛上发布了一个问题,但还没有一个令人满意的解决方案 我已经实现的一个工作解决方案是从相机连续捕获JPEG快照(而不是您正在使用的MJPEG链接),并在Blackberry屏幕上绘制相同的快照。缺点是刷新率非常低,因为这需要一个接一个地打开和关闭HttpConnection 希望我的回答有用。当你能解决问题时,请发帖子
Jithin你至少能写出正确的英语,使用代码标签,并把完整的错误信息和它发生的地方写下来。当像你这样的人不知道答案时,他们就会找这样的蹩脚借口