@scr2em/capacitor-scanner 6.0.9 → 6.0.11

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.
@@ -66,9 +66,19 @@ public class CapacitorScannerPlugin: CAPPlugin, CAPBridgedPlugin, AVCaptureMetad
66
66
  // Check if JPEG is supported and apply compression settings if it is
67
67
  if photoOutput.supportedPhotoCodecTypes(for: .jpg).contains(.jpeg) {
68
68
  // Create settings specific for JPEG with quality
69
- photoSettings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecType.jpeg, // Use the type directly
69
+ photoSettings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecType.jpeg,
70
70
  AVVideoCompressionPropertiesKey: [AVVideoQualityKey: qualityNumber]])
71
- photoSettings.photoQualityPrioritization = .quality // Prioritize quality
71
+
72
+ let maxPrioritization = photoOutput.maxPhotoQualityPrioritization
73
+ // Compare the raw values to determine which prioritization to use
74
+ if maxPrioritization.rawValue >= AVCapturePhotoOutput.QualityPrioritization.balanced.rawValue {
75
+ // Device supports .balanced prioritization
76
+ photoSettings.photoQualityPrioritization = .balanced
77
+ } else {
78
+ // Use the lowest prioritization (.speed)
79
+ photoSettings.photoQualityPrioritization = .speed
80
+ }
81
+
72
82
  } else {
73
83
  print("JPEG codec not supported for photo capture. Using default settings.")
74
84
  // photoSettings remains the default initialized one
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scr2em/capacitor-scanner",
3
- "version": "6.0.9",
3
+ "version": "6.0.11",
4
4
  "description": "scan codes",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",