capacitor-camera-view 2.4.0 → 3.0.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.
Files changed (44) hide show
  1. package/CapacitorCameraView.podspec +1 -1
  2. package/Package.swift +1 -1
  3. package/README.md +341 -49
  4. package/android/build.gradle +0 -1
  5. package/android/src/main/AndroidManifest.xml +0 -1
  6. package/android/src/main/java/com/michaelwolz/capacitorcameraview/CameraError.kt +42 -0
  7. package/android/src/main/java/com/michaelwolz/capacitorcameraview/CameraView.kt +945 -207
  8. package/android/src/main/java/com/michaelwolz/capacitorcameraview/CameraViewPlugin.kt +87 -43
  9. package/android/src/main/java/com/michaelwolz/capacitorcameraview/model/BarcodeDetectionResult.kt +28 -2
  10. package/android/src/main/java/com/michaelwolz/capacitorcameraview/model/CameraDevice.kt +6 -1
  11. package/android/src/main/java/com/michaelwolz/capacitorcameraview/model/CameraSessionConfiguration.kt +15 -1
  12. package/android/src/main/java/com/michaelwolz/capacitorcameraview/model/TorchModeState.kt +15 -0
  13. package/android/src/main/java/com/michaelwolz/capacitorcameraview/model/WebBoundingRect.kt +1 -1
  14. package/android/src/main/java/com/michaelwolz/capacitorcameraview/utils.kt +73 -19
  15. package/dist/docs.json +475 -30
  16. package/dist/esm/definitions.d.ts +478 -26
  17. package/dist/esm/definitions.js.map +1 -1
  18. package/dist/esm/utils.d.ts +59 -15
  19. package/dist/esm/utils.js +79 -38
  20. package/dist/esm/utils.js.map +1 -1
  21. package/dist/esm/web.d.ts +191 -13
  22. package/dist/esm/web.js +624 -141
  23. package/dist/esm/web.js.map +1 -1
  24. package/dist/plugin.cjs.js +711 -179
  25. package/dist/plugin.cjs.js.map +1 -1
  26. package/dist/plugin.js +711 -179
  27. package/dist/plugin.js.map +1 -1
  28. package/ios/Sources/CameraViewPlugin/CameraError.swift +147 -2
  29. package/ios/Sources/CameraViewPlugin/CameraEvents.swift +41 -19
  30. package/ios/Sources/CameraViewPlugin/CameraSessionConfiguration.swift +29 -1
  31. package/ios/Sources/CameraViewPlugin/CameraViewManager+BarcodeScan.swift +78 -23
  32. package/ios/Sources/CameraViewPlugin/CameraViewManager+DeferredStart.swift +37 -0
  33. package/ios/Sources/CameraViewPlugin/CameraViewManager+Focus.swift +131 -0
  34. package/ios/Sources/CameraViewPlugin/CameraViewManager+Lifecycle.swift +156 -0
  35. package/ios/Sources/CameraViewPlugin/CameraViewManager+PhotoCapture.swift +73 -41
  36. package/ios/Sources/CameraViewPlugin/CameraViewManager+ResolutionSelection.swift +57 -0
  37. package/ios/Sources/CameraViewPlugin/CameraViewManager+Rotation.swift +200 -0
  38. package/ios/Sources/CameraViewPlugin/CameraViewManager+VideoDataOutput.swift +24 -12
  39. package/ios/Sources/CameraViewPlugin/CameraViewManager+VideoRecording.swift +22 -73
  40. package/ios/Sources/CameraViewPlugin/CameraViewManager+Zoom.swift +113 -0
  41. package/ios/Sources/CameraViewPlugin/CameraViewManager.swift +450 -403
  42. package/ios/Sources/CameraViewPlugin/CameraViewPlugin.swift +98 -65
  43. package/ios/Sources/CameraViewPlugin/Utils.swift +61 -7
  44. package/package.json +25 -9
package/README.md CHANGED
@@ -56,6 +56,9 @@ npx cap sync
56
56
 
57
57
  #### iOS
58
58
 
59
+ > [!IMPORTANT]
60
+ > This plugin requires a minimum deployment target of **iOS 16**. iOS 15 is no longer supported.
61
+
59
62
  Add the following keys to your app's `Info.plist` file:
60
63
 
61
64
  ```xml
@@ -75,15 +78,23 @@ If you plan to use `startRecording` with `enableAudio: true`, also add:
75
78
 
76
79
  #### Android
77
80
 
78
- The `CAMERA` permission is added to your app's `AndroidManifest.xml` automatically by the plugin. If you plan to use `startRecording` with `enableAudio: true`, the `RECORD_AUDIO` permission is also declared automatically by the plugin. You can verify these in your merged manifest:
81
+ You must declare the `CAMERA` permission yourself in your app's `AndroidManifest.xml`:
79
82
 
80
83
  ```xml
81
84
  <uses-permission android:name="android.permission.CAMERA" />
85
+ ```
86
+
87
+ If you plan to use `startRecording` with `enableAudio: true`, you must also declare the `RECORD_AUDIO` permission in your app's `AndroidManifest.xml`:
88
+
89
+ ```xml
82
90
  <uses-permission android:name="android.permission.RECORD_AUDIO" />
