J2ME视频捕获抛出MediaException:无效的定位器:capture:// video

时间:2012-05-28 14:28:25

标签: java-me lwuit mmapi

我试图使用以下代码段

在J2ME应用程序中捕获视频
private void createCamera() throws IOException, MediaException {
    videoComponent = VideoComponent.createVideoPeer("capture://video");
    videoComponent.setPreferredH(height);
    videoComponent.setPreferredW(cameraForm.getWidth());
    player = (Player) videoComponent.getNativePeer();
    player.realize();
    player.prefetch();
    videoControl = (VideoControl) player.getControl("VideoControl");
}

当我在真实设备上运行应用程序时,我收到错误:

javax.microedition.media.MediaException: Invalid locator: capture://video

如果我使用字符串capture:// image,它只会显示摄像头的图像。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

也许你会尝试通过device name来获取,例如devcam0 / devcam1?你使用诺基亚手机吗?