Compare commits

...

1 Commits

Author SHA1 Message Date
Mattia Iavarone 418f1ed662 Use onStopVideo callback for restoring preview 5 years ago
  1. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java
  2. 9
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/CameraEngine.java

@ -726,9 +726,8 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
}
@Override
public void onVideoResult(@Nullable VideoResult.Stub result, @Nullable Exception exception) {
protected void onStopVideo() {
boolean wasRecordingFullVideo = mVideoRecorder instanceof Full2VideoRecorder;
super.onVideoResult(result, exception);
if (wasRecordingFullVideo) {
// We have to stop all repeating requests and restart them.
try {
@ -739,6 +738,7 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
throw createCameraException(e);
}
}
super.onStopVideo();
}
//endregion

@ -1187,14 +1187,19 @@ public abstract class CameraEngine implements
mHandler.run(new Runnable() {
@Override
public void run() {
LOG.i("stopVideo", "executing.", "isTakingVideo?", isTakingVideo());
onStopVideo();
}
});
}
protected void onStopVideo() {
LOG.i("stopVideo", "executing.", "isTakingVideo?", isTakingVideo());
if (mVideoRecorder != null) {
mVideoRecorder.stop(false);
mVideoRecorder = null;
}
}
});
}
@CallSuper
@Override

Loading…
Cancel
Save