react-native-rectangle-doc-scanner 3.223.0 → 3.225.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.
|
@@ -175,11 +175,15 @@ class CameraController(
|
|
|
175
175
|
|
|
176
176
|
val rotation = previewView.display?.rotation ?: Surface.ROTATION_0
|
|
177
177
|
|
|
178
|
-
// Build Preview ONLY
|
|
178
|
+
// Build Preview ONLY with minimal resolution to reduce HAL load
|
|
179
179
|
preview = Preview.Builder()
|
|
180
|
-
.setTargetResolution(Size(
|
|
180
|
+
.setTargetResolution(Size(640, 480))
|
|
181
181
|
.setTargetRotation(rotation)
|
|
182
182
|
.build()
|
|
183
|
+
.also {
|
|
184
|
+
// IMPORTANT: Set surface provider BEFORE binding
|
|
185
|
+
it.setSurfaceProvider(previewView.surfaceProvider)
|
|
186
|
+
}
|
|
183
187
|
|
|
184
188
|
val cameraSelector = if (useFrontCamera) {
|
|
185
189
|
CameraSelector.DEFAULT_FRONT_CAMERA
|
|
@@ -195,70 +199,20 @@ class CameraController(
|
|
|
195
199
|
preview
|
|
196
200
|
)
|
|
197
201
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
Log.d(TAG, "[CAMERAX-V7] Preview ONLY bound successfully")
|
|
202
|
+
Log.d(TAG, "[CAMERAX-V9] Preview bound with 640x480 resolution")
|
|
203
|
+
Log.d(TAG, "[CAMERAX-V9] Waiting for capture session to configure...")
|
|
202
204
|
|
|
203
|
-
//
|
|
205
|
+
// Log session state after some time
|
|
204
206
|
android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
+
Log.d(TAG, "[CAMERAX-V9] Camera state check - preview should be working now")
|
|
208
|
+
}, 6000)
|
|
207
209
|
|
|
208
210
|
} catch (e: Exception) {
|
|
209
|
-
Log.e(TAG, "[CAMERAX-
|
|
211
|
+
Log.e(TAG, "[CAMERAX-V8] Failed to bind preview", e)
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
214
|
|
|
213
|
-
|
|
214
|
-
Log.d(TAG, "[CAMERAX-V7] Attempting to add ImageCapture...")
|
|
215
|
-
|
|
216
|
-
// Build ImageCapture with minimal resolution
|
|
217
|
-
imageCapture = ImageCapture.Builder()
|
|
218
|
-
.setTargetResolution(Size(320, 240))
|
|
219
|
-
.setTargetRotation(rotation)
|
|
220
|
-
.setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
|
|
221
|
-
.build()
|
|
222
|
-
|
|
223
|
-
try {
|
|
224
|
-
// Unbind and rebind with both
|
|
225
|
-
provider.unbindAll()
|
|
226
|
-
|
|
227
|
-
camera = provider.bindToLifecycle(
|
|
228
|
-
lifecycleOwner,
|
|
229
|
-
cameraSelector,
|
|
230
|
-
preview,
|
|
231
|
-
imageCapture
|
|
232
|
-
)
|
|
233
|
-
|
|
234
|
-
preview?.setSurfaceProvider(previewView.surfaceProvider)
|
|
235
|
-
|
|
236
|
-
Log.d(TAG, "[CAMERAX-V7] ImageCapture added successfully")
|
|
237
|
-
|
|
238
|
-
// Start periodic frame capture
|
|
239
|
-
if (detectionEnabled) {
|
|
240
|
-
isAnalysisActive = true
|
|
241
|
-
analysisHandler.postDelayed(analysisRunnable, 500)
|
|
242
|
-
Log.d(TAG, "[CAMERAX-V7] Started periodic frame capture")
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
} catch (e: Exception) {
|
|
246
|
-
Log.e(TAG, "[CAMERAX-V7] Failed to add ImageCapture, keeping Preview only", e)
|
|
247
|
-
|
|
248
|
-
// Fallback: Keep preview only and disable detection
|
|
249
|
-
try {
|
|
250
|
-
camera = provider.bindToLifecycle(
|
|
251
|
-
lifecycleOwner,
|
|
252
|
-
cameraSelector,
|
|
253
|
-
preview
|
|
254
|
-
)
|
|
255
|
-
preview?.setSurfaceProvider(previewView.surfaceProvider)
|
|
256
|
-
Log.d(TAG, "[CAMERAX-V7] Fallback: Preview only mode (detection disabled)")
|
|
257
|
-
} catch (fallbackException: Exception) {
|
|
258
|
-
Log.e(TAG, "[CAMERAX-V7] Fallback failed", fallbackException)
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
215
|
+
// Function removed - this device cannot handle ImageCapture + Preview simultaneously
|
|
262
216
|
|
|
263
217
|
private fun captureFrameForAnalysis() {
|
|
264
218
|
val capture = imageCapture ?: return
|
|
@@ -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.COMPATIBLE
|
|
82
82
|
scaleType = PreviewView.ScaleType.FILL_CENTER
|
|
83
83
|
}
|
|
84
84
|
Log.d(TAG, "[INIT] PreviewView created: $previewView")
|
package/package.json
CHANGED