Reputation: 5657
I need to record video with specific resolution (as least as possible).
private void startRecording(Player player, net.rim.device.api.ui.Manager parentManager)
{
try
{
if (player == null)
{
player = javax.microedition.media.Manager.createPlayer("capture://video?encoding=video/3gpp");
player.addPlayerListener(this);
player.realize();
RecordControl recordControl = (RecordControl) player.getControl("RecordControl");
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
if (videoControl != null)
{
final Field videoField = (Field)videoControl.initDisplayMode( VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field" );
try
{
videoControl.setDisplaySize(1, 1);
}catch(Exception e)
{
System.out.println(e);
}
videoControl.setVisible(true);
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run()
{
if(parentManager != null)
{
if(videoField.getIndex() == -1)
{
parentManager.insert(videoField, 1);
}
}
}
});
}
}
// here i get null
CameraControl cameraControl = (CameraControl) player.getControl("CameraControl");
int[] resolutions = cameraControl.getSupportedVideoResolutions();
cameraControl.setVideoResolution(resolutions.length / 2 - 1);
recordControl.setRecordLocation("test.3gp");\
recordControl.startRecord();
player.start();
}catch(Exception e)
{
System.out.println(e);
}
}
but for some reason (CameraControl) player.getControl("CameraControl");
return null
How can i specify resolution for recording video?
P.S. Blackberry OS 5.0, Torch 9800
Update:
In case when I using
capture://video?encoding=video/3gpp&mode=mms
or
capture://video?encoding=video/3gpp&width=240&height=180&video_codec=MPEG-4&audio_codec=AMR
I get event=error
and eventData=2
in PlayerListener.playerUpdate(Player player, String event, Object eventData)
method
Description for eventData=2
I found here:
Invalid parameter: a parameter was specified with an invalid value.
Can someone explain me why my params incorrect?
Upvotes: 4
Views: 281
Reputation: 11876
The user is able to modify the recording settings - on higher end phones there are three different quality levels, but the recorder defaults to the highest quality. I've tried to set it to the medium quality level - 640x480, but haven't been able to find a way to do that.
Since you are asking for the lowest quality, you might have some luck. You can specify "MMS" quality, and the video recording will be very low quality, which is what you want.
I referenced "RIM blackberry Record 3GP video" which says that adding &mode=mms
to the player string will give you MMS quality. Unfortunately, it also appears to limit the duration to 30 seconds.
Upvotes: 2