Front Camera in Camera2 not capturing image

前端 未结 5 911
一向
一向 2021-02-04 12:18

I have the code for the Camera2 from https://github.com/googlesamples/android-Camera2Basic.

The problem i\'m facing is that when i turn to my Front Camera, i cannot capt

5条回答
  •  我在风中等你
    2021-02-04 12:48

    For Camera2 Api, Google's example for video works great for both front and back camera, but for Image capturing, Google's example works only for back camera and not for front camera.
    Solution which works for me is

    In lockFocus() method, replace line

    mCaptureSession.capture(mPreviewRequestBuilder.build(),
                                                      mCaptureCallback, mBackgroundHandler);
    

    with

    captureStillPicture();
    

    Hope this will help!!

提交回复
热议问题