capacitor-plugin-camera-forked 3.0.13 → 3.0.44
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.
|
@@ -449,7 +449,7 @@ public class CameraPreviewPlugin extends Plugin {
|
|
|
449
449
|
|
|
450
450
|
@PluginMethod
|
|
451
451
|
public void setZoom(PluginCall call) {
|
|
452
|
-
if (call.hasOption("factor")) {
|
|
452
|
+
if (call.hasOption("factor") && camera != null) {
|
|
453
453
|
Float factor = call.getFloat("factor");
|
|
454
454
|
try {
|
|
455
455
|
camera.getCameraControl().setZoomRatio(factor);
|
|
@@ -417,7 +417,9 @@ public class CameraPreviewPlugin: CAPPlugin, AVCaptureVideoDataOutputSampleBuffe
|
|
|
417
417
|
normalized = croppedUIImage(image: normalized, scanRegion: self.scanRegion)
|
|
418
418
|
}
|
|
419
419
|
if takeSnapshotCall != nil {
|
|
420
|
-
let
|
|
420
|
+
let qualityValue = takeSnapshotCall.getFloat("quality") ?? 100.0
|
|
421
|
+
let quality = CGFloat(qualityValue / 100.0) // Convert percentage to 0.0-1.0 range
|
|
422
|
+
let base64 = getBase64FromImage(image: normalized, quality: quality);
|
|
421
423
|
var ret = PluginCallResultData()
|
|
422
424
|
ret["base64"] = base64
|
|
423
425
|
takeSnapshotCall.resolve(ret)
|
|
@@ -1105,4 +1107,4 @@ public class CameraPreviewPlugin: CAPPlugin, AVCaptureVideoDataOutputSampleBuffe
|
|
|
1105
1107
|
focusCompletionTimer?.invalidate()
|
|
1106
1108
|
}
|
|
1107
1109
|
|
|
1108
|
-
}
|
|
1110
|
+
}
|
package/package.json
CHANGED