I am writing an application that can record 3GP video. I tried both the MMAPI and Invoke APIs. But they have the following problems.
Using MMAPI:
- When I record to a stream, it records video in the RIMM streaming format. when I try to play this video player, you will get the error message
"Unsupported media format." - When I write a file. It will create a file of size 0.
Using the Invoke API:
- In MMS mode, it does not allow you to record video for more than 30 seconds.
- In normal mode, the file size is very large.
- As soon as I call the camera application, I have no control over the application.
Here is my source code:
_player = javax.microedition.media.Manager .createPlayer("capture://video?encoding=video/3gpp&mode=mms");
// I tried every code return from the System.getProperty method ("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();
ON Start menu item Select:
try { _recordControl.startRecord(); } catch (Exception e) { _player.close(); showAlert(e.getClass() + " " + e.getMessage()); }
In the stop menu. Object selection:
try { _recordControl.commit(); } catch (Exception e) { _player.close(); showAlert(e.getClass() + " " + e.getMessage()); }
Please allow me if I do something wrong.
source share