83
91
  ```
84
92
 
85
93
  > [!IMPORTANT]
86
- > Declaring a permission in `AndroidManifest.xml` is required for the system to allow requesting it at runtime. The plugin handles this for you, but make sure you are not accidentally stripping the permission in your build configuration.
94
+ > Declaring a permission in `AndroidManifest.xml` is required for the system to allow requesting it at runtime. The plugin does not declare `CAMERA` or `RECORD_AUDIO` for you, so make sure you add `CAMERA` for camera use, and `RECORD_AUDIO` as well if you record video with audio.
95
+
96
+ > [!WARNING]
97
+ > **Breaking change (Android):** as of this release, the plugin no longer declares `android.permission.RECORD_AUDIO` in its manifest. Apps that call `startRecording` with `enableAudio: true` **must** add `<uses-permission android:name="android.permission.RECORD_AUDIO" />` to their own `AndroidManifest.xml`, otherwise audio recording will fail at runtime. Apps that only record video without audio (or don't record at all) are unaffected and no longer need to carry this permission.
87
98
 
88
99
  ## 🔒 Permissions
89
100
 
@@ -196,9 +207,13 @@ On supported iPhone models (like the Pro series), this plugin can utilize the [*
196
207
  * Slightly higher resource usage compared to using a single physical camera (the camera view will take a little longer until initialized).
197
208
  * Only available on specific iPhone models with triple camera systems.
198
209
 
210
+ The session starts on the virtual device directly, so there is no visible transition — the first frame the user sees is already the wide-angle ("1x") field of view. Note that `zoomFactor` is interpreted relative to the wide-angle lens while `getZoom()` reports the device's raw zoom domain, in which `1.0` is the ultra-wide lens.
211
+
212
+ On iOS 26 and later the plugin additionally uses [Deferred Start](https://developer.apple.com/documentation/avfoundation/avcaptureoutput/deferredstartenabled) so only the preview pipeline is initialized before the first frame is displayed; photo capture, snapshots and barcode detection are brought up a moment later. This roughly halves the time until the preview appears and is what makes starting on the virtual device affordable.
213
+
199
214
  For more details on the underlying technology, refer to Apple's documentation on [AVCaptureDevice.builtInTripleCamera](https://developer.apple.com/documentation/avfoundation/avcapturedevice/devicetype-swift.struct/builtintriplecamera).
200
215
 
201
- Alternatively, you can specify the `preferredCameraDeviceTypes` option in the <code><a href="#camerasessionconfiguration">CameraSessionConfiguration</a></code> to prioritize specific virtual cameras, such as the [dual camera system](https://developer.apple.com/documentation/avfoundation/avcapturedevice/devicetype-swift.struct/builtindualcamera). While this provides similar functionality, the `useTripleCameraIfAvailable` option offers the advantage of a smoother transition during camera initialization and lens switching (blurred overlay).
216
+ Alternatively, you can specify the `preferredCameraDeviceTypes` option in the <code><a href="#camerasessionconfiguration">CameraSessionConfiguration</a></code> to prioritize specific virtual cameras, such as the [dual camera system](https://developer.apple.com/documentation/avfoundation/avcapturedevice/devicetype-swift.struct/builtindualcamera). `useTripleCameraIfAvailable` takes precedence over `preferredCameraDeviceTypes` for the rear camera.
202
217
 
203
218
  ## 🔍 Barcode Detection
204
219
 
@@ -281,6 +296,69 @@ await CameraView.startRecording({
281
296
 
282
297
  See the [`VideoRecordingOptions`](#videorecordingoptions) and [`VideoRecordingResponse`](#videorecordingresponse) interfaces in the API section for the full set of options.
283
298
 
299
+ ## ⚠️ Error Handling
300
+
301
+ Every rejected plugin call carries a stable, platform-independent `code` string in addition to the human-readable `message`, so you can `switch` on `error.code` instead of matching on message text (which may change between releases or be localized).
302
+
303
+ ```typescript
304
+ import { CameraView, type CameraErrorCode } from 'capacitor-camera-view';
305
+
306
+ try {
307
+ await CameraView.start();
308
+ } catch (error) {
309
+ const code = (error as { code?: CameraErrorCode }).code;
310
+
311
+ switch (code) {
312
+ case 'PERMISSION_DENIED':
313
+ // Prompt the user to grant camera access in system settings
314
+ break;
315
+ case 'SESSION_NOT_RUNNING':
316
+ // The capture session isn't up yet; call start() again
317
+ break;
318
+ default:
319
+ console.error('Failed to start camera', error);
320
+ }
321
+ }
322
+ ```
323
+
324
+ > [!NOTE]
325
+ > Emitted on iOS, Android, and web. One divergence: on web, methods with no web
326
+ > implementation (e.g. `setFocusPoint()`, `setTorchMode()`) reject with
327
+ > `error.code === 'UNIMPLEMENTED'` - Capacitor's own not-implemented convention -
328
+ > instead of one of the codes below.
329
+
330
+ | Code | Meaning |
331
+ | -------------------------------- | --------------------------------------------------------------------------------- |
332
+ | `CAMERA_UNAVAILABLE` | No available camera for the requested position. |
333
+ | `CONFIGURATION_FAILED` | Failed to configure the camera session. |
334
+ | `FRAME_CAPTURE_ERROR` | Failed to capture a frame from the camera. |
335
+ | `INPUT_ADDITION_FAILED` | Failed to add an input to the capture session. |
336
+ | `OUTPUT_ADDITION_FAILED` | Failed to add an output to the capture session. |
337
+ | `PHOTO_OUTPUT_ERROR` | An error occurred while capturing a photo. |
338
+ | `PHOTO_OUTPUT_NOT_CONFIGURED` | The photo output has not been configured. |
339
+ | `SESSION_NOT_RUNNING` | The capture session is not currently running. Call `start()` first. |
340
+ | `SESSION_ALREADY_RUNNING` | A camera session is already running. Call `stop()` before starting a new one. |
341
+ | `UNSUPPORTED_FLASH_MODE` | The requested flash mode is not supported by the current camera. |
342
+ | `TORCH_UNAVAILABLE` | Torch is not available on this device or camera position. |
343
+ | `ZOOM_FACTOR_OUT_OF_RANGE` | The requested zoom factor is out of the supported range. |
344
+ | `FOCUS_NOT_SUPPORTED` | The current camera cannot focus or meter at a point (e.g. a fixed-focus camera). |
345
+ | `PERMISSION_DENIED` | Camera or microphone access has been denied. |
346
+ | `DEVICE_LOCKED` | The camera device is currently locked by another process. |
347
+ | `RECORDING_ALREADY_IN_PROGRESS` | A video recording is already in progress. |
348
+ | `NO_RECORDING_IN_PROGRESS` | `stopRecording()` was called but no recording is in progress. |
349
+ | `AUDIO_DEVICE_UNAVAILABLE` | No microphone is available on this device. |
350
+ | `AUDIO_INPUT_ADDITION_FAILED` | Failed to add the microphone input to the capture session. |
351
+ | `CAPTURE_IN_PROGRESS` | A capture is already in progress. |
352
+ | `CAPTURE_TIMEOUT` | Timed out waiting for a camera frame. |
353
+ | `WEBVIEW_UNAVAILABLE` | Could not find the web view to render the camera preview into. |
354
+ | `INVALID_ARGUMENT` | An argument passed to the method call was missing or invalid. |
355
+ | `IMAGE_COMPRESSION_FAILED` | Failed to compress the captured image. |
356
+ | `PATH_CONVERSION_FAILED` | Failed to create a web-accessible path for a captured file. |
357
+ | `FILE_WRITE_FAILED` | Failed to write the captured file to disk. |
358
+ | `CAPTURE_OUTPUT_MISSING` | The capture completed but produced no output data. |
359
+ | `LIFECYCLE_OWNER_MISSING` | (Android only) The WebView's context is not a `LifecycleOwner`, so the camera session cannot be bound. |
360
+ | `UNKNOWN_ERROR` | An unexpected error that does not map to a known camera error. |
361
+
284
362
  ## 🧪 Example App
285
363
 
286
364
  To see the plugin in action, check out the example app in the `example-app` folder. The app demonstrates how to integrate and use the Capacitor Camera View plugin in an Ionic Angular project.
@@ -319,6 +397,7 @@ chore: update dependencies
319
397
  * [`getAvailableDevices()`](#getavailabledevices)
320
398
  * [`getZoom()`](#getzoom)
321
399
  * [`setZoom(...)`](#setzoom)
400
+ * [`setFocusPoint(...)`](#setfocuspoint)
322
401
  * [`getFlashMode()`](#getflashmode)
323
402
  * [`getSupportedFlashModes()`](#getsupportedflashmodes)
324
403
  * [`setFlashMode(...)`](#setflashmode)
@@ -328,7 +407,10 @@ chore: update dependencies
328
407
  * [`checkPermissions()`](#checkpermissions)
329
408
  * [`requestPermissions(...)`](#requestpermissions)
330
409
  * [`addListener('barcodeDetected', ...)`](#addlistenerbarcodedetected-)
331
- * [`removeAllListeners(...)`](#removealllisteners)
410
+ * [`addListener('cameraInterrupted', ...)`](#addlistenercamerainterrupted-)
411
+ * [`addListener('cameraResumed', ...)`](#addlistenercameraresumed-)
412
+ * [`addListener('cameraRuntimeError', ...)`](#addlistenercameraruntimeerror-)
413
+ * [`removeAllListeners()`](#removealllisteners)
332
414
  * [Interfaces](#interfaces)
333
415
  * [Type Aliases](#type-aliases)
334
416
 
@@ -339,6 +421,12 @@ chore: update dependencies
339
421
 
340
422
  Main plugin interface for Capacitor Camera View functionality.
341
423
 
424
+ When a method below rejects, the resulting error carries a `code` property
425
+ set to one of the stable `CameraErrorCode` strings so consumers can
426
+ `switch` on `error.code` instead of matching on the human-readable message.
427
+ See the `CameraErrorCode` type for the full vocabulary, including the one
428
+ divergence on web for methods with no web implementation.
429
+
342
430
  ### start(...)
343
431
 
344
432
  ```typescript
