capacitor-plugin-camera-forked 2.0.11 → 2.0.12

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.
@@ -545,23 +545,28 @@ public class CameraPreviewPlugin: CAPPlugin, AVCaptureVideoDataOutputSampleBuffe
545
545
 
546
546
  // 1. Check if focus point is supported
547
547
  guard device.isFocusPointOfInterestSupported else {
548
+ device.unlockForConfiguration()
548
549
  call.reject("Focus point of interest not supported on this device")
549
550
  return
550
551
  }
551
552
 
552
553
  // 2. Set focus point
553
554
  device.focusPointOfInterest = CGPoint(x: CGFloat(x), y: CGFloat(y))
554
-
555
555
  // 3. Set focus mode (choose one supported by your use case)
556
- if device.isFocusModeSupported(.autoFocus) {
557
- device.focusMode = .autoFocus
558
- } else if device.isFocusModeSupported(.continuousAutoFocus) {
556
+ if device.isFocusModeSupported(.continuousAutoFocus) {
559
557
  device.focusMode = .continuousAutoFocus
558
+ } else if device.isFocusModeSupported(.autoFocus) {
559
+ device.focusMode = .autoFocus
560
560
  } else {
561
561
  call.reject("No supported focus mode available")
562
562
  return
563
563
  }
564
- call.resolve()
564
+
565
+ DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
566
+ device.unlockForConfiguration()
567
+ }
568
+
569
+ call.resolve()
565
570
  } catch {
566
571
  call.reject("Failed to lock device for configuration: \(error.localizedDescription)")
567
572
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-plugin-camera-forked",
3
- "version": "2.0.11",
3
+ "version": "2.0.12",
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",