关于手机的视频录制
下面是代码:
----------------------
String support = System.getProperty("supports.video.capture");
Player player = null;
if (support.equals("true")) {
try {
player = Manager.createPlayer("capture://video");
player.prefetch();
player.realize();
vc = (VideoControl) player.getControl("VideoControl");
rc = (RecordControl) player.getControl("RecordControl");
} catch (Exception e) {
System.out.println("对不起,您的手机不支持视频录像 :-( ");
}
} else {
System.out.println("对不起,您的手机不支持视频录像 :-( ");
}
。。。。当中省略代码。。。。
当点击开始录制时执行下面代码片段:
if(player != null && player.getState() == Player.REALIZED)
{
String fileName = DateUtil.getCurrentTime() + ".3gp";
String fileDir = "file:///e:/mms/" + fileName;
FileUtil.createVoidFile(fileDir);
//rc.setRecordSizeLimit(Integer.MAX_VALUE);
rc.setRecordLocation(fileDir);
rc.startRecord();
}
当触发点击按钮完成视频录制时执行下面代码片段:
if(rc != null)
{
rc.stopRecord();
rc.commit();
}
if (player != null) {
player.close();
player = null;
}
现在在Nokia 6120上录制20多秒后我点击完成了,保存的视频能正常播放,录了一分钟多的视频是坏的,不能播放
Nokia 5310 只能录制7秒,也就是我开始录制之后不用去点击“完成”自动就停止了,而且产生的视频都是7秒,文件大小却有不同,从80K-110K不等,在7秒之前点击完成录制的是正确的
---
哪位同道做过这类的工作,指点下