I have tried to get the supported video size as below in an emulator but it always return null.Why it is so?I have tried in 4.03.Thanks in advance
Camera cam
Here is the one of the option by which you can get Camera Preview Size
of the devices.
Camera camera=Camera.open();
android.hardware.Camera.Parameters params = camera.getParameters();
Size supportedPicSizes = params.getPreviewSize();
if (supportedPicSizes==null){
Log.i("*****supportedVideoSize*****", "*****Null****");
}
else{
Log.i("*****supportedVideoSize*****", "*****"+supportedPicSizes.height);
Log.i("*****supportedVideoSize*****", "*****"+supportedPicSizes.width);
}
Hope it helps you.
Thanks.
answered also here
Sample code:
public List<Size> getSupportedVideoSizes(Camera camera) {
if (camera.getParameters().getSupportedVideoSizes() != null) {
return camera.getParameters().getSupportedVideoSizes();
} else {
// Video sizes may be null, which indicates that all the supported
// preview sizes are supported for video recording.
return camera.getParameters().getSupportedPreviewSizes();
}
}
This is a known Android bug.
This still hasn't been fixed yet but the fact that it is on the bug tracking system probably means that Google has plans to see it through.
It's clearly stated here that a null return from this method means the device doesn't support different outputs for preview and video. In case of emulator, this situation must be prominent because an emulator doesn't have a physical camera and is generally not used for testing camera-related modules.
I would like to add that even though documentations have pointed this to be a normal case scenario, I'm still unable to find a proper alternative for devices suffering from this sickness. For instance, a Verizon variant of S3 return null for both "getSupportedVideoSizes()" and "getPreferredPreviewSizeForVideo()". Has anyone gone through a way around this issue?? A help would be highly appreciated.