Catch more camera exceptions.

Some devices will simply fail to open the camera with a runtime
exception. In this case, all we can do is catch it and report the error.
pull/1/head
Greyson Parrelli 6 years ago
parent 8ec3cf6a43
commit 668e8dee5d

@ -34,9 +34,20 @@ public class Camera1Controller {
if (Camera.getNumberOfCameras() <= 0) {
onCameraUnavailable();
return;
}
camera = Camera.open(cameraId);
try {
camera = Camera.open(cameraId);
} catch (Exception e) {
onCameraUnavailable();
return;
}
if (camera == null) {
onCameraUnavailable();
return;
}
Camera.Parameters params = camera.getParameters();
Camera.Size maxSize = getMaxSupportedPreviewSize(camera);

Loading…
Cancel
Save