@@ -347,6 +435,9 @@ start(options?: CameraSessionConfiguration | undefined) => Promise<void>
347
435
 
348
436
  Start the camera view with optional configuration.
349
437
 
438
+ Rejects if a camera session is already running. Call `stop()` first if you need to
439
+ start a new session with different options.
440
+
350
441
  | Param | Type | Description |
351
442
  | ------------- | --------------------------------------------------------------------------------- | ---------------------------------------------- |
352
443
  | **`options`** | <code><a href="#camerasessionconfiguration">CameraSessionConfiguration</a></code> | - Configuration options for the camera session |
@@ -387,7 +478,7 @@ Check if the camera view is currently running.
387
478
  ### capture(...)
388
479
 
389
480
  ```typescript
390
- capture<T extends CaptureOptions>(options: T) => Promise<CaptureResponse<T>>
481
+ capture<T extends CaptureOptions = CaptureOptions & { saveToFile?: undefined; }>(options?: T | undefined) => Promise<CaptureResponse<T>>
391
482
  ```
392
483
 
393
484
  Capture a photo using the current camera configuration.
@@ -406,7 +497,7 @@ Capture a photo using the current camera configuration.
406
497
  ### captureSample(...)
407
498
 
408
499
  ```typescript
409
- captureSample<T extends CaptureOptions>(options: T) => Promise<CaptureResponse<T>>
500
+ captureSample<T extends CaptureOptions = CaptureOptions & { saveToFile?: undefined; }>(options?: T | undefined) => Promise<CaptureResponse<T>>
410
501
  ```
411
502
 
412
503
  Captures a frame from the current camera preview without using the full camera capture pipeline.
@@ -472,6 +563,11 @@ flipCamera() => Promise<void>
472
563
 
473
564
  Switch between front and back camera.
474
565
 
566
+ Rejects with `RECORDING_ALREADY_IN_PROGRESS` while a video recording is active, on
567
+ iOS, Android, and web alike: swapping the camera input/device mid-recording would
568
+ either drop the audio track or interrupt the recording outright, so the recording is
569
+ left intact and must be stopped before flipping.
570
+
475
571
  **Since:** 1.0.0
476
572
 
477
573
  --------------------
@@ -500,6 +596,14 @@ getZoom() => Promise<GetZoomResponse>
500
596
 
501
597
  Get current zoom level information and available range.
502
598
 
599
+ On iOS, when the camera is a virtual device (e.g. the triple camera enabled via
600
+ `useTripleCameraIfAvailable`), the returned values are in the device's raw zoom domain and are
601
+ not UI multipliers like "0.5x"/"1x"/"2x". A `min` of `1.0` corresponds to the widest constituent
602
+ lens (the ultra-wide "0.5x" lens), so a session started at the default zoom reports a `current`
603
+ of the wide-lens switch-over factor (typically `2.0`) rather than `1.0`. Treat these numbers as
604
+ device-relative and derive the usable range from `min`/`max` instead of assuming `1.0` is the
605
+ default.
606
+
503
607
  **Returns:** <code>Promise&lt;<a href="#getzoomresponse">GetZoomResponse</a>&gt;</code>
504
608
 
505
609
  **Since:** 1.0.0
