问题
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.
回答1:
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:
_recordControl.setRecordLocation(videoPath + "RecordedVideo.3gp");
I have the same issue when I copied the RIM demo, but it is wrong.
use setRecordStream()
instead.
来源:https://stackoverflow.com/questions/4666057/rim-blackberry-record-3gp-video