RIM 黑莓录制 3GP 视频
我正在编写一个可以录制 3GP 视频的应用程序。 我已经尝试过 MMAPI 和 Invoke API。但有以下问题。
使用 MMAPI:
- 当我录制流时,它以 RIMM 流格式录制视频。当我尝试播放此视频播放器时出现错误
“不支持的媒体格式。”
- 当我录制到文件时。它将创建一个大小为 0 的文件。
使用 Invoke API:
- 在 MMS 模式下,它不允许录制超过 30 秒的视频。
- 在正常模式下,文件的大小非常大。
- 一旦我调用相机应用程序,我就无法对应用程序进行任何控制。
这是我的源代码:
_player = javax.microedition.media.Manager
.createPlayer("capture://video?encoding=video/3gpp&mode=mms");
// 我已尝试从 System.getProperty("video.encodings") 方法返回的每个编码
_player.realize();
_videoControl = (VideoControl) _player.getControl("VideoControl");
_recordControl = (RecordControl) _player.getControl("RecordControl");
_volumeControl = (VolumeControl) _player.getControl("VolumeControl");
String videoPath = System.getProperty("fileconn.dir.videos");
if (videoPath == null) {
videoPath = "file:///store/home/user/videos/";
}
_recordControl.setRecordLocation(videoPath + "RecordedVideo.3gp");
_player.addPlayerListener(this);
Field videoField = (Field) _videoControl.initDisplayMode(
VideoControl.USE_GUI_PRIMITIVE,
"net.rim.device.api.ui.Field");
_videoControl.setVisible(true);
add(videoField);
_player.start();
在开始菜单项选择上:
try {
_recordControl.startRecord();
} catch (Exception e) {
_player.close();
showAlert(e.getClass() + " " + e.getMessage());
}
在停止菜单项选择上:
try {
_recordControl.commit();
} catch (Exception e) {
_player.close();
showAlert(e.getClass() + " " + e.getMessage());
}
如果我做错了什么,请告诉我。
I am writing an application that can record a 3GP video.
I have tried both MMAPI and Invoke API. But have following issues.
Using MMAPI:
- When I record to stream, It records video in RIMM streaming format. when I try to play this video player gives error
"Unsupported media format."
- When I record to a file. It will create a file of size 0.
Using Invoke API:
- In MMS mode it does not allow to record a video more than 30 seconds.
- In Normal mode size of the file is very large.
- Once I invoke camera application I do not have any control on application.
Here is my source code:
_player = javax.microedition.media.Manager
.createPlayer("capture://video?encoding=video/3gpp&mode=mms");
// I have tried every encoding returns from System.getProperty("video.encodings") method
_player.realize();
_videoControl = (VideoControl) _player.getControl("VideoControl");
_recordControl = (RecordControl) _player.getControl("RecordControl");
_volumeControl = (VolumeControl) _player.getControl("VolumeControl");
String videoPath = System.getProperty("fileconn.dir.videos");
if (videoPath == null) {
videoPath = "file:///store/home/user/videos/";
}
_recordControl.setRecordLocation(videoPath + "RecordedVideo.3gp");
_player.addPlayerListener(this);
Field videoField = (Field) _videoControl.initDisplayMode(
VideoControl.USE_GUI_PRIMITIVE,
"net.rim.device.api.ui.Field");
_videoControl.setVisible(true);
add(videoField);
_player.start();
ON start menu item Selection:
try {
_recordControl.startRecord();
} catch (Exception e) {
_player.close();
showAlert(e.getClass() + " " + e.getMessage());
}
On stop menuItem selection:
try {
_recordControl.commit();
} catch (Exception e) {
_player.close();
showAlert(e.getClass() + " " + e.getMessage());
}
Please let me if I am doing something wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有同样的问题,我只知道这是 RIM 专有格式:
http://docs.blackberry.com/en/developers/deliverables/11942 /RIM_proprietary_video_format_1001586_11.jsp
你得到文件大小 0,因为此代码:
我在复制 RIM 演示时遇到了同样的问题,但它是错误的。
使用
setRecordStream()
代替。I have the same issue, I just know this is RIM proprietary format:
http://docs.blackberry.com/en/developers/deliverables/11942/RIM_proprietary_video_format_1001586_11.jsp
you get the file size 0 because this code:
I have the same issue when I copied the RIM demo, but it is wrong.
use
setRecordStream()
instead.