@@ -515,6 +619,10 @@ setZoom(options: { level: number; ramp?: boolean; }) => Promise<void>
515
619
 
516
620
  Set the camera zoom level.
517
621
 
622
+ On iOS virtual devices (e.g. the triple camera) `level` is a raw device zoom factor, not a UI
623
+ multiplier. Derive valid values from the `min`/`max` returned by `getZoom()` rather than assuming
624
+ `1.0` maps to the wide "1x" lens.
625
+
518
626
  | Param | Type | Description |
519
627
  | ------------- | ----------------------------------------------- | ---------------------------- |
520
628
  | **`options`** | <code>{ level: number; ramp?: boolean; }</code> | - Zoom configuration options |
@@ -524,6 +632,34 @@ Set the camera zoom level.
524
632
  --------------------
525
633
 
526
634
 
635
+ ### setFocusPoint(...)
636
+
637
+ ```typescript
638
+ setFocusPoint(options: { x: number; y: number; }) => Promise<void>
639
+ ```
640
+
641
+ Focus and meter the camera at a specific point (tap-to-focus).
642
+
643
+ Because the WebView sits above the native camera preview and consumes every
644
+ touch, the native preview can never receive tap gestures itself. Instead,
645
+ the app catches the tap in the DOM and forwards its coordinates here; since
646
+ the native preview is always rendered fullscreen behind the WebView, the
647
+ mapping to the sensor is deterministic.
648
+
649
+ The camera runs a one-shot focus/exposure at the given point and then
650
+ automatically restores continuous auto-focus/auto-exposure (immediately on a
651
+ subsequent tap, or after a short timeout), so focus is never left
652
+ permanently locked.
653
+
654
+ | Param | Type | Description |
655
+ | ------------- | -------------------------------------- | ----------------------- |
656
+ | **`options`** | <code>{ x: number; y: number; }</code> | - The point to focus on |
657
+
658
+ **Since:** 3.0.0
659
+
660
+ --------------------
661
+
662
+
527
663
  ### getFlashMode()
528
664
 
529
665
  ```typescript
@@ -676,17 +812,86 @@ This event is emitted when a barcode is detected in the camera preview.
676
812
  --------------------
677
813
 
678
814
 
679
- ### removeAllListeners(...)
815
+ ### addListener('cameraInterrupted', ...)
680
816
 
681
817
  ```typescript
