capacitor-camera-view 1.1.0 → 1.1.1

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.
@@ -40,6 +40,15 @@ extension CameraViewManager: AVCaptureMetadataOutputObjectsDelegate {
40
40
  ]
41
41
  }
42
42
 
43
+ /// Remove the metadata output if in case it is already configured, e.g. because
44
+ /// the camera is restarted with a diffrent setting where barcode detection was disabled
45
+ /// again
46
+ internal func removeMetadataOutput() {
47
+ if let metadataOutput = captureSession.outputs.first(where: { $0 is AVCaptureMetadataOutput }) {
48
+ captureSession.removeOutput(metadataOutput)
49
+ }
50
+ }
51
+
43
52
  /// Delegate method called when metadata objects are detected in the camera feed
44
53
  ///
45
54
  /// This method processes barcode data detected in the camera stream. When a barcode is detected,
@@ -318,6 +318,10 @@ internal let SUPPORTED_CAMERA_DEVICE_TYPES: [AVCaptureDevice.DeviceType] = [
318
318
  // Setup metadata output for QR code scanning if enabled
319
319
  if configuration.enableBarcodeDetection {
320
320
  try setupMetadataOutput()
321
+ } else {
322
+ // Remove the metadata output in case it already existed for the
323
+ // capture session
324
+ removeMetadataOutput()
321
325
  }
322
326
 
323
327
  // Set the initial zoom factor if specified
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-camera-view",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A Capacitor plugin for embedding a live camera feed directly into your app.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",