@capgo/camera-preview 8.13.0 → 8.13.2

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.
package/README.md CHANGED
@@ -1563,49 +1563,49 @@ Get the native Capacitor plugin version
1563
1563
 
1564
1564
  Defines the configuration options for starting the camera preview.
1565
1565
 
1566
- | Prop | Type | Description | Default | Since |
1567
- | ------------------------------------------------ | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- | ------ |
1568
- | **`parent`** | <code>string</code> | The parent element to attach the video preview to. | | |
1569
- | **`className`** | <code>string</code> | A CSS class name to add to the preview element. | | |
1570
- | **`width`** | <code>number</code> | The width of the preview in pixels. Defaults to the screen width. | | |
1571
- | **`height`** | <code>number</code> | The height of the preview in pixels. Defaults to the screen height. | | |
1572
- | **`x`** | <code>number</code> | The horizontal origin of the preview, in pixels. | | |
1573
- | **`y`** | <code>number</code> | The vertical origin of the preview, in pixels. | | |
1574
- | **`aspectRatio`** | <code><a href="#camerapreviewaspectratio">CameraPreviewAspectRatio</a></code> | The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'. Cannot be set if width or height is provided, otherwise the call will be rejected. Use setPreviewSize to adjust size after starting. | | 2.0.0 |
1575
- | **`aspectMode`** | <code>'cover' \| 'contain'</code> | Controls how the camera preview fills the available space. - 'contain': Fits the entire preview within the space, may show letterboxing (default). - 'cover': Fills the entire space, may crop edges of the preview. | <code>"contain"</code> | |
1576
- | **`gridMode`** | <code><a href="#gridmode">GridMode</a></code> | The grid overlay to display on the camera preview. | <code>"none"</code> | 2.1.0 |
1577
- | **`includeSafeAreaInsets`** | <code>boolean</code> | Adjusts the y-position to account for safe areas (e.g., notches). | <code>false</code> | |
1578
- | **`toBack`** | <code>boolean</code> | If true, places the preview behind the webview. | <code>true</code> | |
1579
- | **`paddingBottom`** | <code>number</code> | Bottom padding for the preview, in pixels. | | |
1580
- | **`rotateWhenOrientationChanged`** | <code>boolean</code> | Whether to rotate the preview when the device orientation changes. | <code>true</code> | |
1581
- | **`position`** | <code>string</code> | The camera to use. | <code>"rear"</code> | |
1582
- | **`storeToFile`** | <code>boolean</code> | If true, saves the captured image to a file and returns the file path. If false, returns a base64 encoded string. | <code>false</code> | |
1583
- | **`disableExifHeaderStripping`** | <code>boolean</code> | If true, prevents the plugin from rotating the image based on EXIF data. | <code>false</code> | |
1584
- | **`disableAudio`** | <code>boolean</code> | If true, disables the audio stream, preventing audio permission requests. | <code>true</code> | |
1585
- | **`lockAndroidOrientation`** | <code>boolean</code> | If true, locks the device orientation while the camera is active. | <code>false</code> | |
1586
- | **`enableOpacity`** | <code>boolean</code> | If true, allows the camera preview's opacity to be changed. | <code>false</code> | |
1587
- | **`disableFocusIndicator`** | <code>boolean</code> | If true, disables the visual focus indicator when tapping to focus. | <code>false</code> | |
1588
- | **`deviceId`** | <code>string</code> | The `deviceId` of the camera to use. If provided, `position` is ignored. | | |
1589
- | **`enablePhysicalDeviceSelection`** | <code>boolean</code> | On Android, attempts to bind a physical camera directly when `deviceId` refers to a physical lens. Disabled by default because OEM support is inconsistent; when false, Android keeps the current logical-camera fallback behavior. | <code>false</code> | |
1590
- | **`initialZoomLevel`** | <code>number</code> | The initial zoom level when starting the camera preview. If the requested zoom level is not available, the native plugin will reject. | <code>1.0</code> | 2.2.0 |
1591
- | **`positioning`** | <code><a href="#camerapositioning">CameraPositioning</a></code> | The vertical positioning of the camera preview. | <code>"center"</code> | 2.3.0 |
1592
- | **`enableVideoMode`** | <code>boolean</code> | If true, enables video capture capabilities when the camera starts. | <code>false</code> | 7.11.0 |
1593
- | **`captureResolution`** | <code><a href="#cameracaptureresolution">CameraCaptureResolution</a></code> | Sets the still-capture sensor resolution cap at session start. Preview resolution is unchanged. The shared ViewPort crop from the preview still applies to captures. On Android this binds the `ImageCapture` use case to the requested size. On iOS 16+ this sets `AVCapturePhotoSettings.maxPhotoDimensions` (and disables high-resolution photo capture when capped) so the sensor delivers fewer pixels instead of downscaling a full-sensor frame in software. On iOS 15, `start()` rejects this option. When omitted, capture uses the highest resolution supported by the active camera (same as versions before 8.11.10 on Android, and the format default on iOS). Set this to cap capture size for faster shots on high-megapixel sensors, for example `{ width: 1920, height: 1080 }` or `{ width: 1600, height: 1200 }`. | | 8.12.0 |
1594
- | **`force`** | <code>boolean</code> | If true, forces the camera to start/restart even if it's already running or busy. This will kill the current camera session and start a new one, ignoring all state checks. | <code>false</code> | |
1595
- | **`videoQuality`** | <code><a href="#videoquality">VideoQuality</a></code> | Sets the quality of video for recording. Options: 'low', 'medium', 'high', '2160p', '1080p', '720p', '480p', '4:3' | <code>"high"</code> | |
1596
- | **`maxDuration`** | <code>number</code> | Maximum recording duration in seconds. Recording stops automatically when reached. | | |
1597
- | **`maxFileSize`** | <code>number</code> | Maximum recording file size in bytes. Recording stops automatically when reached. | | |
1598
- | **`videoCodec`** | <code><a href="#videocodec">VideoCodec</a></code> | Preferred video codec for recording. | <code>"avc1"</code> | |
1599
- | **`frameRate`** | <code>number</code> | Target video frame rate in frames per second. Applied when recording starts. Use `getSupportedVideoFrameRates()` to list supported values. | | 8.6.0 |
1600
- | **`videoStabilizationMode`** | <code><a href="#videostabilizationmode">VideoStabilizationMode</a></code> | Preferred video stabilization mode for recording. | <code>"off"</code> | |
1601
- | **`allowHapticsAndSystemSoundsDuringRecording`** | <code>boolean</code> | When `true`, allows haptic feedback and system sounds while recording video with audio. iOS suppresses haptics during audio input recording unless this is enabled. Requires `disableAudio: false`. | <code>false</code> | 8.8.0 |
1602
- | **`mirrorFrontCamera`** | <code>boolean</code> | When `true` and the front camera is active, mirrors the recorded video file so it matches the selfie-style preview (text and gestures are not reversed). Does not affect the live preview. Defaults to `false` to preserve existing behavior. | <code>false</code> | 8.10.0 |
1603
- | **`barcodeScanner`** | <code>boolean \| <a href="#barcodescanneroptions">BarcodeScannerOptions</a></code> | Starts barcode scanning together with the camera preview. Set to `true` or pass options to scan all supported formats. Omit this option to keep barcode scanning disabled at startup. | | 8.8.0 |
1566
+ | Prop | Type | Description | Default | Since |
1567
+ | ------------------------------------------------ | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------ |
1568
+ | **`parent`** | <code>string</code> | The parent element to attach the video preview to. | | |
1569
+ | **`className`** | <code>string</code> | A CSS class name to add to the preview element. | | |
1570
+ | **`width`** | <code>number</code> | The width of the preview in pixels. Defaults to the screen width. | | |
1571
+ | **`height`** | <code>number</code> | The height of the preview in pixels. Defaults to the screen height. | | |
1572
+ | **`x`** | <code>number</code> | The horizontal origin of the preview, in pixels. | | |
1573
+ | **`y`** | <code>number</code> | The vertical origin of the preview, in pixels. | | |
1574
+ | **`aspectRatio`** | <code><a href="#camerapreviewaspectratio">CameraPreviewAspectRatio</a></code> | The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'. Cannot be set if width or height is provided, otherwise the call will be rejected. Use setPreviewSize to adjust size after starting. | | 2.0.0 |
1575
+ | **`aspectMode`** | <code>'cover' \| 'contain'</code> | Controls how the camera preview fills the available space. - 'contain': Fits the entire preview within the space, may show letterboxing (default). - 'cover': Fills the entire space, may crop edges of the preview. | <code>"contain"</code> | |
1576
+ | **`gridMode`** | <code><a href="#gridmode">GridMode</a></code> | The grid overlay to display on the camera preview. | <code>"none"</code> | 2.1.0 |
1577
+ | **`includeSafeAreaInsets`** | <code>boolean</code> | Adjusts the y-position to account for safe areas (e.g., notches). | <code>false</code> | |
1578
+ | **`toBack`** | <code>boolean</code> | If true, places the preview behind the webview. | <code>true</code> | |
1579
+ | **`paddingBottom`** | <code>number</code> | Bottom padding for the preview, in pixels. | | |
1580
+ | **`rotateWhenOrientationChanged`** | <code>boolean</code> | Whether to rotate the preview when the device orientation changes. | <code>true</code> | |
1581
+ | **`position`** | <code>string</code> | The camera to use. | <code>"rear"</code> | |
1582
+ | **`storeToFile`** | <code>boolean</code> | If true, saves the captured image to a file and returns the file path. If false, returns a base64 encoded string. | <code>false</code> | |
1583
+ | **`disableExifHeaderStripping`** | <code>boolean</code> | If true, prevents the plugin from rotating the image based on EXIF data. | <code>false</code> | |
1584
+ | **`disableAudio`** | <code>boolean</code> | If true, disables the audio stream, preventing audio permission requests. | <code>true</code> | |
1585
+ | **`lockAndroidOrientation`** | <code>boolean</code> | If true, locks the device orientation while the camera is active. | <code>false</code> | |
1586
+ | **`enableOpacity`** | <code>boolean</code> | If true, allows the camera preview's opacity to be changed. | <code>false</code> | |
1587
+ | **`disableFocusIndicator`** | <code>boolean</code> | If true, disables the visual focus indicator when tapping to focus. | <code>false</code> | |
1588
+ | **`deviceId`** | <code>string</code> | The `deviceId` of the camera to use. If provided, `position` is ignored. | | |
1589
+ | **`enablePhysicalDeviceSelection`** | <code>boolean</code> | On Android, attempts to bind a physical camera directly when `deviceId` refers to a physical lens. Disabled by default because OEM support is inconsistent; when false, Android keeps the current logical-camera fallback behavior. | <code>false</code> | |
1590
+ | **`initialZoomLevel`** | <code>number</code> | The initial zoom level when starting the camera preview. If the requested zoom level is not available, the native plugin will reject. | <code>1.0</code> | 2.2.0 |
1591
+ | **`positioning`** | <code><a href="#camerapositioning">CameraPositioning</a></code> | The vertical positioning of the camera preview. | <code>"center"</code> | 2.3.0 |
1592
+ | **`enableVideoMode`** | <code>boolean</code> | If true, enables video capture capabilities when the camera starts. | <code>false</code> | 7.11.0 |
1593
+ | **`captureResolution`** | <code><a href="#cameracaptureresolution">CameraCaptureResolution</a></code> | Sets the still-capture sensor resolution cap at session start. Preview resolution is unchanged. The shared ViewPort crop from the preview still applies to captures. On Android this binds the `ImageCapture` use case to the requested size. On iOS 16+ this sets `AVCapturePhotoSettings.maxPhotoDimensions` (and disables high-resolution photo capture when capped) to the largest supported sensor size at or below the requested cap. When the active format exposes no supported size under the cap, iOS uses the smallest supported `maxPhotoDimensions` entry (same fallback as Android) so `start()` never assigns an unsupported dimension. On iOS 15, `start()` rejects this option. When omitted, capture uses the highest resolution supported by the active camera (same as versions before 8.11.10 on Android, and the format default on iOS). Set this to cap capture size for faster shots on high-megapixel sensors, for example `{ width: 1920, height: 1080 }` or `{ width: 1600, height: 1200 }`. | | 8.12.0 |
1594
+ | **`force`** | <code>boolean</code> | If true, forces the camera to start/restart even if it's already running or busy. This will kill the current camera session and start a new one, ignoring all state checks. | <code>false</code> | |
1595
+ | **`videoQuality`** | <code><a href="#videoquality">VideoQuality</a></code> | Sets the quality of video for recording. Options: 'low', 'medium', 'high', '2160p', '1080p', '720p', '480p', '4:3' | <code>"high"</code> | |
1596
+ | **`maxDuration`** | <code>number</code> | Maximum recording duration in seconds. Recording stops automatically when reached. | | |
1597
+ | **`maxFileSize`** | <code>number</code> | Maximum recording file size in bytes. Recording stops automatically when reached. | | |
1598
+ | **`videoCodec`** | <code><a href="#videocodec">VideoCodec</a></code> | Preferred video codec for recording. | <code>"avc1"</code> | |
1599
+ | **`frameRate`** | <code>number</code> | Target video frame rate in frames per second. Applied when recording starts. Use `getSupportedVideoFrameRates()` to list supported values. | | 8.6.0 |
1600
+ | **`videoStabilizationMode`** | <code><a href="#videostabilizationmode">VideoStabilizationMode</a></code> | Preferred video stabilization mode for recording. | <code>"off"</code> | |
1601
+ | **`allowHapticsAndSystemSoundsDuringRecording`** | <code>boolean</code> | When `true`, allows haptic feedback and system sounds while recording video with audio. iOS suppresses haptics during audio input recording unless this is enabled. Requires `disableAudio: false`. | <code>false</code> | 8.8.0 |
1602
+ | **`mirrorFrontCamera`** | <code>boolean</code> | When `true` and the front camera is active, mirrors the recorded video file so it matches the selfie-style preview (text and gestures are not reversed). Does not affect the live preview. Defaults to `false` to preserve existing behavior. | <code>false</code> | 8.10.0 |
1603
+ | **`barcodeScanner`** | <code>boolean \| <a href="#barcodescanneroptions">BarcodeScannerOptions</a></code> | Starts barcode scanning together with the camera preview. Set to `true` or pass options to scan all supported formats. Omit this option to keep barcode scanning disabled at startup. | | 8.8.0 |
1604
1604
 
1605
1605
 
1606
1606
  #### CameraCaptureResolution
1607
1607
 
1608
- Target still-capture resolution for the Android `ImageCapture` use case.
1608
+ Target still-capture resolution for still captures on Android and iOS.
1609
1609
 
1610
1610
  Width and height define the resolution strategy target. The plugin also filters out
1611
1611
  supported capture sizes whose long edge exceeds `max(width, height)`.
package/dist/docs.json CHANGED
@@ -2098,7 +2098,7 @@
2098
2098
  "name": "since"