682
- removeAllListeners(eventName?: string | undefined) => Promise<void>
818
+ addListener(eventName: 'cameraInterrupted', listenerFunc: (data: CameraInterruptedData) => void) => Promise<PluginListenerHandle>
683
819
  ```
684
820
 
685
- Remove all listeners for this plugin.
821
+ Listen for camera interruption events.
822
+
823
+ Emitted when the capture session is interrupted by the system, for example
824
+ an incoming phone call, another app claiming the camera or microphone,
825
+ losing the camera in iPad Split View, or system pressure. The preview
826
+ typically freezes for the duration of the interruption.
827
+
828
+ | Param | Type | Description |
829
+ | ------------------ | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- |
830
+ | **`eventName`** | <code>'cameraInterrupted'</code> | - The name of the event to listen for ('cameraInterrupted') |
831
+ | **`listenerFunc`** | <code>(data: <a href="#camerainterrupteddata">CameraInterruptedData</a>) =&gt; void</code> | - The callback function to execute when the camera is interrupted |
832
+
833
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
834
+
835
+ **Since:** 3.0.0
836
+
837
+ --------------------
838
+
839
+
840
+ ### addListener('cameraResumed', ...)
841
+
842
+ ```typescript
843
+ addListener(eventName: 'cameraResumed', listenerFunc: () => void) => Promise<PluginListenerHandle>
844
+ ```
845
+
846
+ Listen for camera resume events.
847
+
848
+ Emitted when a previous interruption ends and the capture session resumes,
849
+ for example after an incoming phone call finishes. Pair this with
850
+ `cameraInterrupted` to update your UI when the preview recovers.
851
+
852
+ | Param | Type | Description |
853
+ | ------------------ | ---------------------------- | ---------------------------------------------------------- |
854
+ | **`eventName`** | <code>'cameraResumed'</code> | - The name of the event to listen for ('cameraResumed') |
855
+ | **`listenerFunc`** | <code>() =&gt; void</code> | - The callback function to execute when the camera resumes |
856
+
857
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
858
+
859
+ **Since:** 3.0.0
686
860
 
687
- | Param | Type | Description |
688
- | --------------- | ------------------- | --------------------------------------------- |
689
- | **`eventName`** | <code>string</code> | - Optional event name to remove listeners for |
861
+ --------------------
862
+
863
+
864
+ ### addListener('cameraRuntimeError', ...)
865
+
866
+ ```typescript
867
+ addListener(eventName: 'cameraRuntimeError', listenerFunc: (data: CameraRuntimeErrorData) => void) => Promise<PluginListenerHandle>
868
+ ```
869
+
870
+ Listen for camera runtime error events.
871
+
872
+ Emitted when the capture session hits a runtime error. When the underlying
873
+ media services are reset, the plugin restarts the session automatically, so
874
+ this event is primarily informational for logging and diagnostics.
875
+
876
+ | Param | Type | Description |
877
+ | ------------------ | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
878
+ | **`eventName`** | <code>'cameraRuntimeError'</code> | - The name of the event to listen for ('cameraRuntimeError') |
879
+ | **`listenerFunc`** | <code>(data: <a href="#cameraruntimeerrordata">CameraRuntimeErrorData</a>) =&gt; void</code> | - The callback function to execute when a runtime error occurs |
880
+
881
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
882
+
883
+ **Since:** 3.0.0
884
+
885
+ --------------------
886
+
887
+
888
+ ### removeAllListeners()
889
+
890
+ ```typescript
891
+ removeAllListeners() => Promise<void>
892
+ ```
893
+
894
+ Remove all listeners for this plugin.
690
895
 
691
896
  **Since:** 1.0.0
692
897
 
@@ -700,16 +905,20 @@ Remove all listeners for this plugin.
700
905
 
701
906
  Configuration options for starting a camera session.
702
907
 
703
- | Prop | Type | Description | Default | Since |
704
- | -------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- | ----- |
705
- | **`enableBarcodeDetection`** | <code>boolean</code> | Enables the barcode detection functionality | <code>false</code> | |
706
- | **`barcodeTypes`** | <code>BarcodeType[]</code> | Specific barcode types to detect. If not provided, all supported types are detected. Specifying only the types you need can significantly improve performance and reduce battery consumption, especially on mobile devices. | <code>undefined - all supported types are detected</code> | 2.1.0 |
707
- | **`position`** | <code><a href="#cameraposition">CameraPosition</a></code> | Position of the camera to use | <code>'back'</code> | |
708
- | **`deviceId`** | <code>string</code> | Specific device ID of the camera to use If provided, takes precedence over position | | |
709
- | **`useTripleCameraIfAvailable`** | <code>boolean</code> | Whether to use the triple camera if available (iPhone Pro models only) | <code>false</code> | |
710
- | **`preferredCameraDeviceTypes`** | <code>CameraDeviceType[]</code> | Ordered list of preferred camera device types to use (iOS only). The system will attempt to use the first available camera type in the list. If position is also provided, the system will use the first available camera type that matches the position and is in the list. This will fallback to the default camera type if none of the preferred types are available. | <code>undefined - system will decide based on position/deviceId</code> | |
711
- | **`zoomFactor`** | <code>number</code> | The initial zoom factor to use | <code>1.0</code> | |
712
- | **`containerElementId`** | <code>string</code> | Optional HTML ID of the container element where the camera view should be rendered. If not provided, the camera view will be appended to the document body. Web only. | | |
908
+ | Prop | Type | Description | Default | Since |
909
+ | -------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- | ----- |
910
+ | **`enableBarcodeDetection`** | <code>boolean</code> | Enables the barcode detection functionality | <code>false</code> | |
911
+ | **`barcodeTypes`** | <code>BarcodeType[]</code> | Specific barcode types to detect. If not provided, all supported types are detected. Specifying only the types you need can significantly improve performance and reduce battery consumption, especially on mobile devices. | <code>undefined - all supported types are detected</code> | 2.1.0 |
912
+ | **`position`** | <code><a href="#cameraposition">CameraPosition</a></code> | Position of the camera to use | <code>'back'</code> | |
913
+ | **`deviceId`** | <code>string</code> | Specific device ID of the camera to use If provided, takes precedence over position | | |
914
+ | **`useTripleCameraIfAvailable`** | <code>boolean</code> | Whether to use the triple camera if available (iPhone Pro models only). The session starts directly on the virtual device, which lets iOS switch between the ultra-wide, wide and telephoto lenses automatically. Takes precedence over `preferredCameraDeviceTypes` for the rear camera. | <code>false</code> | |
915
+ | **`preferredCameraDeviceTypes`** | <code>CameraDeviceType[]</code> | Ordered list of preferred camera device types to use (iOS only). The system will attempt to use the first available camera type in the list. If position is also provided, the system will use the first available camera type that matches the position and is in the list. This will fallback to the default camera type if none of the preferred types are available. | <code>undefined - system will decide based on position/deviceId</code> | |
916
+ | **`aspectRatio`** | <code><a href="#cameraaspectratio">CameraAspectRatio</a></code> | The sensor aspect ratio to use for the camera session, applied to both the live preview stream and photo capture so the captured image matches the framing the user sees. **Preview-vs-capture framing contract** (identical on iOS, Android and web when this option is set): - By default (`previewScaleMode: 'cover'`) the preview fills its container (the fullscreen view behind the WebView on iOS/Android, the container element on web) using cover semantics: when the chosen sensor ratio differs from the container ratio, the preview is center-cropped to fill it — never letterboxed. `capture()` returns the full sensor-ratio image (matching this option), NOT the on-screen crop. Parts of the image that were cropped out of the preview by cover-scaling are therefore included in the capture. - With `previewScaleMode: 'fit'` the whole sensor frame is letterboxed to fit inside the container, so the preview shows exactly the full captured frame: `capture()` returns what the preview shows, with nothing cropped out of view. See {@link previewScaleMode} for the letterbox-background note. When this option is omitted, each platform keeps its long-standing default behavior: iOS uses the sensor's native photo format (4:3), Android prefers 16:9 with an automatic fallback, and web requests a 16:9 stream and returns the visible (cover-cropped) preview region from `capture()` instead of the full frame. Captured output stays JPEG on all platforms either way. | <code>undefined - platform default (see above)</code> | 3.0.0 |
917
+ | **`captureMaxDimension`** | <code>number</code> | Optional capture-resolution hint: an upper bound, in pixels, for the longer edge of captured photos. The platform picks the largest supported capture resolution whose longer edge does not exceed this value (falling back to the closest supported resolution when none fits) while keeping the configured `aspectRatio`. This is a best-effort hint: the exact output dimensions depend on the resolutions the sensor/browser actually supports. - iOS: constrains `AVCapturePhotoOutput.maxPhotoDimensions`. Only affects `capture()`; `captureSample()` keeps sampling the preview stream. - Android: bounds the CameraX ImageCapture resolution. Only affects `capture()`. - Web: used as the ideal `getUserMedia` width constraint, so it affects the stream (preview and capture alike). | <code>undefined - platform default resolution</code> | 3.0.0 |
918
+ | **`previewScaleMode`** | <code><a href="#previewscalemode">PreviewScaleMode</a></code> | How the live preview is scaled into its container when the sensor aspect ratio differs from the container's aspect ratio. - `'cover'` (default): the preview fills the container, center-cropping the frame. This is the long-standing behavior and is unchanged when the option is omitted. - `'fit'`: the whole sensor frame is scaled to fit inside the container (letterboxed), so the user sees the entire frame they are about to capture. In `fit` mode the preview shows exactly the full captured frame, and `capture()` returns what the preview shows. Applied consistently on iOS (`AVCaptureVideoPreviewLayer.videoGravity`), Android (`PreviewView.ScaleType`) and web (`object-fit`). Barcode `boundingRect` and `setFocusPoint` coordinates stay correct in both modes. **Letterbox background**: the empty bars shown in `fit` mode are not painted by the plugin — they show whatever is visually behind/around the preview. On iOS/Android that is the app's own background showing through the transparent WebView; on web it is the container element's background. Style that background (e.g. a black or themed color) to control how the letterbox bars look. | <code>'cover'</code> | 3.0.0 |
919
+ | **`zoomFactor`** | <code>number</code> | The initial zoom factor to use. Expressed relative to the wide-angle lens, so `1.0` is the familiar "1x" field of view on every camera. On iOS virtual devices whose raw `1.0` is the ultra-wide lens (e.g. the triple camera enabled via `useTripleCameraIfAvailable`) the factor is scaled into the device's own zoom domain, which is why `getZoom()` reports a larger `current` than the value passed here. | <code>1.0</code> | |
920
+ | **`prioritizeQuality`** | <code>boolean</code> | Prioritize photo quality over capture responsiveness (iOS 17+ only). By default the plugin opts into the iOS 17+ responsive-capture pipeline (zero-shutter-lag, responsive capture and fast capture prioritization) so consecutive `capture()` calls have a lower shot-to-shot latency. Rapid consecutive captures may then be delivered at a slightly reduced quality instead of queueing. Set this to `true` to opt out of that behavior and always prioritize photo quality. Has no effect on iOS versions or hardware without support for the responsive-capture APIs, and no effect on Android or Web. | <code>false</code> | 3.0.0 |
921
+ | **`containerElementId`** | <code>string</code> | Optional HTML ID of the container element where the camera view should be rendered. If not provided, the camera view will be appended to the document body. Web only. | | |
713
922
 
714
923
 
715
924
  #### IsRunningResponse
@@ -721,14 +930,33 @@ Response for checking if the camera view is running.
721
930
  | **`isRunning`** | <code>boolean</code> | Indicates if the camera view is currently active and running |
722
931
 
723
932
 
933
+ #### CaptureFileResult
934
+
935
+ The file-path shaped result returned when `saveToFile` is `true`.
936
+
937
+ | Prop | Type | Description | Since |
938
+ | ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
939
+ | **`webPath`** | <code>string</code> | The web path to the captured photo that can be used to set the src attribute of an image for efficient loading and rendering (when saveToFile is true). On web, this is a blob URL created with `URL.createObjectURL()`. The plugin does not revoke it automatically; once you are done with it (e.g. after the image has been displayed or uploaded), call `URL.revokeObjectURL(webPath)` to release the underlying memory. On iOS/Android this is a Capacitor bridge path served by the local web server and does not need to be revoked. | |
940
+ | **`path`** | <code>string</code> | The full, platform-specific file URL (`file://...`) to the captured photo, usable with the Filesystem API or `Capacitor.convertFileSrc()`. Native only (iOS/Android); `undefined` on web. | 2.4.0 |
941
+
942
+
943
+ #### CaptureBase64Result
944
+
945
+ The base64 shaped result returned when `saveToFile` is `false` or `undefined`.
946
+
947
+ | Prop | Type | Description |
948
+ | ----------- | ------------------- | --------------------------------------------------------------------------------------- |
949
+ | **`photo`** | <code>string</code> | The base64 encoded string of the captured photo (when saveToFile is false or undefined) |
950
+
951
+
724
952
  #### CaptureOptions
