react-native-rectangle-doc-scanner 3.188.0 → 3.190.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
 
@@ -117,8 +121,9 @@ class CameraController(
117
121
  Log.d(TAG, "[BIND] Creating ImageCapture use case...")
118
122
  imageCapture = ImageCapture.Builder()
119
123
  .setCaptureMode(ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY)
120
- // Use aspect ratio to avoid unsupported size combinations on some devices.
121
- .setTargetAspectRatio(AspectRatio.RATIO_4_3)
124
+ // Cap resolution to avoid camera session timeouts on lower-end devices.
125
+ .setTargetResolution(Size(1280, 960))
126
+ .setTargetRotation(targetRotation)
122
127
  .setFlashMode(ImageCapture.FLASH_MODE_AUTO)
123
128
  .build()
124
129
  Log.d(TAG, "[BIND] ImageCapture created: $imageCapture")
@@ -127,8 +132,9 @@ class CameraController(
127
132
  imageAnalysis = if (enableDetection) {
128
133
  Log.d(TAG, "[BIND] Creating ImageAnalysis use case...")
129
134
  ImageAnalysis.Builder()
130
- // Use aspect ratio to avoid unsupported size combinations on some devices.
131
- .setTargetAspectRatio(AspectRatio.RATIO_4_3)
135
+ // Keep analysis lightweight to prevent session configuration timeouts.
136
+ .setTargetResolution(Size(960, 720))
137
+ .setTargetRotation(targetRotation)
132
138
  .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
133
139
  .setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888)
134
140
  .build()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.188.0",
3
+ "version": "3.190.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",