capacitor-plugin-camera-forked 3.0.91 → 3.0.93

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.
@@ -1151,8 +1151,17 @@ public class CameraPreviewPlugin extends Plugin {
1151
1151
 
1152
1152
  @PluginMethod
1153
1153
  public void takeSnapshot(PluginCall call) {
1154
- call.setKeepAlive(true);
1155
- takeSnapshotCall = call;
1154
+ if (camera == null) {
1155
+ call.reject("Camera not initialized.");
1156
+ return;
1157
+ }
1158
+
1159
+ try {
1160
+ call.setKeepAlive(true);
1161
+ takeSnapshotCall = call;
1162
+ } catch (Exception e) {
1163
+ call.reject("Failed to take snapshot: " + e.getMessage());
1164
+ }
1156
1165
  }
1157
1166
 
1158
1167
  @PluginMethod
@@ -34,12 +34,12 @@ public class CameraPreviewPlugin: CAPPlugin, AVCaptureVideoDataOutputSampleBuffe
34
34
  var currentCameraDevice: AVCaptureDevice?
35
35
 
36
36
  // Store the desired JPEG quality, set during initialization
37
- var desiredJpegQuality: Float = 0.95 // Default to high quality (0.0-1.0)
37
+ var desiredJpegQuality: CGFloat = 0.95 // Default to high quality (0.0-1.0)
38
38
 
39
39
  @objc func initialize(_ call: CAPPluginCall) {
40
40
  // Get quality parameter from initialization, default to 95% if not specified
41
41
  if let quality = call.getInt("quality") {
42
- desiredJpegQuality = Float(max(1, min(100, quality))) / 100.0
42
+ desiredJpegQuality = CGFloat(max(1, min(100, quality))) / 100.0
43
43
  print("Camera initialized with JPEG quality: \(desiredJpegQuality)")
44
44
  }
45
45
 
@@ -242,6 +242,13 @@ public class CameraPreviewPlugin: CAPPlugin, AVCaptureVideoDataOutputSampleBuffe
242
242
  self.photoOutput.maxPhotoQualityPrioritization = .quality
243
243
  }
244
244
 
245
+ // Enable content aware distortion correction if available
246
+ if #available(iOS 14.1, *) {
247
+ if self.photoOutput.isContentAwareDistortionCorrectionSupported {
248
+ self.photoOutput.isContentAwareDistortionCorrectionEnabled = true
249
+ }
250
+ }
251
+
245
252
  if self.captureSession.canAddOutput(self.photoOutput) {
246
253
  self.captureSession.addOutput(photoOutput)
247
254
  }
@@ -335,7 +342,9 @@ public class CameraPreviewPlugin: CAPPlugin, AVCaptureVideoDataOutputSampleBuffe
335
342
 
336
343
  // Enable auto-focus and auto-exposure for optimal capture
337
344
  if #available(iOS 14.1, *) {
338
- photoSettings.isAutoContentAwareDistortionCorrectionEnabled = true
345
+ if self.photoOutput.isContentAwareDistortionCorrectionEnabled {
346
+ photoSettings.isAutoContentAwareDistortionCorrectionEnabled = true
347
+ }
339
348
  }
340
349
 
341
350
  // Enhanced focus before capture for better close-up performance
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-plugin-camera-forked",
3
- "version": "3.0.91",
3
+ "version": "3.0.93",
4
4
  "description": "A capacitor camera plugin - A custom Capacitor camera plugin with additional features.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",