Android Camera Server Died and Camera Error - 100

前端 未结 4 790
小鲜肉
小鲜肉 2020-12-09 10:40

I\'m facing Camera error 100 while testing my android application, I have found some topics on StackOverflow but they were not so helpful. I\'m searching for a

相关标签:
4条回答
  • 2020-12-09 11:09

    Use Camera.ErrorCallback which gets triggered when camera server fails. Camera.ErrorCallback Android documentation You can then inspect the camera properties there.

    0 讨论(0)
  • 2020-12-09 11:15

    This exception will occur when the camera parameters have not been set prior to use.

    Here is a method to set the most common default values. Note that this method uses defaults on the assumption that the camera is being used for still photography. Remove the supported picture formats for video capture.

    /**
     * This method configures the camera with a set of defaults for brightness,
     * flash, camera mode, and picture sizes.
     */
    private void setCameraDefaults()
    {
        Camera.Parameters params = mCamera.getParameters();
    
        // Supported picture formats (all devices should support JPEG).
        List<Integer> formats = params.getSupportedPictureFormats();
    
        if (formats.contains(ImageFormat.JPEG))
        {
            params.setPictureFormat(ImageFormat.JPEG);
            params.setJpegQuality(100);
        }
        else
            params.setPictureFormat(PixelFormat.RGB_565);
    
        // Now the supported picture sizes.
        List<Size> sizes = params.getSupportedPictureSizes();
        Camera.Size size = sizes.get(sizes.size()-1);
        params.setPictureSize(size.width, size.height);
    
        // Set the brightness to auto.
        params.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO);
    
        // Set the flash mode to auto.
        params.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);
    
        // Set the scene mode to auto.
        params.setSceneMode(Camera.Parameters.SCENE_MODE_AUTO);
    
        // Lastly set the focus to auto.
        params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
    
        mCamera.setParameters(params);
    }
    
    0 讨论(0)
  • 2020-12-09 11:15

    Here is a sample, camera can works well. Hope help. https://github.com/josnidhin/Android-Camera-Example

    0 讨论(0)
  • 2020-12-09 11:26

    You need to set the preview display to the recorder.

    mrec.setPreviewDisplay(SurfaceHolder.getSurface());

    The video data in the preview display acts as the input to the video recorder. Also you need to ensure that the video resolution for the recording and the preview resolution are the same.

    0 讨论(0)
提交回复
热议问题