Android getsupportedvideosizes returns null to emulator

I tried to get the supported video size as below in the emulator, but it always returns null. Why is this? I tried at 4.03. thanks in advance

 Camera camera=Camera.open();
    android.hardware.Camera.Parameters params = camera.getParameters();
    supportedPicSizes = params.getSupportedVideoSizes();
    if (supportedPicSizes==null){
        Log.i("*****supportedVideoSize*****", "*****Null****"); 
    }

      

0


source to share


4 answers


This is a known Android bug .



It hasn't been fixed yet, but the fact that it's on the bug tracker likely means Google plans to review it.

0


source


Here is one of the options with which you can get Camera Preview Size

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 this helps you.

Thank.

0


source


It clearly states here that a zero return from this method means the device does not support different outputs for preview and video. In the case of an emulator, this situation should be noticeable since the emulator does not have a physical camera and is not usually used to test camera-related modules.

I would like to add that although the documentation has indicated that this is a normal scenario, I still cannot find a suitable alternative for devices suffering from this disease. For example, the Verizon S3 variant returns null for both "getSupportedVideoSizes ()" and "getPreferredPreviewSizeForVideo ()". Has anyone gone through this question? Help would be much appreciated.

0


source


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();
    }
}

      

0


source







All Articles