2099
2099
  }
2100
2100
  ],
2101
- "docs": "Sets the still-capture sensor resolution cap at session start. Preview resolution is unchanged.\nThe shared ViewPort crop from the preview still applies to captures.\n\nOn Android this binds the `ImageCapture` use case to the requested size. On iOS 16+ this sets\n`AVCapturePhotoSettings.maxPhotoDimensions` (and disables high-resolution photo capture when capped)\nso the sensor delivers fewer pixels instead of downscaling a full-sensor frame in software.\nOn iOS 15, `start()` rejects this option.\n\nWhen omitted, capture uses the highest resolution supported by the active camera\n(same as versions before 8.11.10 on Android, and the format default on iOS). Set this to cap\ncapture size for faster shots on high-megapixel sensors, for example `{ width: 1920, height: 1080 }`\nor `{ width: 1600, height: 1200 }`.",
2101
+ "docs": "Sets the still-capture sensor resolution cap at session start. Preview resolution is unchanged.\nThe shared ViewPort crop from the preview still applies to captures.\n\nOn Android this binds the `ImageCapture` use case to the requested size. On iOS 16+ this sets\n`AVCapturePhotoSettings.maxPhotoDimensions` (and disables high-resolution photo capture when capped)\nto the largest supported sensor size at or below the requested cap. When the active format exposes\nno supported size under the cap, iOS uses the smallest supported `maxPhotoDimensions` entry (same\nfallback as Android) so `start()` never assigns an unsupported dimension.\nOn iOS 15, `start()` rejects this option.\n\nWhen omitted, capture uses the highest resolution supported by the active camera\n(same as versions before 8.11.10 on Android, and the format default on iOS). Set this to cap\ncapture size for faster shots on high-megapixel sensors, for example `{ width: 1920, height: 1080 }`\nor `{ width: 1600, height: 1200 }`.",
2102
2102
  "complexTypes": [
2103
2103
  "CameraCaptureResolution"
2104
2104
  ],
