Front Camera in Camera2 not capturing image

前端 未结 5 917
一向
一向 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:43

    Plz try this code for capture

    case STATE_WAITING_LOCK: {
                    Integer afState = result.get(CaptureResult.CONTROL_AF_STATE);
                    if (afState == null) {
                        captureStillPicture();
                    } else if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState ||
                            CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED == afState ||
                             CaptureResult.CONTROL_AF_STATE_INACTIVE == afState /*add this*/) {
                        // CONTROL_AE_STATE can be null on some devices
                        Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
                        if (aeState == null || aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
                            mState = STATE_PICTURE_TAKEN;
                            captureStillPicture();
                        } else {
                            runPrecaptureSequence();
                        }
                    }
                    break;
                }
    

提交回复
热议问题