725
953
 
726
954
  Configuration options for capturing photos and samples.
727
955
 
728
- | Prop | Type | Description | Default | Since |
729
- | ---------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
730
- | **`quality`** | <code>number</code> | The JPEG quality of the captured photo/sample on a scale of 0-100 | | 1.1.0 |
731
- | **`saveToFile`** | <code>boolean</code> | If true, saves to a temporary file and returns the web path instead of base64. The web path can be used to set the src attribute of an image for efficient loading and rendering. This reduces the data that needs to be transferred over the bridge, which can improve performance especially for high-resolution images. | <code>false</code> | 1.1.0 |
956
+ | Prop | Type | Description | Default | Since |
957
+ | ---------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
958
+ | **`quality`** | <code>number</code> | The JPEG quality of the captured photo/sample on a scale of 0-100. Cross-platform note: for `quality &gt;= 90`, iOS returns the original, unmodified JPEG produced by the camera hardware instead of re-encoding it, to avoid unnecessary quality loss and CPU overhead. Android and Web always encode at the exact requested quality. As a result, the same `quality` value (90-100) can produce different file sizes on iOS versus Android/Web. | <code>90</code> | 1.1.0 |
959
+ | **`saveToFile`** | <code>boolean</code> | If true, saves to a temporary file and returns the web path instead of base64. The web path can be used to set the src attribute of an image for efficient loading and rendering. This reduces the data that needs to be transferred over the bridge, which can improve performance especially for high-resolution images. | <code>false</code> | 1.1.0 |
732
960
 
733
961
 
734
962
  #### VideoRecordingOptions
@@ -745,10 +973,10 @@ Configuration options for video recording.
745
973
 
746
974
  Response from stopping a video recording.
747
975
 
748
- | Prop | Type | Description | Since |
749
- | ------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
750
- | **`webPath`** | <code>string</code> | Web-accessible path to the recorded video file that can be used to set the `src` attribute of a video element for efficient loading and rendering. On web, this is a blob URL. On iOS/Android, this is a Capacitor bridge path served by the local web server. | 2.3.0 |
751
- | **`path`** | <code>string</code> | The full, platform-specific file URL (`file://...`) to the recorded video, usable with the Filesystem API or `Capacitor.convertFileSrc()`. Native only (iOS/Android); `undefined` on web. | 2.4.0 |
976
+ | Prop | Type | Description | Since |
977
+ | ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
978
+ | **`webPath`** | <code>string</code> | Web-accessible path to the recorded video file that can be used to set the `src` attribute of a video element for efficient loading and rendering. On web, this is a blob URL created with `URL.createObjectURL()`; the plugin does not revoke it automatically, so call `URL.revokeObjectURL(webPath)` once you are done with it (e.g. after playback or upload) to release the underlying memory. On iOS/Android, this is a Capacitor bridge path served by the local web server and does not need to be revoked. | 2.3.0 |
979
+ | **`path`** | <code>string</code> | The full, platform-specific file URL (`file://...`) to the recorded video, usable with the Filesystem API or `Capacitor.convertFileSrc()`. Native only (iOS/Android); `undefined` on web. | 2.4.0 |
752
980
 