@@ -2285,7 +2285,7 @@
2285
2285
  {
2286
2286
  "name": "CameraCaptureResolution",
2287
2287
  "slug": "cameracaptureresolution",
2288
- "docs": "Target still-capture resolution for the Android `ImageCapture` use case.\n\nWidth and height define the resolution strategy target. The plugin also filters out\nsupported capture sizes whose long edge exceeds `max(width, height)`.",
2288
+ "docs": "Target still-capture resolution for still captures on Android and iOS.\n\nWidth and height define the resolution strategy target. The plugin also filters out\nsupported capture sizes whose long edge exceeds `max(width, height)`.",
2289
2289
  "tags": [],
2290
2290
  "methods": [],
2291
2291
  "properties": [
@@ -5,7 +5,7 @@ export type GridMode = 'none' | '3x3' | '4x4';
5
5
  export type CameraPositioning = 'center' | 'top' | 'bottom';
6
6
  export type CameraPreviewAspectRatio = '4:3' | '16:9' | 'fill';
7
7
  /**
8
- * Target still-capture resolution for the Android `ImageCapture` use case.
8
+ * Target still-capture resolution for still captures on Android and iOS.
9
9
  *
10
10
  * Width and height define the resolution strategy target. The plugin also filters out
11
11
  * supported capture sizes whose long edge exceeds `max(width, height)`.
@@ -319,7 +319,9 @@ export interface CameraPreviewOptions {
319
319
  *
320
320
  * On Android this binds the `ImageCapture` use case to the requested size. On iOS 16+ this sets
321
321
  * `AVCapturePhotoSettings.maxPhotoDimensions` (and disables high-resolution photo capture when capped)
322
- * so the sensor delivers fewer pixels instead of downscaling a full-sensor frame in software.
322
+ * to the largest supported sensor size at or below the requested cap. When the active format exposes
323
+ * no supported size under the cap, iOS uses the smallest supported `maxPhotoDimensions` entry (same
324
+ * fallback as Android) so `start()` never assigns an unsupported dimension.
323
325
  * On iOS 15, `start()` rejects this option.
324
326
  *
325
327
  * When omitted, capture uses the highest resolution supported by the active camera
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA2FA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,sCAAwB,CAAA;IACxB,sCAAwB,CAAA;IACxB,qCAAuB,CAAA;IACvB,sCAAwB,CAAA;IACxB,2BAAa,CAAA;IACb,oCAAsB,CAAA;IACtB,+BAAiB,CAAA;AACnB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB","sourcesContent":["import type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\nexport type CameraPosition = 'rear' | 'front';\n\nexport type FlashMode = CameraPreviewFlashMode;\n\nexport type GridMode = 'none' | '3x3' | '4x4';\n\nexport type CameraPositioning = 'center' | 'top' | 'bottom';\n\nexport type CameraPreviewAspectRatio = '4:3' | '16:9' | 'fill';\n\n/**\n * Target still-capture resolution for the Android `ImageCapture` use case.\n *\n * Width and height define the resolution strategy target. The plugin also filters out\n * supported capture sizes whose long edge exceeds `max(width, height)`.\n */\nexport interface CameraCaptureResolution {\n /** Target width in pixels. */\n width: number;\n /** Target height in pixels. */\n height: number;\n}\n\nexport type BarcodeScannerFormat =\n | 'aztec'\n | 'codabar'\n | 'code_39'\n | 'code_93'\n | 'code_128'\n | 'data_matrix'\n | 'ean_8'\n | 'ean_13'\n | 'itf'\n | 'pdf417'\n | 'qr_code'\n | 'upc_a'\n | 'upc_e';\n\nexport type BarcodeFormat = BarcodeScannerFormat | 'unknown';\n\nexport interface BarcodeScannerOptions {\n /**\n * Restricts detection to the given formats. Leaving this empty scans all supported formats.\n * Restricting formats can improve scanning speed.\n */\n formats?: BarcodeScannerFormat[];\n /**\n * Minimum delay between native scan attempts in milliseconds.\n * Lower values scan more often but use more CPU.\n * @default 500\n */\n detectionInterval?: number;\n}\n\nexport interface BarcodeScanResult {\n /** Decoded barcode value. */\n value: string;\n /** Barcode format. */\n format: BarcodeFormat;\n /** Human-readable value when the platform exposes one. */\n displayValue?: string;\n /** Base64-encoded raw bytes when the platform exposes them. */\n rawBytes?: string;\n}\n\nexport interface BarcodeScannedEvent {\n /** Barcodes decoded from the current frame. */\n barcodes: BarcodeScanResult[];\n}\n\nexport interface BarcodeScanErrorEvent {\n /** Native scanner error message. */\n message: string;\n}\n\nexport interface CameraPermissionStatus {\n camera: PermissionState;\n microphone?: PermissionState;\n}\n\nexport interface PermissionRequestOptions {\n disableAudio?: boolean;\n showSettingsAlert?: boolean;\n title?: string;\n message?: string;\n openSettingsButtonTitle?: string;\n cancelButtonTitle?: string;\n}\n\nexport enum DeviceType {\n ULTRA_WIDE = 'ultraWide',\n WIDE_ANGLE = 'wideAngle',\n TELEPHOTO = 'telephoto',\n TRUE_DEPTH = 'trueDepth',\n DUAL = 'dual',\n DUAL_WIDE = 'dualWide',\n TRIPLE = 'triple',\n}\n\n/**\n * Represents a single camera lens on a device. A {@link CameraDevice} can have multiple lenses.\n */\nexport interface CameraLens {\n /** A human-readable name for the lens, e.g., \"Ultra-Wide\". */\n label: string;\n /** The type of the camera lens. */\n deviceType: DeviceType;\n /** The focal length of the lens in millimeters. */\n focalLength: number;\n /** The base zoom factor for this lens (e.g., 0.5 for ultra-wide, 1.0 for wide). */\n baseZoomRatio: number;\n /** The minimum zoom factor supported by this specific lens. */\n minZoom: number;\n /** The maximum zoom factor supported by this specific lens. */\n maxZoom: number;\n}\n\n/**\n * Represents a physical camera on the device (e.g., the front-facing camera).\n */\nexport interface CameraDevice {\n /** A unique identifier for the camera device. */\n deviceId: string;\n /** A human-readable name for the camera device. */\n label: string;\n /** The physical position of the camera on the device. */\n position: CameraPosition;\n /** A list of all available lenses for this camera device. */\n lenses: CameraLens[];\n /** The overall minimum zoom factor available across all lenses on this device. */\n minZoom: number;\n /** The overall maximum zoom factor available across all lenses on this device. */\n maxZoom: number;\n /** Identifies whether the device is a logical camera (composed of multiple physical lenses). */\n isLogical: boolean;\n}\n\n/**\n * Represents the detailed information of the currently active lens.\n */\nexport interface LensInfo {\n /** The focal length of the active lens in millimeters. */\n focalLength: number;\n /** The device type of the active lens. */\n deviceType: DeviceType;\n /** The base zoom ratio of the active lens (e.g., 0.5x, 1.0x). */\n baseZoomRatio: number;\n /** The current digital zoom factor applied on top of the base zoom. */\n digitalZoom: number;\n}\n\nexport type VideoQuality = 'low' | 'medium' | 'high' | '2160p' | '1080p' | '720p' | '480p' | '4:3';\n\n/**\n * Video codec identifiers used when recording.\n * - `avc1`: H.264\n * - `hvc1`: HEVC / H.265\n */\nexport type VideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';\n\n/**\n * Video stabilization modes used when recording.\n *\n * On Android only `off` and `standard` are supported.\n * On iOS all listed modes may be available when the device supports video stabilization.\n */\nexport type VideoStabilizationMode =\n | 'off'\n | 'standard'\n | 'cinematic'\n | 'cinematicExtended'\n | 'previewOptimized'\n | 'cinematicExtendedEnhanced'\n | 'auto'\n | 'lowLatency';\n\nexport type RecordingFinishedReason = 'manual' | 'maxDuration' | 'maxFileSize';\n\nexport interface RecordingFinishedEvent {\n /**\n * The path to the recorded video file.\n */\n videoFilePath: string;\n /**\n * Why the recording stopped.\n */\n reason: RecordingFinishedReason;\n}\n\n/**\n * Emitted when the native capture session is interrupted (for example during a phone call).\n *\n * @since 8.11.7\n * @platform ios\n */\nexport interface CameraInterruptedEvent {\n /**\n * Why the session was interrupted.\n */\n reason: 'runtimeError' | 'interrupted';\n /**\n * When true, the plugin removed the microphone input and continued with video only.\n */\n audioDropped: boolean;\n}\n\n/**\n * Defines the configuration options for starting the camera preview.\n */\nexport interface CameraPreviewOptions {\n /**\n * The parent element to attach the video preview to.\n * @platform web\n */\n parent?: string;\n /**\n * A CSS class name to add to the preview element.\n * @platform web\n */\n className?: string;\n /**\n * The width of the preview in pixels. Defaults to the screen width.\n * @platform android, ios, web\n */\n width?: number;\n /**\n * The height of the preview in pixels. Defaults to the screen height.\n * @platform android, ios, web\n */\n height?: number;\n /**\n * The horizontal origin of the preview, in pixels.\n * @platform android, ios\n */\n x?: number;\n /**\n * The vertical origin of the preview, in pixels.\n * @platform android, ios\n */\n y?: number;\n /**\n * The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\n * Cannot be set if width or height is provided, otherwise the call will be rejected.\n * Use setPreviewSize to adjust size after starting.\n *\n * @since 2.0.0\n */\n aspectRatio?: CameraPreviewAspectRatio;\n /**\n * Controls how the camera preview fills the available space.\n * - 'contain': Fits the entire preview within the space, may show letterboxing (default).\n * - 'cover': Fills the entire space, may crop edges of the preview.\n * @default \"contain\"\n * @platform android, ios, web\n */\n aspectMode?: 'cover' | 'contain';\n /**\n * The grid overlay to display on the camera preview.\n * @default \"none\"\n * @since 2.1.0\n */\n gridMode?: GridMode;\n /**\n * Adjusts the y-position to account for safe areas (e.g., notches).\n * @platform android, ios\n * @default false\n */\n includeSafeAreaInsets?: boolean;\n /**\n * If true, places the preview behind the webview.\n * @platform android\n * @default true\n */\n toBack?: boolean;\n /**\n * Bottom padding for the preview, in pixels.\n * @platform android, ios\n */\n paddingBottom?: number;\n /**\n * Whether to rotate the preview when the device orientation changes.\n * @platform ios\n * @default true\n */\n rotateWhenOrientationChanged?: boolean;\n /**\n * The camera to use.\n * @default \"rear\"\n */\n position?: CameraPosition | string;\n /**\n * If true, saves the captured image to a file and returns the file path.\n * If false, returns a base64 encoded string.\n * @default false\n */\n storeToFile?: boolean;\n /**\n * If true, prevents the plugin from rotating the image based on EXIF data.\n * @platform android\n * @default false\n */\n disableExifHeaderStripping?: boolean;\n /**\n * If true, disables the audio stream, preventing audio permission requests.\n * @default true\n */\n disableAudio?: boolean;\n /**\n * If true, locks the device orientation while the camera is active.\n * @platform android\n * @default false\n */\n lockAndroidOrientation?: boolean;\n /**\n * If true, allows the camera preview's opacity to be changed.\n * @platform android, web\n * @default false\n */\n enableOpacity?: boolean;\n\n /**\n * If true, disables the visual focus indicator when tapping to focus.\n * @platform android, ios\n * @default false\n */\n disableFocusIndicator?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n /**\n * On Android, attempts to bind a physical camera directly when `deviceId` refers to a physical lens.\n * Disabled by default because OEM support is inconsistent; when false, Android keeps the current logical-camera fallback behavior.\n * @default false\n * @platform android\n */\n enablePhysicalDeviceSelection?: boolean;\n /**\n * The initial zoom level when starting the camera preview.\n * If the requested zoom level is not available, the native plugin will reject.\n * @default 1.0\n * @platform android, ios\n * @since 2.2.0\n */\n initialZoomLevel?: number;\n /**\n * The vertical positioning of the camera preview.\n * @default \"center\"\n * @platform android, ios, web\n * @since 2.3.0\n */\n positioning?: CameraPositioning;\n /**\n * If true, enables video capture capabilities when the camera starts.\n * @default false\n * @platform android, ios\n * @since 7.11.0\n */\n enableVideoMode?: boolean;\n /**\n * Sets the still-capture sensor resolution cap at session start. Preview resolution is unchanged.\n * The shared ViewPort crop from the preview still applies to captures.\n *\n * On Android this binds the `ImageCapture` use case to the requested size. On iOS 16+ this sets\n * `AVCapturePhotoSettings.maxPhotoDimensions` (and disables high-resolution photo capture when capped)\n * so the sensor delivers fewer pixels instead of downscaling a full-sensor frame in software.\n * On iOS 15, `start()` rejects this option.\n *\n * When omitted, capture uses the highest resolution supported by the active camera\n * (same as versions before 8.11.10 on Android, and the format default on iOS). Set this to cap\n * capture size for faster shots on high-megapixel sensors, for example `{ width: 1920, height: 1080 }`\n * or `{ width: 1600, height: 1200 }`.\n *\n * @platform android, ios\n * @since 8.12.0\n * @since 8.13.0 (iOS)\n */\n captureResolution?: CameraCaptureResolution;\n /**\n * If true, forces the camera to start/restart even if it's already running or busy.\n * This will kill the current camera session and start a new one, ignoring all state checks.\n * @default false\n * @platform android, ios, web\n */\n force?: boolean;\n /**\n * Sets the quality of video for recording.\n * Options: 'low', 'medium', 'high', '2160p', '1080p', '720p', '480p', '4:3'\n * @note On Android requires 'enableVideoMode' to be true\n * @note Will affect the entire preview stream for iOS\n * @platform ios, android\n * @default \"high\"\n */\n videoQuality?: VideoQuality;\n /**\n * Maximum recording duration in seconds. Recording stops automatically when reached.\n * @platform ios, android\n */\n maxDuration?: number;\n /**\n * Maximum recording file size in bytes. Recording stops automatically when reached.\n * @platform ios, android\n */\n maxFileSize?: number;\n /**\n * Preferred video codec for recording.\n * @platform ios, android\n * @default \"avc1\"\n */\n videoCodec?: VideoCodec;\n /**\n * Target video frame rate in frames per second.\n * Applied when recording starts. Use `getSupportedVideoFrameRates()` to list supported values.\n * @platform ios, android\n * @since 8.6.0\n */\n frameRate?: number;\n /**\n * Preferred video stabilization mode for recording.\n * @platform ios, android\n * @default \"off\"\n */\n videoStabilizationMode?: VideoStabilizationMode;\n /**\n * When `true`, allows haptic feedback and system sounds while recording video with audio.\n * iOS suppresses haptics during audio input recording unless this is enabled.\n * Requires `disableAudio: false`.\n * @platform ios\n * @default false\n * @since 8.8.0\n */\n allowHapticsAndSystemSoundsDuringRecording?: boolean;\n /**\n * When `true` and the front camera is active, mirrors the recorded video file\n * so it matches the selfie-style preview (text and gestures are not reversed).\n * Does not affect the live preview. Defaults to `false` to preserve existing behavior.\n * @platform ios, android\n * @default false\n * @since 8.10.0\n */\n mirrorFrontCamera?: boolean;\n /**\n * Starts barcode scanning together with the camera preview.\n * Set to `true` or pass options to scan all supported formats.\n * Omit this option to keep barcode scanning disabled at startup.\n * @platform android, ios, web\n * @since 8.8.0\n */\n barcodeScanner?: boolean | BarcodeScannerOptions;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /**\n * The maximum height of the picture in pixels. The image will be resized to fit within this height while maintaining aspect ratio.\n * If not specified the captured image will match the preview's visible area.\n */\n height?: number;\n /**\n * The maximum width of the picture in pixels. The image will be resized to fit within this width while maintaining aspect ratio.\n * If not specified the captured image will match the preview's visible area.\n */\n width?: number;\n /**\n * The quality of the captured image, from 0 to 100.\n * Does not apply to `png` format.\n * @default 85\n */\n quality?: number;\n /**\n * The format of the captured image.\n * @default \"jpeg\"\n */\n format?: PictureFormat;\n /**\n * If true, the captured image will be saved to the user's gallery.\n * @default false\n * @since 7.5.0\n */\n saveToGallery?: boolean;\n /**\n * If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.\n * This may prompt the user for location permissions.\n * @default false\n * @since 7.6.0\n */\n withExifLocation?: boolean;\n /**\n * If true, the plugin will embed a timestamp in the top-right corner of the image.\n * @default false\n * @since 7.17.0\n */\n embedTimestamp?: boolean;\n /**\n * If true, the plugin will embed the current location in the top-right corner of the image.\n * Requires `withExifLocation` to be enabled.\n * @default false\n * @since 7.18.0\n */\n embedLocation?: boolean;\n /**\n * Sets the priority for photo quality vs. capture speed.\n * - \"speed\": Prioritizes faster capture times, may reduce image quality.\n * - \"balanced\": Aims for a balance between quality and speed.\n * - \"quality\": Prioritizes image quality, may reduce capture speed.\n * See https://developer.apple.com/documentation/avfoundation/avcapturephotosettings/photoqualityprioritization for details.\n *\n * @since 7.21.0\n * @platform ios\n * @default \"speed\"\n */\n photoQualityPrioritization?: 'speed' | 'balanced' | 'quality';\n /**\n * If true and the front camera is active, horizontally mirror the captured photo\n * so it matches a selfie-style preview. Rear camera captures are never mirrored.\n * Defaults to false to preserve the previous non-mirrored behavior.\n * @default false\n * @since 8.10.0\n */\n mirrorFrontCamera?: boolean;\n /**\n * Which orientation to apply to the captured photo.\n * - `\"device\"`: uses physical device tilt from the accelerometer (default). Preserves landscape captures when the app UI is rotation-locked.\n * - `\"preview\"`: matches the on-screen preview. Use for WYSIWYG capture, including retakes without stopping the camera.\n * @default \"device\"\n * @since 8.13.0\n */\n orientation?: 'preview' | 'device';\n}\n\n/** Represents EXIF data extracted from an image. */\nexport interface ExifData {\n [key: string]: any;\n}\n\nexport type PictureFormat = 'jpeg' | 'png';\n\n/** Defines a standard picture size with width and height. */\nexport interface PictureSize {\n /** The width of the picture in pixels. */\n width: number;\n /** The height of the picture in pixels. */\n height: number;\n}\n\n/** Represents the supported picture sizes for a camera facing a certain direction. */\nexport interface SupportedPictureSizes {\n /** The camera direction (\"front\" or \"rear\"). */\n facing: string;\n /** A list of supported picture sizes for this camera. */\n supportedPictureSizes: PictureSize[];\n}\n\n/**\n * Defines the options for capturing a sample frame from the camera preview.\n */\nexport interface CameraSampleOptions {\n /**\n * The quality of the captured sample, from 0 to 100.\n * @default 85\n */\n quality?: number;\n /**\n * If true and the front camera is active, horizontally mirror the captured sample\n * so it matches a selfie-style preview. Rear camera samples are never mirrored.\n * Defaults to false to preserve the previous non-mirrored behavior.\n * @default false\n * @since 8.10.0\n */\n mirrorFrontCamera?: boolean;\n}\n\n/**\n * The available flash modes for the camera.\n * 'torch' is a continuous light mode.\n */\nexport type CameraPreviewFlashMode = 'off' | 'on' | 'auto' | 'torch';\n\n/** Reusable exposure mode type for cross-platform support. */\nexport type ExposureMode = 'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM';\n\n/**\n * Reusable white-balance mode type for cross-platform support.\n * `CUSTOM` is reserved for a future manual white-balance gains API and is not\n * returned by `getWhiteBalanceModes()` until implemented.\n */\nexport type WhiteBalanceMode = 'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM';\n\n/**\n * Defines the options for setting the camera preview's opacity.\n */\nexport interface CameraOpacityOptions {\n /**\n * The opacity percentage, from 0.0 (fully transparent) to 1.0 (fully opaque).\n * @default 1.0\n */\n opacity?: number;\n}\n\n/**\n * Represents safe area insets for devices.\n * Android: Values are expressed in logical pixels (dp) to match JS layout units.\n * iOS: Values are expressed in physical pixels and exclude status bar.\n */\nexport interface SafeAreaInsets {\n /** Current device orientation (1 = portrait, 2 = landscape, 0 = unknown). */\n orientation: number;\n /**\n * Orientation-aware notch/camera cutout inset (excluding status bar).\n * In portrait mode: returns top inset (notch at top).\n * In landscape mode: returns left inset (notch at side).\n * Android: Value in dp, iOS: Value in pixels (status bar excluded).\n */\n top: number;\n}\n\n/**\n * Canonical device orientation values across platforms.\n */\nexport type DeviceOrientation = 'portrait' | 'landscape-left' | 'landscape-right' | 'portrait-upside-down' | 'unknown';\n\n/**\n * The main interface for the CameraPreview plugin.\n */\nexport interface CameraPreviewPlugin {\n /**\n * Starts the camera preview.\n *\n * @param {CameraPreviewOptions} options - The configuration for the camera preview.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the preview dimensions.\n * @since 0.0.1\n */\n start(options: CameraPreviewOptions): Promise<{\n /** The width of the preview in pixels. */\n width: number;\n /** The height of the preview in pixels. */\n height: number;\n /** The horizontal origin of the preview, in pixels. */\n x: number;\n /** The vertical origin of the preview, in pixels. */\n y: number;\n }>;\n\n /**\n * Stops the camera preview.\n *\n * @param {object} options - Optional configuration for stopping the camera.\n * @param {boolean} options.force - If true, forces the camera to stop even if busy or capturing. Default: false.\n * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(options?: { force?: boolean }): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * If `storeToFile` was set to `true` when starting the preview, the returned\n * `value` will be an absolute file path on the device instead of a base64 string. Use getBase64FromFilePath to get the base64 string from the file path.\n *\n * @param {CameraPreviewPictureOptions} options - The options for capturing the picture.\n * @returns {Promise<{ value: string; exif: ExifData }>} Resolves with:\n * - `value`: base64 string, or file path if `storeToFile` is true\n * - `exif`: extracted EXIF metadata when available\n * @since 0.0.1\n */\n capture(options: CameraPreviewPictureOptions): Promise<{ value: string; exif: ExifData }>;\n\n /**\n * Captures a single frame from the camera preview stream.\n *\n * @param {CameraSampleOptions} options - The options for capturing the sample.\n * @returns {Promise<{ value: string }>} A promise that resolves with the sample image as a base64 encoded string.\n * @since 0.0.1\n */\n captureSample(options: CameraSampleOptions): Promise<{ value: string }>;\n\n /**\n * Starts barcode scanning on the active camera preview.\n *\n * The scanner reuses the current camera session and emits `barcodeScanned` events.\n * Call `stopBarcodeScanner()` when scanning is no longer needed.\n *\n * Android uses the lightweight Google Play Services ML Kit model. If the model is not installed yet,\n * first scans may return no result until Google Play Services finishes downloading it.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n startBarcodeScanner(options?: BarcodeScannerOptions): Promise<void>;\n\n /**\n * Stops barcode scanning while keeping the camera preview running.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n stopBarcodeScanner(): Promise<void>;\n\n /**\n * Gets the flash modes supported by the active camera.\n *\n * @returns {Promise<{ result: CameraPreviewFlashMode[] }>} A promise that resolves with an array of supported flash modes.\n * @since 0.0.1\n */\n getSupportedFlashModes(): Promise<{\n result: CameraPreviewFlashMode[];\n }>;\n\n /**\n * Set the aspect ratio of the camera preview.\n *\n * @param {{ aspectRatio: CameraPreviewAspectRatio; x?: number; y?: number }} options - The desired aspect ratio and optional position.\n * - aspectRatio: The desired aspect ratio ('4:3', '16:9', or 'fill')\n * - x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.\n * - y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.\n * @since 7.5.0\n * @platform android, ios\n */\n setAspectRatio(options: { aspectRatio: CameraPreviewAspectRatio; x?: number; y?: number }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n\n /**\n * Gets the current aspect ratio of the camera preview.\n *\n * @returns {Promise<{ aspectRatio: CameraPreviewAspectRatio }>} A promise that resolves with the current aspect ratio.\n * @since 7.5.0\n * @platform android, ios\n */\n getAspectRatio(): Promise<{ aspectRatio: CameraPreviewAspectRatio }>;\n\n /**\n * Sets the grid mode of the camera preview overlay.\n *\n * @param {{ gridMode: GridMode }} options - The desired grid mode ('none', '3x3', or '4x4').\n * @returns {Promise<void>} A promise that resolves when the grid mode is set.\n * @since 8.0.0\n */\n setGridMode(options: { gridMode: GridMode }): Promise<void>;\n\n /**\n * Gets the current grid mode of the camera preview overlay.\n *\n * @returns {Promise<{ gridMode: GridMode }>} A promise that resolves with the current grid mode.\n * @since 8.0.0\n */\n getGridMode(): Promise<{ gridMode: GridMode }>;\n\n /**\n * Checks the current camera (and optionally microphone) permission status without prompting the system dialog.\n *\n * @param options Set `disableAudio` to `false` to also include microphone status (defaults to `true`).\n * @returns {Promise<CameraPermissionStatus>} A promise resolving to the current authorization states.\n * @since 8.7.0\n */\n checkPermissions(options?: Pick<PermissionRequestOptions, 'disableAudio'>): Promise<CameraPermissionStatus>;\n\n /**\n * Requests camera (and optional microphone) permissions. If permissions are already granted or denied,\n * the current status is returned without prompting. When `showSettingsAlert` is true and permissions are denied,\n * a platform specific alert guiding the user to the app settings will be presented.\n *\n * @param {PermissionRequestOptions} options - Configuration for the permission request behaviour.\n * @returns {Promise<CameraPermissionStatus>} A promise resolving to the final authorization states.\n * @since 8.7.0\n */\n requestPermissions(options?: PermissionRequestOptions): Promise<CameraPermissionStatus>;\n\n /**\n * Gets the horizontal field of view (FoV) for the active camera.\n * Note: This can be an estimate on some devices.\n *\n * @returns {Promise<{ result: number }>} A promise that resolves with the horizontal field of view in degrees.\n * @since 0.0.1\n */\n getHorizontalFov(): Promise<{\n result: number;\n }>;\n\n /**\n * Gets the supported picture sizes for all cameras.\n *\n * @returns {Promise<{ supportedPictureSizes: SupportedPictureSizes[] }>} A promise that resolves with the list of supported sizes.\n * @since 7.4.0\n */\n getSupportedPictureSizes(): Promise<{\n supportedPictureSizes: SupportedPictureSizes[];\n }>;\n\n /**\n * Sets the flash mode for the active camera.\n *\n * @param {{ flashMode: CameraPreviewFlashMode | string }} options - The desired flash mode.\n * @returns {Promise<void>} A promise that resolves when the flash mode is set.\n * @since 0.0.1\n */\n setFlashMode(options: { flashMode: CameraPreviewFlashMode | string }): Promise<void>;\n\n /**\n * Toggles between the front and rear cameras.\n *\n * @returns {Promise<void>} A promise that resolves when the camera is flipped.\n * @since 0.0.1\n */\n flip(): Promise<void>;\n\n /**\n * Sets the opacity of the camera preview.\n *\n * @param {CameraOpacityOptions} options - The opacity options.\n * @returns {Promise<void>} A promise that resolves when the opacity is set.\n * @since 0.0.1\n */\n setOpacity(options: CameraOpacityOptions): Promise<void>;\n\n /**\n * Stops an ongoing video recording.\n *\n * @returns {Promise<RecordingFinishedEvent>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<RecordingFinishedEvent>;\n\n /**\n * Starts recording a video.\n *\n * Supports `frameRate`, `videoCodec`, `videoStabilizationMode`, `maxDuration`, `maxFileSize`, `disableAudio`, `allowHapticsAndSystemSoundsDuringRecording`, and `mirrorFrontCamera` on each call.\n *\n * @param {CameraPreviewOptions} options - The options for video recording.\n * @returns {Promise<void>} A promise that resolves when video recording starts.\n * @since 0.0.1\n */\n startRecordVideo(options: CameraPreviewOptions): Promise<void>;\n\n /**\n * Sets the video recording quality for the active camera session.\n *\n * @param {{ quality: VideoQuality }} options - The desired video quality.\n * @returns {Promise<void>} A promise that resolves when the quality is set.\n * @since 8.5.0\n * @platform android, ios\n */\n setVideoQuality(options: { quality: VideoQuality }): Promise<void>;\n\n /**\n * Gets the current video recording quality.\n *\n * @returns {Promise<{ quality: VideoQuality }>} A promise that resolves with the current quality.\n * @since 8.5.0\n * @platform android, ios\n */\n getVideoQuality(): Promise<{ quality: VideoQuality }>;\n\n /**\n * Returns the video qualities supported by the active camera.\n *\n * @returns {Promise<{ qualities: VideoQuality[] }>} A promise that resolves with supported qualities.\n * @since 8.5.0\n * @platform android, ios\n */\n getSupportedVideoQualities(): Promise<{ qualities: VideoQuality[] }>;\n\n /**\n * Sets the video codec used when recording.\n *\n * @param {{ codec: VideoCodec }} options - The desired codec.\n * @returns {Promise<void>} A promise that resolves when the codec is set.\n * @since 8.5.0\n * @platform android, ios\n */\n setVideoCodec(options: { codec: VideoCodec }): Promise<void>;\n\n /**\n * Gets the current video codec used for recording.\n *\n * @returns {Promise<{ codec: VideoCodec }>} A promise that resolves with the current codec.\n * @since 8.5.0\n * @platform android, ios\n */\n getVideoCodec(): Promise<{ codec: VideoCodec }>;\n\n /**\n * Returns the video codecs supported by the active camera.\n *\n * @returns {Promise<{ codecs: VideoCodec[] }>} A promise that resolves with supported codecs.\n * @since 8.5.0\n * @platform android, ios\n */\n getSupportedVideoCodecs(): Promise<{ codecs: VideoCodec[] }>;\n\n /**\n * Checks whether video stabilization is supported by the active camera.\n *\n * @returns {Promise<{ supported: boolean }>} A promise that resolves with the support state.\n * @since 8.5.2\n * @platform android, ios\n */\n isVideoStabilizationSupported(): Promise<{ supported: boolean }>;\n\n /**\n * Returns the video stabilization modes supported by the active camera.\n *\n * @returns {Promise<{ modes: VideoStabilizationMode[] }>} A promise that resolves with supported modes.\n * @since 8.5.2\n * @platform android, ios\n */\n getSupportedVideoStabilizationModes(): Promise<{ modes: VideoStabilizationMode[] }>;\n\n /**\n * Gets the current video stabilization mode.\n *\n * @returns {Promise<{ mode: VideoStabilizationMode }>} A promise that resolves with the current mode.\n * @since 8.5.2\n * @platform android, ios\n */\n getVideoStabilizationMode(): Promise<{ mode: VideoStabilizationMode }>;\n\n /**\n * Sets the video stabilization mode for recording.\n * Cannot be changed while a recording is in progress.\n * You can also pass `videoStabilizationMode` in `startRecordVideo()` options.\n *\n * @param {{ mode: VideoStabilizationMode }} options - The desired stabilization mode.\n * @returns {Promise<void>} A promise that resolves when the mode is set.\n * @since 8.5.2\n * @platform android, ios\n */\n setVideoStabilizationMode(options: { mode: VideoStabilizationMode }): Promise<void>;\n\n /**\n * Checks if the camera preview is currently running.\n *\n * @returns {Promise<{ isRunning: boolean }>} A promise that resolves with the running state.\n * @since 7.5.0\n * @platform android, ios\n */\n isRunning(): Promise<{ isRunning: boolean }>;\n\n /**\n * Gets all available camera devices.\n *\n * @returns {Promise<{ devices: CameraDevice[] }>} A promise that resolves with the list of available camera devices.\n * @since 7.5.0\n * @platform android, ios\n */\n getAvailableDevices(): Promise<{ devices: CameraDevice[] }>;\n\n /**\n * Gets the current zoom state, including min/max and current lens info.\n *\n * @returns {Promise<{ min: number; max: number; current: number; lens: LensInfo }>} A promise that resolves with the zoom state.\n * @since 7.5.0\n * @platform android, ios\n */\n getZoom(): Promise<{\n min: number;\n max: number;\n current: number;\n lens: LensInfo;\n }>;\n\n /**\n * Returns zoom button values for quick switching.\n * - iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available\n * - Web: unsupported\n * @since 7.5.0\n * @platform android, ios\n */\n getZoomButtonValues(): Promise<{ values: number[] }>;\n\n /**\n * Sets the zoom level of the camera.\n *\n * @param {{ level: number; ramp?: boolean; autoFocus?: boolean }} options - The desired zoom level. `ramp` is currently unused. `autoFocus` defaults to true.\n * @returns {Promise<void>} A promise that resolves when the zoom level is set.\n * @since 7.5.0\n * @platform android, ios\n */\n setZoom(options: { level: number; ramp?: boolean; autoFocus?: boolean }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.5.0\n * @platform android, ios\n */\n getFlashMode(): Promise<{ flashMode: FlashMode }>;\n\n /**\n * Removes all registered listeners.\n *\n * @since 7.5.0\n * @platform android, ios\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Switches the active camera to the one with the specified `deviceId`.\n *\n * @param {{ deviceId: string }} options - The ID of the device to switch to.\n * @returns {Promise<void>} A promise that resolves when the camera is switched.\n * @since 7.5.0\n * @platform android, ios\n */\n setDeviceId(options: { deviceId: string }): Promise<void>;\n\n /**\n * Gets the ID of the camera device that is currently bound.\n * On Android, if a physical-lens request falls back to a logical camera, this returns the bound logical camera ID.\n *\n * @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.\n * @since 7.5.0\n * @platform android, ios\n */\n getDeviceId(): Promise<{ deviceId: string }>;\n\n /**\n * Gets the current visible camera preview bounds in web-view coordinates.\n *\n * With `aspectMode: 'contain'`, this is the letterboxed camera image rect inside the\n * preview container (not the full container when bars are shown). With `aspectMode: 'cover'`,\n * this matches the preview container bounds on both platforms.\n *\n * @returns {Promise<{x: number, y: number, width: number, height: number}>}\n * @since 7.5.0\n * @platform android, ios\n */\n getPreviewSize(): Promise<{\n x: number;\n y: number;\n width: number;\n height: number;\n }>;\n /**\n * Sets the preview size and position.\n * @param options The new position and dimensions.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the visible camera preview bounds (same contract as {@link CameraPreviewPlugin.getPreviewSize}).\n * @since 7.5.0\n * @platform android, ios\n */\n setPreviewSize(options: { x?: number; y?: number; width: number; height: number }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n\n /**\n * Sets the camera focus to a specific point in the preview.\n *\n * Note: The plugin does not attach any native tap-to-focus gesture handlers. Handle taps in\n * your HTML/JS (e.g., on the overlaying UI), then pass normalized coordinates here.\n *\n * @param {Object} options - The focus options.\n * @param {number} options.x - The x coordinate in the preview view to focus on (0-1 normalized).\n * @param {number} options.y - The y coordinate in the preview view to focus on (0-1 normalized).\n * @returns {Promise<void>} A promise that resolves when the focus is set.\n * @since 7.5.0\n * @platform android, ios\n */\n setFocus(options: { x: number; y: number }): Promise<void>;\n\n /**\n * Adds a listener for screen resize events.\n * @param {string} eventName - The event name to listen for.\n * @param {Function} listenerFunc - The function to call when the event is triggered.\n * @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.\n * @since 7.5.0\n * @platform android, ios\n */\n addListener(\n eventName: 'screenResize',\n listenerFunc: (data: { width: number; height: number; x: number; y: number }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for orientation change events.\n * @param {string} eventName - The event name to listen for.\n * @param {Function} listenerFunc - The function to call when the event is triggered.\n * @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.\n * @since 7.5.0\n * @platform android, ios\n */\n addListener(\n eventName: 'orientationChange',\n listenerFunc: (data: { orientation: DeviceOrientation }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for barcode scan results.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n addListener(\n eventName: 'barcodeScanned',\n listenerFunc: (data: BarcodeScannedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for non-fatal barcode scanner errors.\n *\n * @since 8.8.0\n * @platform android, web\n */\n addListener(\n eventName: 'barcodeScanError',\n listenerFunc: (data: BarcodeScanErrorEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener fired when a video recording finishes natively, including automatic stops.\n *\n * @since 8.4.7\n * @platform android, ios\n */\n addListener(\n eventName: 'recordingFinished',\n listenerFunc: (data: RecordingFinishedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for capture session interruptions (for example an active phone call).\n *\n * @since 8.11.7\n * @platform ios\n */\n addListener(\n eventName: 'cameraInterrupted',\n listenerFunc: (data: CameraInterruptedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener fired when a capture session interruption ends.\n * Native recovery may still be restarting the session; wait for preview frames before assuming the stream is live.\n *\n * @since 8.11.7\n * @platform ios\n */\n addListener(eventName: 'cameraInterruptionEnded', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Deletes a file at the given absolute path on the device.\n * Use this to quickly clean up temporary images created with `storeToFile`.\n * On web, this is not supported and will throw.\n * @since 7.5.0\n * @platform android, ios\n */\n deleteFile(options: { path: string }): Promise<{ success: boolean }>;\n\n /**\n * Gets the safe area insets for devices.\n * Returns the orientation-aware notch/camera cutout inset and the current orientation.\n * In portrait mode: returns top inset (notch at top).\n * In landscape mode: returns left inset (notch moved to side).\n * This specifically targets the cutout area (notch, punch hole, etc.) that all modern phones have.\n *\n * Android: Values returned in dp (logical pixels).\n * iOS: Values returned in physical pixels, excluding status bar (only pure notch/cutout size).\n *\n * @platform android, ios\n */\n getSafeAreaInsets(): Promise<SafeAreaInsets>;\n\n /**\n * Gets the current device orientation in a cross-platform format.\n * @since 7.5.0\n * @platform android, ios\n */\n getOrientation(): Promise<{ orientation: DeviceOrientation }>;\n\n /**\n * Returns the exposure modes supported by the active camera.\n * Modes can include: 'locked', 'auto', 'continuous', 'custom'.\n * @platform android, ios\n */\n getExposureModes(): Promise<{ modes: ExposureMode[] }>;\n\n /**\n * Returns the current exposure mode.\n * @platform android, ios\n */\n getExposureMode(): Promise<{ mode: ExposureMode }>;\n\n /**\n * Sets the exposure mode.\n * @platform android, ios\n */\n setExposureMode(options: { mode: ExposureMode }): Promise<void>;\n\n /**\n * Returns the exposure compensation (EV bias) supported range.\n * @platform ios, android\n */\n getExposureCompensationRange(): Promise<{\n min: number;\n max: number;\n step: number;\n }>;\n\n /**\n * Returns the current exposure compensation (EV bias).\n * @platform ios, android\n */\n getExposureCompensation(): Promise<{ value: number }>;\n\n /**\n * Sets the exposure compensation (EV bias). Value will be clamped to range.\n * @platform ios, android\n */\n setExposureCompensation(options: { value: number }): Promise<void>;\n\n /**\n * Returns the white-balance modes supported by the active camera.\n * Modes can include: 'AUTO', 'LOCK', 'CONTINUOUS'. `CUSTOM` is not listed\n * until manual gains support is implemented.\n * @platform android, ios\n */\n getWhiteBalanceModes(): Promise<{ modes: WhiteBalanceMode[] }>;\n\n /**\n * Returns the current white-balance mode.\n * @platform android, ios\n */\n getWhiteBalanceMode(): Promise<{ mode: WhiteBalanceMode }>;\n\n /**\n * Sets the white-balance mode. `CONTINUOUS` keeps auto white balance running\n * (recommended; avoids a warm/yellow cast), `LOCK` freezes the current gains,\n * `AUTO` performs a one-time adjustment. `CUSTOM` is reserved and rejected\n * until manual gains support is implemented.\n * @platform android, ios\n */\n setWhiteBalanceMode(options: { mode: WhiteBalanceMode }): Promise<void>;\n\n /**\n * Lists the video frame rates supported by the active camera for the current format.\n * Supported values depend on the selected camera, lens, and video quality.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n getSupportedVideoFrameRates(): Promise<{\n frameRates: number[];\n }>;\n\n /**\n * Returns the configured video frame rate for the active camera.\n * On Android the actual recording frame rate can still vary in low light or under thermal pressure.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n getVideoFrameRate(): Promise<{\n frameRate: number;\n }>;\n\n /**\n * Sets the target video frame rate for the active camera session.\n * Prefer passing `frameRate` to `startRecordVideo()` when starting a recording.\n * Rejects unsupported values with a clear error.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n setVideoFrameRate(options: { frameRate: number }): Promise<void>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA2FA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,sCAAwB,CAAA;IACxB,sCAAwB,CAAA;IACxB,qCAAuB,CAAA;IACvB,sCAAwB,CAAA;IACxB,2BAAa,CAAA;IACb,oCAAsB,CAAA;IACtB,+BAAiB,CAAA;AACnB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB","sourcesContent":["import type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\nexport type CameraPosition = 'rear' | 'front';\n\nexport type FlashMode = CameraPreviewFlashMode;\n\nexport type GridMode = 'none' | '3x3' | '4x4';\n\nexport type CameraPositioning = 'center' | 'top' | 'bottom';\n\nexport type CameraPreviewAspectRatio = '4:3' | '16:9' | 'fill';\n\n/**\n * Target still-capture resolution for still captures on Android and iOS.\n *\n * Width and height define the resolution strategy target. The plugin also filters out\n * supported capture sizes whose long edge exceeds `max(width, height)`.\n */\nexport interface CameraCaptureResolution {\n /** Target width in pixels. */\n width: number;\n /** Target height in pixels. */\n height: number;\n}\n\nexport type BarcodeScannerFormat =\n | 'aztec'\n | 'codabar'\n | 'code_39'\n | 'code_93'\n | 'code_128'\n | 'data_matrix'\n | 'ean_8'\n | 'ean_13'\n | 'itf'\n | 'pdf417'\n | 'qr_code'\n | 'upc_a'\n | 'upc_e';\n\nexport type BarcodeFormat = BarcodeScannerFormat | 'unknown';\n\nexport interface BarcodeScannerOptions {\n /**\n * Restricts detection to the given formats. Leaving this empty scans all supported formats.\n * Restricting formats can improve scanning speed.\n */\n formats?: BarcodeScannerFormat[];\n /**\n * Minimum delay between native scan attempts in milliseconds.\n * Lower values scan more often but use more CPU.\n * @default 500\n */\n detectionInterval?: number;\n}\n\nexport interface BarcodeScanResult {\n /** Decoded barcode value. */\n value: string;\n /** Barcode format. */\n format: BarcodeFormat;\n /** Human-readable value when the platform exposes one. */\n displayValue?: string;\n /** Base64-encoded raw bytes when the platform exposes them. */\n rawBytes?: string;\n}\n\nexport interface BarcodeScannedEvent {\n /** Barcodes decoded from the current frame. */\n barcodes: BarcodeScanResult[];\n}\n\nexport interface BarcodeScanErrorEvent {\n /** Native scanner error message. */\n message: string;\n}\n\nexport interface CameraPermissionStatus {\n camera: PermissionState;\n microphone?: PermissionState;\n}\n\nexport interface PermissionRequestOptions {\n disableAudio?: boolean;\n showSettingsAlert?: boolean;\n title?: string;\n message?: string;\n openSettingsButtonTitle?: string;\n cancelButtonTitle?: string;\n}\n\nexport enum DeviceType {\n ULTRA_WIDE = 'ultraWide',\n WIDE_ANGLE = 'wideAngle',\n TELEPHOTO = 'telephoto',\n TRUE_DEPTH = 'trueDepth',\n DUAL = 'dual',\n DUAL_WIDE = 'dualWide',\n TRIPLE = 'triple',\n}\n\n/**\n * Represents a single camera lens on a device. A {@link CameraDevice} can have multiple lenses.\n */\nexport interface CameraLens {\n /** A human-readable name for the lens, e.g., \"Ultra-Wide\". */\n label: string;\n /** The type of the camera lens. */\n deviceType: DeviceType;\n /** The focal length of the lens in millimeters. */\n focalLength: number;\n /** The base zoom factor for this lens (e.g., 0.5 for ultra-wide, 1.0 for wide). */\n baseZoomRatio: number;\n /** The minimum zoom factor supported by this specific lens. */\n minZoom: number;\n /** The maximum zoom factor supported by this specific lens. */\n maxZoom: number;\n}\n\n/**\n * Represents a physical camera on the device (e.g., the front-facing camera).\n */\nexport interface CameraDevice {\n /** A unique identifier for the camera device. */\n deviceId: string;\n /** A human-readable name for the camera device. */\n label: string;\n /** The physical position of the camera on the device. */\n position: CameraPosition;\n /** A list of all available lenses for this camera device. */\n lenses: CameraLens[];\n /** The overall minimum zoom factor available across all lenses on this device. */\n minZoom: number;\n /** The overall maximum zoom factor available across all lenses on this device. */\n maxZoom: number;\n /** Identifies whether the device is a logical camera (composed of multiple physical lenses). */\n isLogical: boolean;\n}\n\n/**\n * Represents the detailed information of the currently active lens.\n */\nexport interface LensInfo {\n /** The focal length of the active lens in millimeters. */\n focalLength: number;\n /** The device type of the active lens. */\n deviceType: DeviceType;\n /** The base zoom ratio of the active lens (e.g., 0.5x, 1.0x). */\n baseZoomRatio: number;\n /** The current digital zoom factor applied on top of the base zoom. */\n digitalZoom: number;\n}\n\nexport type VideoQuality = 'low' | 'medium' | 'high' | '2160p' | '1080p' | '720p' | '480p' | '4:3';\n\n/**\n * Video codec identifiers used when recording.\n * - `avc1`: H.264\n * - `hvc1`: HEVC / H.265\n */\nexport type VideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';\n\n/**\n * Video stabilization modes used when recording.\n *\n * On Android only `off` and `standard` are supported.\n * On iOS all listed modes may be available when the device supports video stabilization.\n */\nexport type VideoStabilizationMode =\n | 'off'\n | 'standard'\n | 'cinematic'\n | 'cinematicExtended'\n | 'previewOptimized'\n | 'cinematicExtendedEnhanced'\n | 'auto'\n | 'lowLatency';\n\nexport type RecordingFinishedReason = 'manual' | 'maxDuration' | 'maxFileSize';\n\nexport interface RecordingFinishedEvent {\n /**\n * The path to the recorded video file.\n */\n videoFilePath: string;\n /**\n * Why the recording stopped.\n */\n reason: RecordingFinishedReason;\n}\n\n/**\n * Emitted when the native capture session is interrupted (for example during a phone call).\n *\n * @since 8.11.7\n * @platform ios\n */\nexport interface CameraInterruptedEvent {\n /**\n * Why the session was interrupted.\n */\n reason: 'runtimeError' | 'interrupted';\n /**\n * When true, the plugin removed the microphone input and continued with video only.\n */\n audioDropped: boolean;\n}\n\n/**\n * Defines the configuration options for starting the camera preview.\n */\nexport interface CameraPreviewOptions {\n /**\n * The parent element to attach the video preview to.\n * @platform web\n */\n parent?: string;\n /**\n * A CSS class name to add to the preview element.\n * @platform web\n */\n className?: string;\n /**\n * The width of the preview in pixels. Defaults to the screen width.\n * @platform android, ios, web\n */\n width?: number;\n /**\n * The height of the preview in pixels. Defaults to the screen height.\n * @platform android, ios, web\n */\n height?: number;\n /**\n * The horizontal origin of the preview, in pixels.\n * @platform android, ios\n */\n x?: number;\n /**\n * The vertical origin of the preview, in pixels.\n * @platform android, ios\n */\n y?: number;\n /**\n * The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\n * Cannot be set if width or height is provided, otherwise the call will be rejected.\n * Use setPreviewSize to adjust size after starting.\n *\n * @since 2.0.0\n */\n aspectRatio?: CameraPreviewAspectRatio;\n /**\n * Controls how the camera preview fills the available space.\n * - 'contain': Fits the entire preview within the space, may show letterboxing (default).\n * - 'cover': Fills the entire space, may crop edges of the preview.\n * @default \"contain\"\n * @platform android, ios, web\n */\n aspectMode?: 'cover' | 'contain';\n /**\n * The grid overlay to display on the camera preview.\n * @default \"none\"\n * @since 2.1.0\n */\n gridMode?: GridMode;\n /**\n * Adjusts the y-position to account for safe areas (e.g., notches).\n * @platform android, ios\n * @default false\n */\n includeSafeAreaInsets?: boolean;\n /**\n * If true, places the preview behind the webview.\n * @platform android\n * @default true\n */\n toBack?: boolean;\n /**\n * Bottom padding for the preview, in pixels.\n * @platform android, ios\n */\n paddingBottom?: number;\n /**\n * Whether to rotate the preview when the device orientation changes.\n * @platform ios\n * @default true\n */\n rotateWhenOrientationChanged?: boolean;\n /**\n * The camera to use.\n * @default \"rear\"\n */\n position?: CameraPosition | string;\n /**\n * If true, saves the captured image to a file and returns the file path.\n * If false, returns a base64 encoded string.\n * @default false\n */\n storeToFile?: boolean;\n /**\n * If true, prevents the plugin from rotating the image based on EXIF data.\n * @platform android\n * @default false\n */\n disableExifHeaderStripping?: boolean;\n /**\n * If true, disables the audio stream, preventing audio permission requests.\n * @default true\n */\n disableAudio?: boolean;\n /**\n * If true, locks the device orientation while the camera is active.\n * @platform android\n * @default false\n */\n lockAndroidOrientation?: boolean;\n /**\n * If true, allows the camera preview's opacity to be changed.\n * @platform android, web\n * @default false\n */\n enableOpacity?: boolean;\n\n /**\n * If true, disables the visual focus indicator when tapping to focus.\n * @platform android, ios\n * @default false\n */\n disableFocusIndicator?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n /**\n * On Android, attempts to bind a physical camera directly when `deviceId` refers to a physical lens.\n * Disabled by default because OEM support is inconsistent; when false, Android keeps the current logical-camera fallback behavior.\n * @default false\n * @platform android\n */\n enablePhysicalDeviceSelection?: boolean;\n /**\n * The initial zoom level when starting the camera preview.\n * If the requested zoom level is not available, the native plugin will reject.\n * @default 1.0\n * @platform android, ios\n * @since 2.2.0\n */\n initialZoomLevel?: number;\n /**\n * The vertical positioning of the camera preview.\n * @default \"center\"\n * @platform android, ios, web\n * @since 2.3.0\n */\n positioning?: CameraPositioning;\n /**\n * If true, enables video capture capabilities when the camera starts.\n * @default false\n * @platform android, ios\n * @since 7.11.0\n */\n enableVideoMode?: boolean;\n /**\n * Sets the still-capture sensor resolution cap at session start. Preview resolution is unchanged.\n * The shared ViewPort crop from the preview still applies to captures.\n *\n * On Android this binds the `ImageCapture` use case to the requested size. On iOS 16+ this sets\n * `AVCapturePhotoSettings.maxPhotoDimensions` (and disables high-resolution photo capture when capped)\n * to the largest supported sensor size at or below the requested cap. When the active format exposes\n * no supported size under the cap, iOS uses the smallest supported `maxPhotoDimensions` entry (same\n * fallback as Android) so `start()` never assigns an unsupported dimension.\n * On iOS 15, `start()` rejects this option.\n *\n * When omitted, capture uses the highest resolution supported by the active camera\n * (same as versions before 8.11.10 on Android, and the format default on iOS). Set this to cap\n * capture size for faster shots on high-megapixel sensors, for example `{ width: 1920, height: 1080 }`\n * or `{ width: 1600, height: 1200 }`.\n *\n * @platform android, ios\n * @since 8.12.0\n * @since 8.13.0 (iOS)\n */\n captureResolution?: CameraCaptureResolution;\n /**\n * If true, forces the camera to start/restart even if it's already running or busy.\n * This will kill the current camera session and start a new one, ignoring all state checks.\n * @default false\n * @platform android, ios, web\n */\n force?: boolean;\n /**\n * Sets the quality of video for recording.\n * Options: 'low', 'medium', 'high', '2160p', '1080p', '720p', '480p', '4:3'\n * @note On Android requires 'enableVideoMode' to be true\n * @note Will affect the entire preview stream for iOS\n * @platform ios, android\n * @default \"high\"\n */\n videoQuality?: VideoQuality;\n /**\n * Maximum recording duration in seconds. Recording stops automatically when reached.\n * @platform ios, android\n */\n maxDuration?: number;\n /**\n * Maximum recording file size in bytes. Recording stops automatically when reached.\n * @platform ios, android\n */\n maxFileSize?: number;\n /**\n * Preferred video codec for recording.\n * @platform ios, android\n * @default \"avc1\"\n */\n videoCodec?: VideoCodec;\n /**\n * Target video frame rate in frames per second.\n * Applied when recording starts. Use `getSupportedVideoFrameRates()` to list supported values.\n * @platform ios, android\n * @since 8.6.0\n */\n frameRate?: number;\n /**\n * Preferred video stabilization mode for recording.\n * @platform ios, android\n * @default \"off\"\n */\n videoStabilizationMode?: VideoStabilizationMode;\n /**\n * When `true`, allows haptic feedback and system sounds while recording video with audio.\n * iOS suppresses haptics during audio input recording unless this is enabled.\n * Requires `disableAudio: false`.\n * @platform ios\n * @default false\n * @since 8.8.0\n */\n allowHapticsAndSystemSoundsDuringRecording?: boolean;\n /**\n * When `true` and the front camera is active, mirrors the recorded video file\n * so it matches the selfie-style preview (text and gestures are not reversed).\n * Does not affect the live preview. Defaults to `false` to preserve existing behavior.\n * @platform ios, android\n * @default false\n * @since 8.10.0\n */\n mirrorFrontCamera?: boolean;\n /**\n * Starts barcode scanning together with the camera preview.\n * Set to `true` or pass options to scan all supported formats.\n * Omit this option to keep barcode scanning disabled at startup.\n * @platform android, ios, web\n * @since 8.8.0\n */\n barcodeScanner?: boolean | BarcodeScannerOptions;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /**\n * The maximum height of the picture in pixels. The image will be resized to fit within this height while maintaining aspect ratio.\n * If not specified the captured image will match the preview's visible area.\n */\n height?: number;\n /**\n * The maximum width of the picture in pixels. The image will be resized to fit within this width while maintaining aspect ratio.\n * If not specified the captured image will match the preview's visible area.\n */\n width?: number;\n /**\n * The quality of the captured image, from 0 to 100.\n * Does not apply to `png` format.\n * @default 85\n */\n quality?: number;\n /**\n * The format of the captured image.\n * @default \"jpeg\"\n */\n format?: PictureFormat;\n /**\n * If true, the captured image will be saved to the user's gallery.\n * @default false\n * @since 7.5.0\n */\n saveToGallery?: boolean;\n /**\n * If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.\n * This may prompt the user for location permissions.\n * @default false\n * @since 7.6.0\n */\n withExifLocation?: boolean;\n /**\n * If true, the plugin will embed a timestamp in the top-right corner of the image.\n * @default false\n * @since 7.17.0\n */\n embedTimestamp?: boolean;\n /**\n * If true, the plugin will embed the current location in the top-right corner of the image.\n * Requires `withExifLocation` to be enabled.\n * @default false\n * @since 7.18.0\n */\n embedLocation?: boolean;\n /**\n * Sets the priority for photo quality vs. capture speed.\n * - \"speed\": Prioritizes faster capture times, may reduce image quality.\n * - \"balanced\": Aims for a balance between quality and speed.\n * - \"quality\": Prioritizes image quality, may reduce capture speed.\n * See https://developer.apple.com/documentation/avfoundation/avcapturephotosettings/photoqualityprioritization for details.\n *\n * @since 7.21.0\n * @platform ios\n * @default \"speed\"\n */\n photoQualityPrioritization?: 'speed' | 'balanced' | 'quality';\n /**\n * If true and the front camera is active, horizontally mirror the captured photo\n * so it matches a selfie-style preview. Rear camera captures are never mirrored.\n * Defaults to false to preserve the previous non-mirrored behavior.\n * @default false\n * @since 8.10.0\n */\n mirrorFrontCamera?: boolean;\n /**\n * Which orientation to apply to the captured photo.\n * - `\"device\"`: uses physical device tilt from the accelerometer (default). Preserves landscape captures when the app UI is rotation-locked.\n * - `\"preview\"`: matches the on-screen preview. Use for WYSIWYG capture, including retakes without stopping the camera.\n * @default \"device\"\n * @since 8.13.0\n */\n orientation?: 'preview' | 'device';\n}\n\n/** Represents EXIF data extracted from an image. */\nexport interface ExifData {\n [key: string]: any;\n}\n\nexport type PictureFormat = 'jpeg' | 'png';\n\n/** Defines a standard picture size with width and height. */\nexport interface PictureSize {\n /** The width of the picture in pixels. */\n width: number;\n /** The height of the picture in pixels. */\n height: number;\n}\n\n/** Represents the supported picture sizes for a camera facing a certain direction. */\nexport interface SupportedPictureSizes {\n /** The camera direction (\"front\" or \"rear\"). */\n facing: string;\n /** A list of supported picture sizes for this camera. */\n supportedPictureSizes: PictureSize[];\n}\n\n/**\n * Defines the options for capturing a sample frame from the camera preview.\n */\nexport interface CameraSampleOptions {\n /**\n * The quality of the captured sample, from 0 to 100.\n * @default 85\n */\n quality?: number;\n /**\n * If true and the front camera is active, horizontally mirror the captured sample\n * so it matches a selfie-style preview. Rear camera samples are never mirrored.\n * Defaults to false to preserve the previous non-mirrored behavior.\n * @default false\n * @since 8.10.0\n */\n mirrorFrontCamera?: boolean;\n}\n\n/**\n * The available flash modes for the camera.\n * 'torch' is a continuous light mode.\n */\nexport type CameraPreviewFlashMode = 'off' | 'on' | 'auto' | 'torch';\n\n/** Reusable exposure mode type for cross-platform support. */\nexport type ExposureMode = 'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM';\n\n/**\n * Reusable white-balance mode type for cross-platform support.\n * `CUSTOM` is reserved for a future manual white-balance gains API and is not\n * returned by `getWhiteBalanceModes()` until implemented.\n */\nexport type WhiteBalanceMode = 'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM';\n\n/**\n * Defines the options for setting the camera preview's opacity.\n */\nexport interface CameraOpacityOptions {\n /**\n * The opacity percentage, from 0.0 (fully transparent) to 1.0 (fully opaque).\n * @default 1.0\n */\n opacity?: number;\n}\n\n/**\n * Represents safe area insets for devices.\n * Android: Values are expressed in logical pixels (dp) to match JS layout units.\n * iOS: Values are expressed in physical pixels and exclude status bar.\n */\nexport interface SafeAreaInsets {\n /** Current device orientation (1 = portrait, 2 = landscape, 0 = unknown). */\n orientation: number;\n /**\n * Orientation-aware notch/camera cutout inset (excluding status bar).\n * In portrait mode: returns top inset (notch at top).\n * In landscape mode: returns left inset (notch at side).\n * Android: Value in dp, iOS: Value in pixels (status bar excluded).\n */\n top: number;\n}\n\n/**\n * Canonical device orientation values across platforms.\n */\nexport type DeviceOrientation = 'portrait' | 'landscape-left' | 'landscape-right' | 'portrait-upside-down' | 'unknown';\n\n/**\n * The main interface for the CameraPreview plugin.\n */\nexport interface CameraPreviewPlugin {\n /**\n * Starts the camera preview.\n *\n * @param {CameraPreviewOptions} options - The configuration for the camera preview.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the preview dimensions.\n * @since 0.0.1\n */\n start(options: CameraPreviewOptions): Promise<{\n /** The width of the preview in pixels. */\n width: number;\n /** The height of the preview in pixels. */\n height: number;\n /** The horizontal origin of the preview, in pixels. */\n x: number;\n /** The vertical origin of the preview, in pixels. */\n y: number;\n }>;\n\n /**\n * Stops the camera preview.\n *\n * @param {object} options - Optional configuration for stopping the camera.\n * @param {boolean} options.force - If true, forces the camera to stop even if busy or capturing. Default: false.\n * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(options?: { force?: boolean }): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * If `storeToFile` was set to `true` when starting the preview, the returned\n * `value` will be an absolute file path on the device instead of a base64 string. Use getBase64FromFilePath to get the base64 string from the file path.\n *\n * @param {CameraPreviewPictureOptions} options - The options for capturing the picture.\n * @returns {Promise<{ value: string; exif: ExifData }>} Resolves with:\n * - `value`: base64 string, or file path if `storeToFile` is true\n * - `exif`: extracted EXIF metadata when available\n * @since 0.0.1\n */\n capture(options: CameraPreviewPictureOptions): Promise<{ value: string; exif: ExifData }>;\n\n /**\n * Captures a single frame from the camera preview stream.\n *\n * @param {CameraSampleOptions} options - The options for capturing the sample.\n * @returns {Promise<{ value: string }>} A promise that resolves with the sample image as a base64 encoded string.\n * @since 0.0.1\n */\n captureSample(options: CameraSampleOptions): Promise<{ value: string }>;\n\n /**\n * Starts barcode scanning on the active camera preview.\n *\n * The scanner reuses the current camera session and emits `barcodeScanned` events.\n * Call `stopBarcodeScanner()` when scanning is no longer needed.\n *\n * Android uses the lightweight Google Play Services ML Kit model. If the model is not installed yet,\n * first scans may return no result until Google Play Services finishes downloading it.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n startBarcodeScanner(options?: BarcodeScannerOptions): Promise<void>;\n\n /**\n * Stops barcode scanning while keeping the camera preview running.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n stopBarcodeScanner(): Promise<void>;\n\n /**\n * Gets the flash modes supported by the active camera.\n *\n * @returns {Promise<{ result: CameraPreviewFlashMode[] }>} A promise that resolves with an array of supported flash modes.\n * @since 0.0.1\n */\n getSupportedFlashModes(): Promise<{\n result: CameraPreviewFlashMode[];\n }>;\n\n /**\n * Set the aspect ratio of the camera preview.\n *\n * @param {{ aspectRatio: CameraPreviewAspectRatio; x?: number; y?: number }} options - The desired aspect ratio and optional position.\n * - aspectRatio: The desired aspect ratio ('4:3', '16:9', or 'fill')\n * - x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.\n * - y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.\n * @since 7.5.0\n * @platform android, ios\n */\n setAspectRatio(options: { aspectRatio: CameraPreviewAspectRatio; x?: number; y?: number }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n\n /**\n * Gets the current aspect ratio of the camera preview.\n *\n * @returns {Promise<{ aspectRatio: CameraPreviewAspectRatio }>} A promise that resolves with the current aspect ratio.\n * @since 7.5.0\n * @platform android, ios\n */\n getAspectRatio(): Promise<{ aspectRatio: CameraPreviewAspectRatio }>;\n\n /**\n * Sets the grid mode of the camera preview overlay.\n *\n * @param {{ gridMode: GridMode }} options - The desired grid mode ('none', '3x3', or '4x4').\n * @returns {Promise<void>} A promise that resolves when the grid mode is set.\n * @since 8.0.0\n */\n setGridMode(options: { gridMode: GridMode }): Promise<void>;\n\n /**\n * Gets the current grid mode of the camera preview overlay.\n *\n * @returns {Promise<{ gridMode: GridMode }>} A promise that resolves with the current grid mode.\n * @since 8.0.0\n */\n getGridMode(): Promise<{ gridMode: GridMode }>;\n\n /**\n * Checks the current camera (and optionally microphone) permission status without prompting the system dialog.\n *\n * @param options Set `disableAudio` to `false` to also include microphone status (defaults to `true`).\n * @returns {Promise<CameraPermissionStatus>} A promise resolving to the current authorization states.\n * @since 8.7.0\n */\n checkPermissions(options?: Pick<PermissionRequestOptions, 'disableAudio'>): Promise<CameraPermissionStatus>;\n\n /**\n * Requests camera (and optional microphone) permissions. If permissions are already granted or denied,\n * the current status is returned without prompting. When `showSettingsAlert` is true and permissions are denied,\n * a platform specific alert guiding the user to the app settings will be presented.\n *\n * @param {PermissionRequestOptions} options - Configuration for the permission request behaviour.\n * @returns {Promise<CameraPermissionStatus>} A promise resolving to the final authorization states.\n * @since 8.7.0\n */\n requestPermissions(options?: PermissionRequestOptions): Promise<CameraPermissionStatus>;\n\n /**\n * Gets the horizontal field of view (FoV) for the active camera.\n * Note: This can be an estimate on some devices.\n *\n * @returns {Promise<{ result: number }>} A promise that resolves with the horizontal field of view in degrees.\n * @since 0.0.1\n */\n getHorizontalFov(): Promise<{\n result: number;\n }>;\n\n /**\n * Gets the supported picture sizes for all cameras.\n *\n * @returns {Promise<{ supportedPictureSizes: SupportedPictureSizes[] }>} A promise that resolves with the list of supported sizes.\n * @since 7.4.0\n */\n getSupportedPictureSizes(): Promise<{\n supportedPictureSizes: SupportedPictureSizes[];\n }>;\n\n /**\n * Sets the flash mode for the active camera.\n *\n * @param {{ flashMode: CameraPreviewFlashMode | string }} options - The desired flash mode.\n * @returns {Promise<void>} A promise that resolves when the flash mode is set.\n * @since 0.0.1\n */\n setFlashMode(options: { flashMode: CameraPreviewFlashMode | string }): Promise<void>;\n\n /**\n * Toggles between the front and rear cameras.\n *\n * @returns {Promise<void>} A promise that resolves when the camera is flipped.\n * @since 0.0.1\n */\n flip(): Promise<void>;\n\n /**\n * Sets the opacity of the camera preview.\n *\n * @param {CameraOpacityOptions} options - The opacity options.\n * @returns {Promise<void>} A promise that resolves when the opacity is set.\n * @since 0.0.1\n */\n setOpacity(options: CameraOpacityOptions): Promise<void>;\n\n /**\n * Stops an ongoing video recording.\n *\n * @returns {Promise<RecordingFinishedEvent>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<RecordingFinishedEvent>;\n\n /**\n * Starts recording a video.\n *\n * Supports `frameRate`, `videoCodec`, `videoStabilizationMode`, `maxDuration`, `maxFileSize`, `disableAudio`, `allowHapticsAndSystemSoundsDuringRecording`, and `mirrorFrontCamera` on each call.\n *\n * @param {CameraPreviewOptions} options - The options for video recording.\n * @returns {Promise<void>} A promise that resolves when video recording starts.\n * @since 0.0.1\n */\n startRecordVideo(options: CameraPreviewOptions): Promise<void>;\n\n /**\n * Sets the video recording quality for the active camera session.\n *\n * @param {{ quality: VideoQuality }} options - The desired video quality.\n * @returns {Promise<void>} A promise that resolves when the quality is set.\n * @since 8.5.0\n * @platform android, ios\n */\n setVideoQuality(options: { quality: VideoQuality }): Promise<void>;\n\n /**\n * Gets the current video recording quality.\n *\n * @returns {Promise<{ quality: VideoQuality }>} A promise that resolves with the current quality.\n * @since 8.5.0\n * @platform android, ios\n */\n getVideoQuality(): Promise<{ quality: VideoQuality }>;\n\n /**\n * Returns the video qualities supported by the active camera.\n *\n * @returns {Promise<{ qualities: VideoQuality[] }>} A promise that resolves with supported qualities.\n * @since 8.5.0\n * @platform android, ios\n */\n getSupportedVideoQualities(): Promise<{ qualities: VideoQuality[] }>;\n\n /**\n * Sets the video codec used when recording.\n *\n * @param {{ codec: VideoCodec }} options - The desired codec.\n * @returns {Promise<void>} A promise that resolves when the codec is set.\n * @since 8.5.0\n * @platform android, ios\n */\n setVideoCodec(options: { codec: VideoCodec }): Promise<void>;\n\n /**\n * Gets the current video codec used for recording.\n *\n * @returns {Promise<{ codec: VideoCodec }>} A promise that resolves with the current codec.\n * @since 8.5.0\n * @platform android, ios\n */\n getVideoCodec(): Promise<{ codec: VideoCodec }>;\n\n /**\n * Returns the video codecs supported by the active camera.\n *\n * @returns {Promise<{ codecs: VideoCodec[] }>} A promise that resolves with supported codecs.\n * @since 8.5.0\n * @platform android, ios\n */\n getSupportedVideoCodecs(): Promise<{ codecs: VideoCodec[] }>;\n\n /**\n * Checks whether video stabilization is supported by the active camera.\n *\n * @returns {Promise<{ supported: boolean }>} A promise that resolves with the support state.\n * @since 8.5.2\n * @platform android, ios\n */\n isVideoStabilizationSupported(): Promise<{ supported: boolean }>;\n\n /**\n * Returns the video stabilization modes supported by the active camera.\n *\n * @returns {Promise<{ modes: VideoStabilizationMode[] }>} A promise that resolves with supported modes.\n * @since 8.5.2\n * @platform android, ios\n */\n getSupportedVideoStabilizationModes(): Promise<{ modes: VideoStabilizationMode[] }>;\n\n /**\n * Gets the current video stabilization mode.\n *\n * @returns {Promise<{ mode: VideoStabilizationMode }>} A promise that resolves with the current mode.\n * @since 8.5.2\n * @platform android, ios\n */\n getVideoStabilizationMode(): Promise<{ mode: VideoStabilizationMode }>;\n\n /**\n * Sets the video stabilization mode for recording.\n * Cannot be changed while a recording is in progress.\n * You can also pass `videoStabilizationMode` in `startRecordVideo()` options.\n *\n * @param {{ mode: VideoStabilizationMode }} options - The desired stabilization mode.\n * @returns {Promise<void>} A promise that resolves when the mode is set.\n * @since 8.5.2\n * @platform android, ios\n */\n setVideoStabilizationMode(options: { mode: VideoStabilizationMode }): Promise<void>;\n\n /**\n * Checks if the camera preview is currently running.\n *\n * @returns {Promise<{ isRunning: boolean }>} A promise that resolves with the running state.\n * @since 7.5.0\n * @platform android, ios\n */\n isRunning(): Promise<{ isRunning: boolean }>;\n\n /**\n * Gets all available camera devices.\n *\n * @returns {Promise<{ devices: CameraDevice[] }>} A promise that resolves with the list of available camera devices.\n * @since 7.5.0\n * @platform android, ios\n */\n getAvailableDevices(): Promise<{ devices: CameraDevice[] }>;\n\n /**\n * Gets the current zoom state, including min/max and current lens info.\n *\n * @returns {Promise<{ min: number; max: number; current: number; lens: LensInfo }>} A promise that resolves with the zoom state.\n * @since 7.5.0\n * @platform android, ios\n */\n getZoom(): Promise<{\n min: number;\n max: number;\n current: number;\n lens: LensInfo;\n }>;\n\n /**\n * Returns zoom button values for quick switching.\n * - iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available\n * - Web: unsupported\n * @since 7.5.0\n * @platform android, ios\n */\n getZoomButtonValues(): Promise<{ values: number[] }>;\n\n /**\n * Sets the zoom level of the camera.\n *\n * @param {{ level: number; ramp?: boolean; autoFocus?: boolean }} options - The desired zoom level. `ramp` is currently unused. `autoFocus` defaults to true.\n * @returns {Promise<void>} A promise that resolves when the zoom level is set.\n * @since 7.5.0\n * @platform android, ios\n */\n setZoom(options: { level: number; ramp?: boolean; autoFocus?: boolean }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.5.0\n * @platform android, ios\n */\n getFlashMode(): Promise<{ flashMode: FlashMode }>;\n\n /**\n * Removes all registered listeners.\n *\n * @since 7.5.0\n * @platform android, ios\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Switches the active camera to the one with the specified `deviceId`.\n *\n * @param {{ deviceId: string }} options - The ID of the device to switch to.\n * @returns {Promise<void>} A promise that resolves when the camera is switched.\n * @since 7.5.0\n * @platform android, ios\n */\n setDeviceId(options: { deviceId: string }): Promise<void>;\n\n /**\n * Gets the ID of the camera device that is currently bound.\n * On Android, if a physical-lens request falls back to a logical camera, this returns the bound logical camera ID.\n *\n * @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.\n * @since 7.5.0\n * @platform android, ios\n */\n getDeviceId(): Promise<{ deviceId: string }>;\n\n /**\n * Gets the current visible camera preview bounds in web-view coordinates.\n *\n * With `aspectMode: 'contain'`, this is the letterboxed camera image rect inside the\n * preview container (not the full container when bars are shown). With `aspectMode: 'cover'`,\n * this matches the preview container bounds on both platforms.\n *\n * @returns {Promise<{x: number, y: number, width: number, height: number}>}\n * @since 7.5.0\n * @platform android, ios\n */\n getPreviewSize(): Promise<{\n x: number;\n y: number;\n width: number;\n height: number;\n }>;\n /**\n * Sets the preview size and position.\n * @param options The new position and dimensions.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the visible camera preview bounds (same contract as {@link CameraPreviewPlugin.getPreviewSize}).\n * @since 7.5.0\n * @platform android, ios\n */\n setPreviewSize(options: { x?: number; y?: number; width: number; height: number }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n\n /**\n * Sets the camera focus to a specific point in the preview.\n *\n * Note: The plugin does not attach any native tap-to-focus gesture handlers. Handle taps in\n * your HTML/JS (e.g., on the overlaying UI), then pass normalized coordinates here.\n *\n * @param {Object} options - The focus options.\n * @param {number} options.x - The x coordinate in the preview view to focus on (0-1 normalized).\n * @param {number} options.y - The y coordinate in the preview view to focus on (0-1 normalized).\n * @returns {Promise<void>} A promise that resolves when the focus is set.\n * @since 7.5.0\n * @platform android, ios\n */\n setFocus(options: { x: number; y: number }): Promise<void>;\n\n /**\n * Adds a listener for screen resize events.\n * @param {string} eventName - The event name to listen for.\n * @param {Function} listenerFunc - The function to call when the event is triggered.\n * @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.\n * @since 7.5.0\n * @platform android, ios\n */\n addListener(\n eventName: 'screenResize',\n listenerFunc: (data: { width: number; height: number; x: number; y: number }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for orientation change events.\n * @param {string} eventName - The event name to listen for.\n * @param {Function} listenerFunc - The function to call when the event is triggered.\n * @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.\n * @since 7.5.0\n * @platform android, ios\n */\n addListener(\n eventName: 'orientationChange',\n listenerFunc: (data: { orientation: DeviceOrientation }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for barcode scan results.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n addListener(\n eventName: 'barcodeScanned',\n listenerFunc: (data: BarcodeScannedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for non-fatal barcode scanner errors.\n *\n * @since 8.8.0\n * @platform android, web\n */\n addListener(\n eventName: 'barcodeScanError',\n listenerFunc: (data: BarcodeScanErrorEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener fired when a video recording finishes natively, including automatic stops.\n *\n * @since 8.4.7\n * @platform android, ios\n */\n addListener(\n eventName: 'recordingFinished',\n listenerFunc: (data: RecordingFinishedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for capture session interruptions (for example an active phone call).\n *\n * @since 8.11.7\n * @platform ios\n */\n addListener(\n eventName: 'cameraInterrupted',\n listenerFunc: (data: CameraInterruptedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener fired when a capture session interruption ends.\n * Native recovery may still be restarting the session; wait for preview frames before assuming the stream is live.\n *\n * @since 8.11.7\n * @platform ios\n */\n addListener(eventName: 'cameraInterruptionEnded', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Deletes a file at the given absolute path on the device.\n * Use this to quickly clean up temporary images created with `storeToFile`.\n * On web, this is not supported and will throw.\n * @since 7.5.0\n * @platform android, ios\n */\n deleteFile(options: { path: string }): Promise<{ success: boolean }>;\n\n /**\n * Gets the safe area insets for devices.\n * Returns the orientation-aware notch/camera cutout inset and the current orientation.\n * In portrait mode: returns top inset (notch at top).\n * In landscape mode: returns left inset (notch moved to side).\n * This specifically targets the cutout area (notch, punch hole, etc.) that all modern phones have.\n *\n * Android: Values returned in dp (logical pixels).\n * iOS: Values returned in physical pixels, excluding status bar (only pure notch/cutout size).\n *\n * @platform android, ios\n */\n getSafeAreaInsets(): Promise<SafeAreaInsets>;\n\n /**\n * Gets the current device orientation in a cross-platform format.\n * @since 7.5.0\n * @platform android, ios\n */\n getOrientation(): Promise<{ orientation: DeviceOrientation }>;\n\n /**\n * Returns the exposure modes supported by the active camera.\n * Modes can include: 'locked', 'auto', 'continuous', 'custom'.\n * @platform android, ios\n */\n getExposureModes(): Promise<{ modes: ExposureMode[] }>;\n\n /**\n * Returns the current exposure mode.\n * @platform android, ios\n */\n getExposureMode(): Promise<{ mode: ExposureMode }>;\n\n /**\n * Sets the exposure mode.\n * @platform android, ios\n */\n setExposureMode(options: { mode: ExposureMode }): Promise<void>;\n\n /**\n * Returns the exposure compensation (EV bias) supported range.\n * @platform ios, android\n */\n getExposureCompensationRange(): Promise<{\n min: number;\n max: number;\n step: number;\n }>;\n\n /**\n * Returns the current exposure compensation (EV bias).\n * @platform ios, android\n */\n getExposureCompensation(): Promise<{ value: number }>;\n\n /**\n * Sets the exposure compensation (EV bias). Value will be clamped to range.\n * @platform ios, android\n */\n setExposureCompensation(options: { value: number }): Promise<void>;\n\n /**\n * Returns the white-balance modes supported by the active camera.\n * Modes can include: 'AUTO', 'LOCK', 'CONTINUOUS'. `CUSTOM` is not listed\n * until manual gains support is implemented.\n * @platform android, ios\n */\n getWhiteBalanceModes(): Promise<{ modes: WhiteBalanceMode[] }>;\n\n /**\n * Returns the current white-balance mode.\n * @platform android, ios\n */\n getWhiteBalanceMode(): Promise<{ mode: WhiteBalanceMode }>;\n\n /**\n * Sets the white-balance mode. `CONTINUOUS` keeps auto white balance running\n * (recommended; avoids a warm/yellow cast), `LOCK` freezes the current gains,\n * `AUTO` performs a one-time adjustment. `CUSTOM` is reserved and rejected\n * until manual gains support is implemented.\n * @platform android, ios\n */\n setWhiteBalanceMode(options: { mode: WhiteBalanceMode }): Promise<void>;\n\n /**\n * Lists the video frame rates supported by the active camera for the current format.\n * Supported values depend on the selected camera, lens, and video quality.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n getSupportedVideoFrameRates(): Promise<{\n frameRates: number[];\n }>;\n\n /**\n * Returns the configured video frame rate for the active camera.\n * On Android the actual recording frame rate can still vary in low light or under thermal pressure.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n getVideoFrameRate(): Promise<{\n frameRate: number;\n }>;\n\n /**\n * Sets the target video frame rate for the active camera session.\n * Prefer passing `frameRate` to `startRecordVideo()` when starting a recording.\n * Rejects unsupported values with a clear error.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n setVideoFrameRate(options: { frameRate: number }): Promise<void>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
@@ -588,15 +588,20 @@ class CameraController: NSObject, CXCallObserverDelegate {
588
588
  return CaptureResolutionSupport.photoMaxDimensions(
589
589
  configuredWidth: width,
590
590
  configuredHeight: height,
591
- supportedDimensions: device.activeFormat.supportedMaxPhotoDimensions,
592
- deviceMax: photoOutput.maxPhotoDimensions
591
+ supportedDimensions: device.activeFormat.supportedMaxPhotoDimensions
593
592
  )
594
593
  }
595
594
 
596
595
  private func applyConfiguredCaptureResolutionToPhotoOutputIfNeeded() {
597
596
  guard #available(iOS 16.0, *),
598
597
  let photoOutput = self.photoOutput,
599
- let dimensions = self.configuredPhotoMaxDimensions() else {
598
+ let dimensions = self.configuredPhotoMaxDimensions(),
599
+ let device = self.activeCaptureDevice() else {
600
+ return
601
+ }
602
+
603
+ let supported = device.activeFormat.supportedMaxPhotoDimensions
604
+ guard CaptureResolutionSupport.isSupportedPhotoDimension(dimensions, in: supported) else {
600
605
  return
601
606
  }
602
607
 
@@ -3470,6 +3475,7 @@ extension CameraController {
3470
3475
  device.activeVideoMinFrameDuration = frameDuration
3471
3476
  device.activeVideoMaxFrameDuration = frameDuration
3472
3477
  device.unlockForConfiguration()
3478
+ self.applyConfiguredCaptureResolutionToPhotoOutputIfNeeded()
3473
3479
  self.configuredVideoFrameRate = frameRate
3474
3480
  } catch {
3475
3481
  throw CameraControllerError.invalidOperation
@@ -0,0 +1,58 @@
1
+ import CoreLocation
2
+ import Foundation
3
+
4
+ /// GPS EXIF helpers for still capture (heading / image direction).
5
+ enum CaptureExifGps {
6
+ struct ImageDirection: Equatable {
7
+ let degrees: Double
8
+ /// `T` (true north) or `M` (magnetic north).
9
+ let reference: String
10
+ }
11
+
12
+ static func imageDirection(
13
+ trueHeading: Double,
14
+ magneticHeading: Double,
15
+ headingAccuracy: Double
16
+ ) -> ImageDirection? {
17
+ guard headingAccuracy >= 0 else { return nil }
18
+ if trueHeading >= 0 {
19
+ return ImageDirection(degrees: trueHeading, reference: "T")
20
+ }
21
+ return ImageDirection(degrees: magneticHeading, reference: "M")
22
+ }
23
+
24
+ static func imageDirection(from heading: CLHeading) -> ImageDirection? {
25
+ imageDirection(
26
+ trueHeading: heading.trueHeading,
27
+ magneticHeading: heading.magneticHeading,
28
+ headingAccuracy: heading.headingAccuracy
29
+ )
30
+ }
31
+ }
32
+
33
+ /// Reads the latest compass heading from the main queue (where `CLLocationManager` delivers updates).
34
+ enum CaptureExifHeadingReader {
35
+ static func readCurrentHeading(_ provider: @escaping () -> CLHeading?) -> CLHeading? {
36
+ if Thread.isMainThread {
37
+ return provider()
38
+ }
39
+ return DispatchQueue.main.sync { provider() }
40
+ }
41
+ }
42
+
43
+ /// Heading storage rules shared by `getCurrentLocation` and capture cleanup.
44
+ enum CaptureExifHeadingLifecycle {
45
+ enum Event {
46
+ case locationRefreshStarted
47
+ case captureExifFinished
48
+ }
49
+
50
+ static func heading(after event: Event, current: CLHeading?) -> CLHeading? {
51
+ switch event {
52
+ case .locationRefreshStarted:
53
+ return current
54
+ case .captureExifFinished:
55
+ return nil
56
+ }
57
+ }
58
+ }
@@ -52,18 +52,9 @@ enum CaptureImageExifEncoder {
52
52
  kCGImagePropertyGPSAltitudeRef as String: location.altitude >= 0 ? 0 : 1
53
53
  ]
54
54
 
55
- if let heading {
56
- let directionDegrees: Double
57
- let directionRef: String
58
- if heading.trueHeading >= 0 {
59
- directionDegrees = heading.trueHeading
60
- directionRef = "T"
61
- } else {
62
- directionDegrees = heading.magneticHeading
63
- directionRef = "M"
64
- }
65
- gpsDict[kCGImagePropertyGPSImgDirection as String] = directionDegrees
66
- gpsDict[kCGImagePropertyGPSImgDirectionRef as String] = directionRef
55
+ if let direction = heading.flatMap(CaptureExifGps.imageDirection) {
56
+ gpsDict[kCGImagePropertyGPSImgDirection as String] = direction.degrees
57
+ gpsDict[kCGImagePropertyGPSImgDirectionRef as String] = direction.reference
67
58
  }
68
59
 
69
60
  finalProperties[kCGImagePropertyGPSDictionary as String] = gpsDict
@@ -78,13 +78,17 @@ enum CaptureResolutionSupport {
78
78
  Int64(dimensions.width) * Int64(dimensions.height)
79
79
  }
80
80
 
81
- /// Picks a supported `maxPhotoDimensions` value at or below the configured cap.
81
+ /// Picks a value from `supportedMaxPhotoDimensions` at or below the configured cap when possible.
82
+ /// When no supported size fits under the cap (for example a single full-sensor entry), returns the
83
+ /// smallest supported size by long edge, matching Android `filterCaptureResolutionCandidates`.
84
+ /// Returns `nil` when `supportedDimensions` is empty so callers never assign an unsupported value.
82
85
  static func photoMaxDimensions(
83
86
  configuredWidth: Int,
84
87
  configuredHeight: Int,
85
- supportedDimensions: [CMVideoDimensions],
86
- deviceMax: CMVideoDimensions
87
- ) -> CMVideoDimensions {
88
+ supportedDimensions: [CMVideoDimensions]
89
+ ) -> CMVideoDimensions? {
90
+ guard !supportedDimensions.isEmpty else { return nil }
91
+
88
92
  let normalized = normalizedCaptureTargetResolution(configuredWidth: configuredWidth, configuredHeight: configuredHeight)
89
93
  let targetLong = Int32(normalized.width)
90
94
  let targetShort = Int32(normalized.height)
@@ -97,24 +101,20 @@ enum CaptureResolutionSupport {
97
101
  return bestFit
98
102
  }
99
103
 
100
- return clampPhotoDimensions(
101
- width: targetLong,
102
- height: targetShort,
103
- deviceMax: deviceMax
104
- )
104
+ return smallestSupportedPhotoDimension(supportedDimensions)
105
105
  }
106
106
 
107
- static func clampPhotoDimensions(width: Int32, height: Int32, deviceMax: CMVideoDimensions) -> CMVideoDimensions {
108
- var clampedWidth = width
109
- var clampedHeight = height
110
- let deviceWidth = deviceMax.width
111
- let deviceHeight = deviceMax.height
112
- if clampedWidth > deviceWidth || clampedHeight > deviceHeight {
113
- let scale = min(Double(deviceWidth) / Double(clampedWidth), Double(deviceHeight) / Double(clampedHeight))
114
- clampedWidth = max(1, Int32((Double(clampedWidth) * scale).rounded(.down)))
115
- clampedHeight = max(1, Int32((Double(clampedHeight) * scale).rounded(.down)))
116
- }
117
- return CMVideoDimensions(width: clampedWidth, height: clampedHeight)
107
+ static func smallestSupportedPhotoDimension(_ supportedDimensions: [CMVideoDimensions]) -> CMVideoDimensions? {
108
+ guard !supportedDimensions.isEmpty else { return nil }
109
+ return supportedDimensions.min(by: { longEdge($0) < longEdge($1) })
110
+ }
111
+
112
+ static func dimensionsEqual(_ lhs: CMVideoDimensions, _ rhs: CMVideoDimensions) -> Bool {
113
+ lhs.width == rhs.width && lhs.height == rhs.height
114
+ }
115
+
116
+ static func isSupportedPhotoDimension(_ dimension: CMVideoDimensions, in supportedDimensions: [CMVideoDimensions]) -> Bool {
117
+ supportedDimensions.contains { dimensionsEqual($0, dimension) }
118
118
  }
119
119
 
120
120
  static func shouldEnableHighResolutionPhoto(
@@ -35,7 +35,7 @@ extension UIWindow {
35
35
  */
36
36
  @objc(CameraPreview)
37
37
  public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelegate {
38
- private let pluginVersion: String = "8.13.0"
38
+ private let pluginVersion: String = "8.13.2"
39
39
  public let identifier = "CameraPreviewPlugin"
40
40
  public let jsName = "CameraPreview"
41
41
  public let pluginMethods: [CAPPluginMethod] = [
@@ -1392,7 +1392,6 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
1392
1392
  let capturedFromFrontCamera = self.cameraController.currentCameraPosition == .front
1393
1393
  let gpsForThisCapture = (withExifLocation ?? false) ? self.currentLocation : nil
1394
1394
  let locationForExif = (withExifLocation ?? false) ? self.currentLocation : nil
1395
- let headingForExif = (withExifLocation ?? false) ? self.currentHeading : nil
1396
1395
  let storeToFile = self.storeToFile
1397
1396
  self.cameraController.captureImage(width: width, height: height, quality: quality, gpsLocation: gpsForThisCapture, embedTimestamp: embedTimestamp, embedLocation: effectiveEmbedLocation, photoQualityPrioritization: photoQualityPrioritization, captureOrientationMode: captureOrientation) { (image, originalPhotoData, _, error) in
1398
1397
  print("[CameraPreview] captureImage callback received")
@@ -1402,7 +1401,10 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
1402
1401
  if withExifLocation ?? false {
1403
1402
  DispatchQueue.main.async {
1404
1403
  self.locationManager?.stopUpdatingHeading()
1405
- self.currentHeading = nil
1404
+ self.currentHeading = CaptureExifHeadingLifecycle.heading(
1405
+ after: .captureExifFinished,
1406
+ current: self.currentHeading
1407
+ )
1406
1408
  }
1407
1409
  }
1408
1410
  }
@@ -1425,6 +1427,13 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
1425
1427
  imageToEncode = capturedImage
1426
1428
  }
1427
1429
 
1430
+ let headingForExif: CLHeading?
1431
+ if withExifLocation ?? false {
1432
+ headingForExif = CaptureExifHeadingReader.readCurrentHeading { self.currentHeading }
1433
+ } else {
1434
+ headingForExif = nil
1435
+ }
1436
+
1428
1437
  guard let imageDataWithExif = CaptureImageExifEncoder.createImageData(
1429
1438
  from: imageToEncode,
1430
1439
  quality: Int(quality),
@@ -2105,7 +2114,10 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
2105
2114
 
2106
2115
  private func getCurrentLocation(completion: @escaping (CLLocation?) -> Void) {
2107
2116
  print("[CameraPreview] getCurrentLocation called")
2108
- self.currentHeading = nil
2117
+ self.currentHeading = CaptureExifHeadingLifecycle.heading(
2118
+ after: .locationRefreshStarted,
2119
+ current: self.currentHeading
2120
+ )
2109
2121
  self.locationCompletion = completion
2110
2122
  self.locationManager?.startUpdatingLocation()
2111
2123
  print("[CameraPreview] Started updating location")
@@ -0,0 +1,95 @@
1
+ import CoreLocation
2
+ import XCTest
3
+ @testable import CapgoCameraPreview
4
+
5
+ private final class TestCLHeading: CLHeading {
6
+ private let storedTrue: CLLocationDirection
7
+ private let storedMagnetic: CLLocationDirection
8
+ private let storedAccuracy: CLLocationAccuracy
9
+
10
+ init(
11
+ trueHeading: CLLocationDirection,
12
+ magneticHeading: CLLocationDirection,
13
+ headingAccuracy: CLLocationAccuracy
14
+ ) {
15
+ self.storedTrue = trueHeading
16
+ self.storedMagnetic = magneticHeading
17
+ self.storedAccuracy = headingAccuracy
18
+ super.init()
19
+ }
20
+
21
+ @available(*, unavailable)
22
+ required init?(coder: NSCoder) {
23
+ fatalError("init(coder:) has not been implemented")
24
+ }
25
+
26
+ override var trueHeading: CLLocationDirection { storedTrue }
27
+ override var magneticHeading: CLLocationDirection { storedMagnetic }
28
+ override var headingAccuracy: CLLocationAccuracy { storedAccuracy }
29
+ }
30
+
31
+ final class CaptureExifGpsTests: XCTestCase {
32
+ func testImageDirectionUsesTrueHeadingWhenAvailable() {
33
+ let direction = CaptureExifGps.imageDirection(
34
+ trueHeading: 175.4,
35
+ magneticHeading: 180.0,
36
+ headingAccuracy: 5
37
+ )
38
+ XCTAssertEqual(direction?.degrees, 175.4)
39
+ XCTAssertEqual(direction?.reference, "T")
40
+ }
41
+
42
+ func testImageDirectionFallsBackToMagneticWhenTrueHeadingInvalid() {
43
+ let direction = CaptureExifGps.imageDirection(
44
+ trueHeading: -1,
45
+ magneticHeading: 182.5,
46
+ headingAccuracy: 5
47
+ )
48
+ XCTAssertEqual(direction?.degrees, 182.5)
49
+ XCTAssertEqual(direction?.reference, "M")
50
+ }
51
+
52
+ func testImageDirectionNilWhenAccuracyInvalid() {
53
+ XCTAssertNil(
54
+ CaptureExifGps.imageDirection(
55
+ trueHeading: 90,
56
+ magneticHeading: 90,
57
+ headingAccuracy: -1
58
+ )
59
+ )
60
+ }
61
+
62
+ func testHeadingReaderReturnsProviderValueOnMainThread() {
63
+ let expected = TestCLHeading(trueHeading: 10, magneticHeading: 11, headingAccuracy: 3)
64
+ let read = CaptureExifHeadingReader.readCurrentHeading { expected }
65
+ XCTAssertTrue(read === expected)
66
+ }
67
+
68
+ func testHeadingReaderFetchesFromMainWhenOffMainThread() {
69
+ let expected = TestCLHeading(trueHeading: 42, magneticHeading: 44, headingAccuracy: 2)
70
+ let expectation = expectation(description: "read on main")
71
+ DispatchQueue.global(qos: .userInitiated).async {
72
+ let read = CaptureExifHeadingReader.readCurrentHeading {
73
+ XCTAssertTrue(Thread.isMainThread)
74
+ return expected
75
+ }
76
+ XCTAssertTrue(read === expected)
77
+ expectation.fulfill()
78
+ }
79
+ wait(for: [expectation], timeout: 5)
80
+ }
81
+
82
+ func testHeadingFallbackAfterLocationRefresh() {
83
+ let prior = TestCLHeading(trueHeading: 88.0, magneticHeading: 90.0, headingAccuracy: 4)
84
+ let afterRefresh = CaptureExifHeadingLifecycle.heading(after: .locationRefreshStarted, current: prior)
85
+ XCTAssertTrue(afterRefresh === prior)
86
+ let direction = afterRefresh.flatMap(CaptureExifGps.imageDirection)
87
+ XCTAssertEqual(direction?.degrees, 88.0)
88
+ XCTAssertEqual(direction?.reference, "T")
89
+ }
90
+
91
+ func testCaptureExifFinishedClearsHeading() {
92
+ let prior = TestCLHeading(trueHeading: 88.0, magneticHeading: 90.0, headingAccuracy: 4)
93
+ XCTAssertNil(CaptureExifHeadingLifecycle.heading(after: .captureExifFinished, current: prior))
94
+ }
95
+ }
@@ -46,7 +46,6 @@ final class CaptureResolutionSupportTests: XCTestCase {
46
46
  }
47
47
 
48
48
  func testPhotoMaxDimensionsSelectsSupportedValueWithinCap() {
49
- let deviceMax = CMVideoDimensions(width: 4032, height: 3024)
50
49
  let supported = [
51
50
  CMVideoDimensions(width: 4032, height: 3024),
52
51
  CMVideoDimensions(width: 1920, height: 1080),
@@ -55,15 +54,13 @@ final class CaptureResolutionSupportTests: XCTestCase {
55
54
  let dimensions = CaptureResolutionSupport.photoMaxDimensions(
56
55
  configuredWidth: 1080,
57
56
  configuredHeight: 1920,
58
- supportedDimensions: supported,
59
- deviceMax: deviceMax
57
+ supportedDimensions: supported
60
58
  )
61
- XCTAssertEqual(dimensions.width, 1920)
62
- XCTAssertEqual(dimensions.height, 1080)
59
+ XCTAssertEqual(dimensions?.width, 1920)
60
+ XCTAssertEqual(dimensions?.height, 1080)
63
61
  }
64
62
 
65
- func testPhotoMaxDimensionsClampsToConfiguredCapWhenNoSupportedSizeFits() {
66
- let deviceMax = CMVideoDimensions(width: 4032, height: 3024)
63
+ func testPhotoMaxDimensionsFallsBackToSmallestSupportedWhenNoSizeFitsUnderCap() {
67
64
  let supported = [
68
65
  CMVideoDimensions(width: 4032, height: 3024),
69
66
  CMVideoDimensions(width: 1920, height: 1080)
@@ -71,11 +68,68 @@ final class CaptureResolutionSupportTests: XCTestCase {
71
68
  let dimensions = CaptureResolutionSupport.photoMaxDimensions(
72
69
  configuredWidth: 640,
73
70
  configuredHeight: 480,
74
- supportedDimensions: supported,
75
- deviceMax: deviceMax
71
+ supportedDimensions: supported
76
72
  )
77
- XCTAssertEqual(dimensions.width, 640)
78
- XCTAssertEqual(dimensions.height, 480)
73
+ XCTAssertEqual(dimensions?.width, 1920)
74
+ XCTAssertEqual(dimensions?.height, 1080)
75
+ }
76
+
77
+ func testPhotoMaxDimensionsSingleSupportedEntryLargerThanTarget() {
78
+ let fullSensor = CMVideoDimensions(width: 4032, height: 3024)
79
+ let dimensions = CaptureResolutionSupport.photoMaxDimensions(
80
+ configuredWidth: 1600,
81
+ configuredHeight: 1200,
82
+ supportedDimensions: [fullSensor]
83
+ )
84
+ XCTAssertEqual(dimensions?.width, 4032)
85
+ XCTAssertEqual(dimensions?.height, 3024)
86
+ XCTAssertTrue(CaptureResolutionSupport.isSupportedPhotoDimension(dimensions!, in: [fullSensor]))
87
+ }
88
+
89
+ func testPhotoMaxDimensionsSingleSupportedEntrySmallerThanTarget() {
90
+ let small = CMVideoDimensions(width: 1280, height: 720)
91
+ let dimensions = CaptureResolutionSupport.photoMaxDimensions(
92
+ configuredWidth: 1920,
93
+ configuredHeight: 1080,
94
+ supportedDimensions: [small]
95
+ )
96
+ XCTAssertEqual(dimensions?.width, 1280)
97
+ XCTAssertEqual(dimensions?.height, 720)
98
+ }
99
+
100
+ func testPhotoMaxDimensionsExactMatch() {
101
+ let exact = CMVideoDimensions(width: 1600, height: 1200)
102
+ let supported = [
103
+ CMVideoDimensions(width: 4032, height: 3024),
104
+ exact,
105
+ CMVideoDimensions(width: 1280, height: 720)
106
+ ]
107
+ let dimensions = CaptureResolutionSupport.photoMaxDimensions(
108
+ configuredWidth: 1200,
109
+ configuredHeight: 1600,
110
+ supportedDimensions: supported
111
+ )
112
+ XCTAssertTrue(CaptureResolutionSupport.dimensionsEqual(dimensions!, exact))
113
+ }
114
+
115
+ func testPhotoMaxDimensionsEmptySupportedListReturnsNil() {
116
+ let dimensions = CaptureResolutionSupport.photoMaxDimensions(
117
+ configuredWidth: 1920,
118
+ configuredHeight: 1080,
119
+ supportedDimensions: []
120
+ )
121
+ XCTAssertNil(dimensions)
122
+ }
123
+
124
+ func testPhotoMaxDimensionsReproIssue472OnlyFullSensorListed() {
125
+ let fullSensor = CMVideoDimensions(width: 4032, height: 3024)
126
+ let dimensions = CaptureResolutionSupport.photoMaxDimensions(
127
+ configuredWidth: 1600,
128
+ configuredHeight: 1200,
129
+ supportedDimensions: [fullSensor]
130
+ )
131
+ XCTAssertNotNil(dimensions)
132
+ XCTAssertTrue(CaptureResolutionSupport.isSupportedPhotoDimension(dimensions!, in: [fullSensor]))
79
133
  }
80
134
 
81
135
  func testParseCaptureResolutionRejectsInt32Overflow() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/camera-preview",
3
- "version": "8.13.0",
3
+ "version": "8.13.2",
4
4
  "description": "Camera preview",
5
5
  "license": "MPL-2.0",
6
6
  "repository": {