From 37db643f7107366ff93e3ee651017651b521982d Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Thu, 5 Aug 2021 15:54:01 +0200 Subject: [PATCH] fix: Fix `format` Preview and Video Capture resolution setting (#325) * fix: Actually use a format's `videoSize` for Preview/Video Capture * `setDefaultResolution` -> `setTargetResolution` --- android/src/main/java/com/mrousavy/camera/CameraView.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/mrousavy/camera/CameraView.kt b/android/src/main/java/com/mrousavy/camera/CameraView.kt index 87147a2..f6dc227 100644 --- a/android/src/main/java/com/mrousavy/camera/CameraView.kt +++ b/android/src/main/java/com/mrousavy/camera/CameraView.kt @@ -356,10 +356,9 @@ class CameraView(context: Context) : FrameLayout(context), LifecycleOwner { // User has selected a custom format={}. Use that val format = DeviceFormat(format!!) Log.i(TAG, "Using custom format - photo: ${format.photoSize}, video: ${format.videoSize} @ $fps FPS") - val aspectRatio = aspectRatio(format.photoSize.width, format.photoSize.height) - previewBuilder.setTargetAspectRatio(aspectRatio) - imageCaptureBuilder.setDefaultResolution(format.photoSize) - videoCaptureBuilder.setDefaultResolution(format.photoSize) + previewBuilder.setTargetResolution(format.videoSize) + imageCaptureBuilder.setTargetResolution(format.photoSize) + videoCaptureBuilder.setTargetResolution(format.videoSize) fps?.let { fps -> if (format.frameRateRanges.any { it.contains(fps) }) {