fix(android): Fix app freeze on app/host pause on Android. Fix is quite simple, recording has to be stopped before the camera preview. (#2467)
Fix taken from: https://stackoverflow.com/questions/8914454/mediarecorder-stop-hanging-with-android-4-0-ics/18876200 TODO: Review Camera2 implementation since it might have the same issue.
This commit is contained in:
parent
654f1b221f
commit
57bf513d5b
@ -159,10 +159,7 @@ class Camera1 extends CameraViewImpl implements MediaRecorder.OnInfoListener,
|
||||
|
||||
@Override
|
||||
void stop() {
|
||||
if (mCamera != null) {
|
||||
mCamera.stopPreview();
|
||||
mCamera.setPreviewCallback(null);
|
||||
}
|
||||
|
||||
mShowingPreview = false;
|
||||
if (mMediaRecorder != null) {
|
||||
mMediaRecorder.stop();
|
||||
@ -175,6 +172,12 @@ class Camera1 extends CameraViewImpl implements MediaRecorder.OnInfoListener,
|
||||
mIsRecording = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mCamera != null) {
|
||||
mCamera.stopPreview();
|
||||
mCamera.setPreviewCallback(null);
|
||||
}
|
||||
|
||||
releaseCamera();
|
||||
}
|
||||
|
||||
@ -1003,7 +1006,7 @@ class Camera1 extends CameraViewImpl implements MediaRecorder.OnInfoListener,
|
||||
if (minExposure != maxExposure) {
|
||||
int scaledValue = 0;
|
||||
if (mExposure >= 0 && mExposure <= 1) {
|
||||
scaledValue = (int) (mExposure * (maxExposure - minExposure)) + minExposure;
|
||||
scaledValue = (int) (mExposure * (maxExposure - minExposure)) + minExposure;
|
||||
}
|
||||
|
||||
mCameraParameters.setExposureCompensation(scaledValue);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user