From 92d262a0fe09a204befb3789ff5beb1a0bf738f6 Mon Sep 17 00:00:00 2001 From: MHShetty Date: Thu, 18 Jul 2024 21:45:25 +0530 Subject: [PATCH] Use CameraX's official APIs for EIS (over existing Camera2Interop API implementation) --- .../main/java/app/grapheneos/camera/CamConfig.kt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/app/grapheneos/camera/CamConfig.kt b/app/src/main/java/app/grapheneos/camera/CamConfig.kt index dfbfe1887..f29be7172 100644 --- a/app/src/main/java/app/grapheneos/camera/CamConfig.kt +++ b/app/src/main/java/app/grapheneos/camera/CamConfig.kt @@ -1076,6 +1076,8 @@ class CamConfig(private val mActivity: MainActivity) { .build() ) + videoCaptureBuilder.setVideoStabilizationEnabled(mActivity.camConfig.enableEIS) + if (mActivity.camConfig.saveVideoAsPreviewed) videoCaptureBuilder.setMirrorMode(MirrorMode.MIRROR_MODE_ON_FRONT_ONLY) @@ -1131,17 +1133,8 @@ class CamConfig(private val mActivity: MainActivity) { ResolutionSelector.Builder().setAspectRatioStrategy(aspectRatioStrategy).build() ) - @androidx.camera.camera2.interop.ExperimentalCamera2Interop - if (isVideoMode && enableEIS) { - Camera2Interop.Extender(previewBuilder).setCaptureRequestOption( - CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE, - CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_ON - ) - } else { - Camera2Interop.Extender(previewBuilder).setCaptureRequestOption( - CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE, - CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_OFF - ) + if (isVideoMode) { + previewBuilder.setPreviewStabilizationEnabled(enableEIS) } preview = previewBuilder.build().also {