plugin camera android black image

0

I'm doing a plugin with cordova and ionic and I have the problem that the image looks very tight or very stretched depends on how you put the phone. One of the solutions with which I have given is that in the surfaceChanged if I change previewSize.height to previewSize.height / 2 in some phone it works perfect but in others I get the black screen and if I let the previewSize choose the resolution it looks as discussed above. I leave the surfaceDestroyed code

try {
        Camera.Parameters cameraSettings = camera.getParameters();
        Size previewSize = optimimalPreviewSize(width, height);
        cameraSettings.setPreviewSize(previewSize.width, previewSize.height);
        //cameraSettings.setPreviewSize(1248, 624);//funciona bien en el doopro
        camera.setParameters(cameraSettings);
        camera.setDisplayOrientation(90);
        camera.setPreviewDisplay(holder);
        camera.startPreview();

    } catch (Exception e){
        Log.d(TAG, "Error starting camera preview: " + e.getMessage());
    }
    
asked by Carlos 01.08.2018 в 13:15
source

0 answers