react-native-rectangle-doc-scanner 3.216.0 → 3.218.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.
|
@@ -157,17 +157,20 @@ class CameraController(
|
|
|
157
157
|
|
|
158
158
|
val rotation = previewView.display?.rotation ?: Surface.ROTATION_0
|
|
159
159
|
|
|
160
|
-
// Build Preview with
|
|
160
|
+
// Build Preview with lower resolution to reduce HAL load
|
|
161
161
|
preview = Preview.Builder()
|
|
162
|
-
.
|
|
162
|
+
.setTargetResolution(Size(1280, 720))
|
|
163
163
|
.setTargetRotation(rotation)
|
|
164
164
|
.build()
|
|
165
|
+
.also {
|
|
166
|
+
it.setSurfaceProvider(previewView.surfaceProvider)
|
|
167
|
+
}
|
|
165
168
|
|
|
166
|
-
// Build ImageAnalysis
|
|
169
|
+
// Build ImageAnalysis with lower resolution
|
|
167
170
|
imageAnalysis = ImageAnalysis.Builder()
|
|
168
171
|
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
|
|
169
172
|
.setTargetRotation(rotation)
|
|
170
|
-
.
|
|
173
|
+
.setTargetResolution(Size(1280, 720))
|
|
171
174
|
.setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888)
|
|
172
175
|
.build()
|
|
173
176
|
.also {
|
|
@@ -180,7 +183,7 @@ class CameraController(
|
|
|
180
183
|
CameraSelector.DEFAULT_BACK_CAMERA
|
|
181
184
|
}
|
|
182
185
|
|
|
183
|
-
// Bind both Preview and ImageAnalysis together in
|
|
186
|
+
// Bind both Preview and ImageAnalysis together in ONE call
|
|
184
187
|
try {
|
|
185
188
|
camera = provider.bindToLifecycle(
|
|
186
189
|
lifecycleOwner,
|
|
@@ -188,14 +191,10 @@ class CameraController(
|
|
|
188
191
|
preview,
|
|
189
192
|
imageAnalysis
|
|
190
193
|
)
|
|
191
|
-
|
|
192
|
-
// Set surface provider AFTER binding to avoid timeout
|
|
193
|
-
preview?.setSurfaceProvider(previewView.surfaceProvider)
|
|
194
|
-
|
|
195
194
|
analysisBound = true
|
|
196
|
-
Log.d(TAG, "[CAMERAX-FIX] Camera
|
|
195
|
+
Log.d(TAG, "[CAMERAX-FIX-V3] Camera bound with lower resolution")
|
|
197
196
|
} catch (e: Exception) {
|
|
198
|
-
Log.e(TAG, "[CAMERAX-FIX] Failed to bind camera use cases", e)
|
|
197
|
+
Log.e(TAG, "[CAMERAX-FIX-V3] Failed to bind camera use cases", e)
|
|
199
198
|
analysisBound = false
|
|
200
199
|
}
|
|
201
200
|
}
|
|
@@ -78,7 +78,7 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
|
|
|
78
78
|
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
|
79
79
|
visibility = View.VISIBLE
|
|
80
80
|
keepScreenOn = true
|
|
81
|
-
implementationMode = PreviewView.ImplementationMode.
|
|
81
|
+
implementationMode = PreviewView.ImplementationMode.PERFORMANCE
|
|
82
82
|
scaleType = PreviewView.ScaleType.FILL_CENTER
|
|
83
83
|
}
|
|
84
84
|
Log.d(TAG, "[INIT] PreviewView created: $previewView")
|
package/package.json
CHANGED