|
|
|
@ -569,14 +569,16 @@ public class VideoFragment extends Fragment implements View.OnClickListener, Med
|
|
|
|
|
manager.openCamera(Integer.toString(mCameraId), mStateCallback, null);
|
|
|
|
|
} catch (CameraAccessException e) {
|
|
|
|
|
// Toast.makeText(activity, "Cannot access the camera.", Toast.LENGTH_SHORT).show();
|
|
|
|
|
broadcastVideoFile(false, mNextVideoAbsolutePath);
|
|
|
|
|
activity.finish();
|
|
|
|
|
} catch (NullPointerException e) {
|
|
|
|
|
// Currently an NPE is thrown when the Camera2API is used but not supported on the
|
|
|
|
|
// device this code runs.
|
|
|
|
|
ErrorDialog.newInstance(getString(R.string.camera_error))
|
|
|
|
|
.show(getChildFragmentManager(), FRAGMENT_DIALOG);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
throw new RuntimeException("Interrupted while trying to lock camera opening.");
|
|
|
|
|
broadcastVideoFile(false, mNextVideoAbsolutePath);
|
|
|
|
|
activity.finish();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
broadcastVideoFile(false, mNextVideoAbsolutePath);
|
|
|
|
|
activity.finish();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -592,8 +594,9 @@ public class VideoFragment extends Fragment implements View.OnClickListener, Med
|
|
|
|
|
mMediaRecorder.release();
|
|
|
|
|
mMediaRecorder = null;
|
|
|
|
|
}
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
throw new RuntimeException("Interrupted while trying to lock camera closing.");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
broadcastVideoFile(false, mNextVideoAbsolutePath);
|
|
|
|
|
getActivity().finish();
|
|
|
|
|
} finally {
|
|
|
|
|
mCameraOpenCloseLock.release();
|
|
|
|
|
}
|
|
|
|
@ -655,6 +658,9 @@ public class VideoFragment extends Fragment implements View.OnClickListener, Med
|
|
|
|
|
} catch (CameraAccessException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setUpCaptureRequestBuilder(CaptureRequest.Builder builder) {
|
|
|
|
@ -824,6 +830,11 @@ public class VideoFragment extends Fragment implements View.OnClickListener, Med
|
|
|
|
|
}, mBackgroundHandler);
|
|
|
|
|
} catch (CameraAccessException | IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
broadcastVideoFile(false, "");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
broadcastVideoFile(false, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|