753
981
 
754
982
  #### GetAvailableDevicesResponse
@@ -776,11 +1004,11 @@ Represents a physical camera device on the device.
776
1004
 
777
1005
  Response for getting zoom level information.
778
1006
 
779
- | Prop | Type | Description |
780
- | ------------- | ------------------- | -------------------------------- |
781
- | **`min`** | <code>number</code> | The minimum zoom level supported |
782
- | **`max`** | <code>number</code> | The maximum zoom level supported |
783
- | **`current`** | <code>number</code> | The current zoom level |
1007
+ | Prop | Type | Description |
1008
+ | ------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
1009
+ | **`min`** | <code>number</code> | The minimum zoom level supported. On iOS virtual devices `1.0` maps to the ultra-wide lens. |
1010
+ | **`max`** | <code>number</code> | The maximum zoom level supported. On iOS virtual devices this is a raw device factor (capped at a 10x wide-equivalent zoom). |
1011
+ | **`current`** | <code>number</code> | The current zoom level. On iOS virtual devices this is a raw device factor, not a UI multiplier. |
784
1012
 
785
1013
 
786
1014
  #### GetFlashModeResponse
@@ -814,10 +1042,10 @@ Response for checking torch availability.
814
1042
 
815
1043
  Response for getting the current torch mode.
816
1044
 
817
- | Prop | Type | Description |
818
- | ------------- | -------------------- | -------------------------------------------------------------------------------------------- |
819
- | **`enabled`** | <code>boolean</code> | Indicates if the torch is currently enabled |
820
- | **`level`** | <code>number</code> | The current torch intensity level (0.0 to 1.0, iOS only). Always 1.0 on Android when enabled |
1045
+ | Prop | Type | Description |
1046
+ | ------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1047
+ | **`enabled`** | <code>boolean</code> | Indicates if the torch is currently enabled |
1048
+ | **`level`** | <code>number</code> | The current torch intensity level (0.0 to 1.0). On Android this reflects the real hardware strength only on API 33+ devices with multi-level torch hardware; below API 33, or on single-level hardware, the torch is binary, so this is always 1.0 when enabled and 0.0 when off. |
821
1049
 
822
1050
 
823
1051
  #### PermissionStatus
@@ -841,19 +1069,21 @@ Response for the camera and microphone permission status.
841
1069
 
842
1070
  Data for a detected barcode.
843
1071
 
844
- | Prop | Type | Description | Since |
845
- | ------------------ | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
846
- | **`value`** | <code>string</code> | The decoded string value of the barcode | |
847
- | **`rawBytes`** | <code>number[]</code> | Raw bytes as they were encoded in the barcode. On Android, this is forwarded from ML Kit. On iOS, this is available for descriptor-backed formats such as QR, Aztec, PDF417, and Data Matrix. On web, this is not available because the Barcode Detection API only exposes the decoded string value. | 2.2.0 |
848
- | **`displayValue`** | <code>string</code> | The display value of the barcode on Android. This is forwarded from ML Kit and may contain a formatted, human-readable representation that differs from the raw decoded value. iOS and web do not expose a separate display value, so this property is only emitted on Android. | |
849
- | **`type`** | <code>string</code> | The type/format of the barcode (e.g., 'qr', 'code128', etc.) | |
850
- | **`boundingRect`** | <code><a href="#boundingrect">BoundingRect</a></code> | The bounding rectangle of the barcode in the camera frame. | |
1072
+ | Prop | Type | Description | Since |
1073
+ | ------------------ | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
1074
+ | **`value`** | <code>string</code> | The decoded string value of the barcode | |
1075
+ | **`rawBytes`** | <code>number[]</code> | Raw bytes as they were encoded in the barcode. On Android, this is forwarded from ML Kit. On iOS, this is available for descriptor-backed formats such as QR, Aztec, PDF417, and Data Matrix. On web, this is not available because the Barcode Detection API only exposes the decoded string value. | 2.2.0 |
1076
+ | **`displayValue`** | <code>string</code> | The display value of the barcode on Android. This is forwarded from ML Kit and may contain a formatted, human-readable representation that differs from the raw decoded value. iOS and web do not expose a separate display value, so this property is only emitted on Android. | |
1077
+ | **`type`** | <code>string</code> | The type/format of the detected barcode. For formats that are part of the <a href="#barcodetype">`BarcodeType`</a> union, all platforms emit identical values, so scanning the same barcode yields the same `type` on web, iOS, and Android (e.g. `'qr'`, `'code128'`, `'dataMatrix'`). The type is <a href="#barcodetype">`BarcodeType</a> \| string` rather than <a href="#barcodetype">`BarcodeType`</a> because a platform detector can occasionally report a format that has no cross-platform union member; in that case the raw platform string is forwarded unchanged instead of being dropped. In practice this is Android's `'unknown'` (ML Kit's `FORMAT_UNKNOWN`) and the equivalent `'unknown'` from the web BarcodeDetector. Narrow against the <a href="#barcodetype">`BarcodeType`</a> members you care about and treat anything else as an opaque string. Platform-specific notes: - iOS distinguishes `interleaved2of5` from `itf14`, whereas Android and web cannot tell them apart and always report `itf14` for their shared interleaved-2-of-5/ITF detector format. - UPC-A is reported as `'upcA'` on Android and web, but as `'ean13'` on iOS: AVFoundation has no UPC-A metadata type and surfaces UPC-A codes as EAN-13 (a UPC-A value is an EAN-13 with a leading `0`). This is a hardware/OS limitation, not a normalization choice. - Codabar is reported as `'codabar'` on all three platforms. | |
1078
+ | **`boundingRect`** | <code><a href="#boundingrect">BoundingRect</a></code> | The bounding rectangle of the barcode in the camera frame. | |
851
1079
 
852
1080
 
853
1081
  #### BoundingRect
854
1082
 
855
1083
  Rectangle defining the boundary of the barcode in the camera frame.
856
- Coordinates are normalized between 0 and 1 relative to the camera frame.
1084
+ Coordinates are given in display/CSS pixels within the webview (display)
1085
+ coordinate space, not normalized values. This lets you position an overlay
1086
+ directly on top of the detected barcode without further scaling.
857
1087
 
