RIM blackberry Record 3GP video
- by pankaj_shukla
Hi All,
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:
1. 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.".
2. When I record to a file. It will create a file of size 0.
Using Invoke API:
1. In MMS mode it does not allow to  record a video more than 30 seconds.
2. In Normal mode size of the file is very large.
3. 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.
Thanks,
Pankaj