fix(record): android crash fix (#2697)
Co-authored-by: Cristiano Coelho <cristianocca@hotmail.com>
This commit is contained in:
parent
9b4af8e649
commit
7c2572dc7a
@ -1414,26 +1414,33 @@ class Camera1 extends CameraViewImpl implements MediaRecorder.OnInfoListener,
|
||||
|
||||
private void stopMediaRecorder() {
|
||||
|
||||
if (mMediaRecorder != null) {
|
||||
try {
|
||||
mMediaRecorder.stop();
|
||||
} catch (RuntimeException ex) {
|
||||
Log.e("CAMERA_1::", "stopMediaRecorder failed", ex);
|
||||
synchronized(this){
|
||||
if (mMediaRecorder != null) {
|
||||
try {
|
||||
mMediaRecorder.stop();
|
||||
} catch (RuntimeException ex) {
|
||||
Log.e("CAMERA_1::", "stopMediaRecorder stop failed", ex);
|
||||
}
|
||||
|
||||
try{
|
||||
mMediaRecorder.reset();
|
||||
mMediaRecorder.release();
|
||||
} catch (RuntimeException ex) {
|
||||
Log.e("CAMERA_1::", "stopMediaRecorder reset failed", ex);
|
||||
}
|
||||
|
||||
mMediaRecorder = null;
|
||||
}
|
||||
mMediaRecorder.reset();
|
||||
mMediaRecorder.release();
|
||||
mMediaRecorder = null;
|
||||
|
||||
int deviceOrientation = displayOrientationToOrientationEnum(mDeviceOrientation);
|
||||
if (mVideoPath == null || !new File(mVideoPath).exists()) {
|
||||
mCallback.onVideoRecorded(null, mOrientation != Constants.ORIENTATION_AUTO ? mOrientation : deviceOrientation, deviceOrientation);
|
||||
return;
|
||||
}
|
||||
|
||||
mCallback.onVideoRecorded(mVideoPath, mOrientation != Constants.ORIENTATION_AUTO ? mOrientation : deviceOrientation, deviceOrientation);
|
||||
mVideoPath = null;
|
||||
}
|
||||
|
||||
int deviceOrientation = displayOrientationToOrientationEnum(mDeviceOrientation);
|
||||
if (mVideoPath == null || !new File(mVideoPath).exists()) {
|
||||
mCallback.onVideoRecorded(null, mOrientation != Constants.ORIENTATION_AUTO ? mOrientation : deviceOrientation, deviceOrientation);
|
||||
return;
|
||||
}
|
||||
|
||||
mCallback.onVideoRecorded(mVideoPath, mOrientation != Constants.ORIENTATION_AUTO ? mOrientation : deviceOrientation, deviceOrientation);
|
||||
mVideoPath = null;
|
||||
|
||||
}
|
||||
|
||||
private void setCamcorderProfile(CamcorderProfile profile, boolean recordAudio) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user