react-native-rectangle-doc-scanner 3.188.0 → 3.189.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,6 +4,7 @@ import android.content.Context
|
|
|
4
4
|
import android.graphics.ImageFormat
|
|
5
5
|
import android.util.Log
|
|
6
6
|
import android.util.Size
|
|
7
|
+
import android.view.Surface
|
|
7
8
|
import androidx.camera.core.*
|
|
8
9
|
import androidx.camera.lifecycle.ProcessCameraProvider
|
|
9
10
|
import androidx.camera.view.PreviewView
|
|
@@ -105,11 +106,14 @@ class CameraController(
|
|
|
105
106
|
}
|
|
106
107
|
Log.d(TAG, "[BIND] Camera selector: ${if (useFrontCamera) "FRONT" else "BACK"}")
|
|
107
108
|
|
|
109
|
+
val targetRotation = previewView.display?.rotation ?: Surface.ROTATION_0
|
|
110
|
+
|
|
108
111
|
// Preview use case
|
|
109
112
|
Log.d(TAG, "[BIND] Creating Preview use case...")
|
|
110
113
|
val preview = Preview.Builder()
|
|
111
114
|
// Use aspect ratio to avoid unsupported size combinations on some devices.
|
|
112
115
|
.setTargetAspectRatio(AspectRatio.RATIO_4_3)
|
|
116
|
+
.setTargetRotation(targetRotation)
|
|
113
117
|
.build()
|
|
114
118
|
Log.d(TAG, "[BIND] Preview created: $preview")
|
|
115
119
|
|
|
@@ -119,6 +123,9 @@ class CameraController(
|
|
|
119
123
|
.setCaptureMode(ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY)
|
|
120
124
|
// Use aspect ratio to avoid unsupported size combinations on some devices.
|
|
121
125
|
.setTargetAspectRatio(AspectRatio.RATIO_4_3)
|
|
126
|
+
// Cap resolution to avoid camera session timeouts on lower-end devices.
|
|
127
|
+
.setTargetResolution(Size(1280, 960))
|
|
128
|
+
.setTargetRotation(targetRotation)
|
|
122
129
|
.setFlashMode(ImageCapture.FLASH_MODE_AUTO)
|
|
123
130
|
.build()
|
|
124
131
|
Log.d(TAG, "[BIND] ImageCapture created: $imageCapture")
|
|
@@ -129,6 +136,9 @@ class CameraController(
|
|
|
129
136
|
ImageAnalysis.Builder()
|
|
130
137
|
// Use aspect ratio to avoid unsupported size combinations on some devices.
|
|
131
138
|
.setTargetAspectRatio(AspectRatio.RATIO_4_3)
|
|
139
|
+
// Keep analysis lightweight to prevent session configuration timeouts.
|
|
140
|
+
.setTargetResolution(Size(960, 720))
|
|
141
|
+
.setTargetRotation(targetRotation)
|
|
132
142
|
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
|
|
133
143
|
.setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888)
|
|
134
144
|
.build()
|
package/package.json
CHANGED