858
1088
  | Prop | Type | Description |
859
1089
  | ------------ | ------------------- | -------------------------------------------------------------------------------- |
@@ -863,6 +1093,25 @@ Coordinates are normalized between 0 and 1 relative to the camera frame.
863
1093
  | **`height`** | <code>number</code> | Height of the bounding rectangle (should match the actual height of the barcode) |
864
1094
 
865
1095
 
1096
+ #### CameraInterruptedData
1097
+
1098
+ Data for a camera interruption event.
1099
+
1100
+ | Prop | Type | Description |
1101
+ | ------------ | ----------------------------------------------------------------------------- | ---------------------------------------------- |
1102
+ | **`reason`** | <code><a href="#camerainterruptionreason">CameraInterruptionReason</a></code> | The reason the camera session was interrupted. |
1103
+
1104
+
1105
+ #### CameraRuntimeErrorData
1106
+
1107
+ Data for a camera runtime error event.
1108
+
1109
+ | Prop | Type | Description |
1110
+ | ------------- | ------------------- | -------------------------------------------------------------------------------------- |
1111
+ | **`message`** | <code>string</code> | A human-readable description of the runtime error. |
1112
+ | **`code`** | <code>number</code> | The underlying platform error code, when available. On iOS this is the `AVError` code. |
1113
+
1114
+
866
1115
  ### Type Aliases
867
1116
 
868
1117
 
@@ -872,7 +1121,7 @@ Supported barcode types for detection.
872
1121
  Specifying only the barcode types you need can improve performance
873
1122
  and reduce battery consumption.
874
1123
 
875
- <code>'qr' | 'code128' | 'code39' | 'code39Mod43' | 'code93' | 'ean8' | 'ean13' | 'interleaved2of5' | 'itf14' | 'pdf417' | 'aztec' | 'dataMatrix' | 'upce'</code>
1124
+ <code>'qr' | 'code128' | 'code39' | 'code39Mod43' | 'code93' | 'codabar' | 'ean8' | 'ean13' | 'interleaved2of5' | 'itf14' | 'pdf417' | 'aztec' | 'dataMatrix' | 'upcA' | 'upce'</code>
876
1125
 
877
1126
 
878
1127
  #### CameraPosition
@@ -892,13 +1141,46 @@ Maps to AVCaptureDevice DeviceTypes in iOS.
892
1141
  <code>'wideAngle' | 'ultraWide' | 'telephoto' | 'dual' | 'dualWide' | 'triple' | 'trueDepth'</code>
893
1142
 
894
1143
 
1144
+ #### CameraAspectRatio
1145
+
1146
+ Sensor aspect ratio for a camera session, applied consistently to both the
1147
+ live preview stream and photo capture.
1148
+ - '4:3': The native photo aspect ratio of most mobile camera sensors
1149
+ - '16:9': The typical video aspect ratio
1150
+
1151
+ <code>'4:3' | '16:9'</code>
1152
+
1153
+
1154
+ #### PreviewScaleMode
1155
+
1156
+ How the camera preview is scaled to fill its container when the sensor
1157
+ aspect ratio differs from the container's aspect ratio.
1158
+ - 'cover': The preview fills the whole container, center-cropping the frame
1159
+ so no empty bars are shown. Parts of the frame outside the container are
1160
+ hidden from the preview (long-standing default behavior).
1161
+ - 'fit': The whole sensor frame is scaled to fit inside the container
1162
+ (letterboxed), so the user sees the entire frame they are about to
1163
+ capture. Empty bars appear on the short axis.
1164
+
1165
+ <code>'cover' | 'fit'</code>
1166
+
1167
+
895
1168
  #### CaptureResponse
896
1169
 
897
1170
  Response for capturing a photo
898
1171
  This will contain either a base64 encoded string or a web path to the captured photo,
899
1172
  depending on the `saveToFile` option in the <a href="#captureoptions">CaptureOptions</a>.
900
1173
 
901
- <code>T['saveToFile'] extends true ? { /** The web path to the captured photo that can be used to set the src attribute of an image for efficient loading and rendering (when saveToFile is true) */ webPath: string; /** * The full, platform-specific file URL (`file://...`) to the captured photo, * usable with the Filesystem API or `Capacitor.convertFileSrc()`. * Native only (iOS/Android); `undefined` on web. * @since 2.4.0 */ path?: string; } : { /** The base64 encoded string of the captured photo (when saveToFile is false or undefined) */ photo: string; }</code>
1174
+ <code><a href="#savetofileof">SaveToFileOf</a>&lt;T&gt; extends true ? <a href="#capturefileresult">CaptureFileResult</a> : <a href="#savetofileof">SaveToFileOf</a>&lt;T&gt; extends false ? <a href="#capturebase64result">CaptureBase64Result</a> : <a href="#capturefileresult">CaptureFileResult</a> | <a href="#capturebase64result">CaptureBase64Result</a></code>
1175
+
1176
+
1177
+ #### SaveToFileOf
1178
+
1179
+ `T['saveToFile']` resolves through the <a href="#captureoptions">`CaptureOptions`</a> constraint to `boolean | undefined`
1180
+ when `T` omits the key, which would widen the result to the union. Treat an absent key as
1181
+ `undefined` instead.
1182
+
1183
+ <code>'saveToFile' extends keyof T ? T['saveToFile'] : undefined</code>
902
1184
 
903
1185
 
904
1186
  #### VideoRecordingQuality
@@ -931,4 +1213,14 @@ Permission types that can be requested.
931
1213
 
932
1214
  <code>'camera' | 'microphone'</code>
933
1215
 
1216
+
1217
+ #### CameraInterruptionReason
1218
+
1219
+ Reason why the camera session was interrupted.
1220
+
1221
+ Mirrors `AVCaptureSession.InterruptionReason` on iOS. Unknown or future
1222
+ reasons fall back to `'unknown'`.
1223
+
1224
+ <code>'videoDeviceNotAvailableInBackground' | 'audioDeviceInUseByAnotherClient' | 'videoDeviceInUseByAnotherClient' | 'videoDeviceNotAvailableWithMultipleForegroundApps' | 'videoDeviceNotAvailableDueToSystemPressure' | 'unknown'</code>
1225
+
934
1226
  </docgen-api>