google / cameraview

[DEPRECATED] Easily integrate Camera features into your Android app
Apache License 2.0
4.74k stars 1.03k forks source link

Front camera doesn't open and give error "onError: 1 (4)" #197

Closed kerimovscreations closed 3 years ago

kerimovscreations commented 7 years ago

I'm testing on Xperia XZ Android 7.1.1 Api level, and trying to switch the camera during capturing. It gives error on console and keeps freezing. Session 0: Exception while stopping repeating:

android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
                                                                                         at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2023)
                                                                                         at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:952)
                                                                                         at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:395)
                                                                                         at com.google.android.cameraview.Camera2.stop(Camera2.java:224)
                                                                                         at com.google.android.cameraview.CameraView.stop(CameraView.java:257)
                                                                                         at com.onbranch.onbranchandroidapp.activities.PhotoCheckInActivity.onPause(PhotoCheckInActivity.java:315)
crontab commented 7 years ago

I can confirm this. Might be related (see my comment there): https://github.com/google/cameraview/issues/184