pull/696/head
Mattia Iavarone 6 years ago
parent a9c86d091e
commit abe74ebf35
  1. 12
      cameraview/src/main/java/com/otaliastudios/cameraview/video/FullVideoRecorder.java

@ -232,16 +232,9 @@ public abstract class FullVideoRecorder extends VideoRecorder {
break; break;
} }
if (shouldStop) { if (shouldStop) {
// Do not block this callback with a stop() call: stop() closes the
// MediaRecorder and I think that in some cases this creates a deadlock.
new Handler().post(new Runnable() {
@Override
public void run() {
LOG.i("OnInfoListener:", "Stopping"); LOG.i("OnInfoListener:", "Stopping");
stop(false); stop(false);
} }
});
}
} }
}); });
mMediaRecorder.setOnErrorListener(new MediaRecorder.OnErrorListener() { mMediaRecorder.setOnErrorListener(new MediaRecorder.OnErrorListener() {
@ -250,15 +243,10 @@ public abstract class FullVideoRecorder extends VideoRecorder {
LOG.e("OnErrorListener: got error", what, extra, ". Stopping."); LOG.e("OnErrorListener: got error", what, extra, ". Stopping.");
mResult = null; mResult = null;
mError = new RuntimeException("MediaRecorder error: " + what + " " + extra); mError = new RuntimeException("MediaRecorder error: " + what + " " + extra);
new Handler().post(new Runnable() {
@Override
public void run() {
LOG.i("OnErrorListener:", "Stopping"); LOG.i("OnErrorListener:", "Stopping");
stop(false); stop(false);
} }
}); });
}
});
// 8. Prepare the Recorder // 8. Prepare the Recorder
try { try {

Loading…
Cancel
Save