@capgo/camera-preview 7.4.0-beta.10 → 7.4.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,31 +4,32 @@ package com.ahm.capacitor.camera.preview.model;
4
4
  * Represents zoom factor information for a camera with current lens details.
5
5
  */
6
6
  public class ZoomFactors {
7
- private final float min;
8
- private final float max;
9
- private final float current;
10
- private final LensInfo lens;
11
7
 
12
- public ZoomFactors(float min, float max, float current, LensInfo lens) {
13
- this.min = min;
14
- this.max = max;
15
- this.current = current;
16
- this.lens = lens;
17
- }
8
+ private final float min;
9
+ private final float max;
10
+ private final float current;
11
+ private final LensInfo lens;
18
12
 
19
- public float getMin() {
20
- return min;
21
- }
13
+ public ZoomFactors(float min, float max, float current, LensInfo lens) {
14
+ this.min = min;
15
+ this.max = max;
16
+ this.current = current;
17
+ this.lens = lens;
18
+ }
22
19
 
23
- public float getMax() {
24
- return max;
25
- }
20
+ public float getMin() {
21
+ return min;
22
+ }
26
23
 
27
- public float getCurrent() {
28
- return current;
29
- }
24
+ public float getMax() {
25
+ return max;
26
+ }
30
27
 
31
- public LensInfo getLens() {
32
- return lens;
33
- }
34
- }
28
+ public float getCurrent() {
29
+ return current;
30
+ }
31
+
32
+ public LensInfo getLens() {
33
+ return lens;
34
+ }
35
+ }
package/dist/docs.json CHANGED
@@ -141,7 +141,7 @@
141
141
  },
142
142
  {
143
143
  "name": "setAspectRatio",
144
- "signature": "(options: { aspectRatio: '4:3' | '16:9'; x?: number; y?: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>",
144
+ "signature": "(options: { aspectRatio: \"4:3\" | \"16:9\"; x?: number; y?: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>",
145
145
  "parameters": [
146
146
  {
147
147
  "name": "options",
@@ -170,7 +170,7 @@
170
170
  },
171
171
  {
172
172
  "name": "getAspectRatio",
173
- "signature": "() => Promise<{ aspectRatio: '4:3' | '16:9'; }>",
173
+ "signature": "() => Promise<{ aspectRatio: \"4:3\" | \"16:9\"; }>",
174
174
  "parameters": [],
175
175
  "returns": "Promise<{ aspectRatio: '4:3' | '16:9'; }>",
176
176
  "tags": [
@@ -716,7 +716,7 @@
716
716
  ],
717
717
  "docs": "The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\nCannot be set if width or height is provided, otherwise the call will be rejected.\nUse setPreviewSize to adjust size after starting.",
718
718
  "complexTypes": [],
719
- "type": "'4:3' | '16:9' | 'fill' | undefined"
719
+ "type": "'4:3' | '16:9' | undefined"
720
720
  },
721
721
  {
722
722
  "name": "gridMode",
@@ -100,7 +100,7 @@ export interface CameraPreviewOptions {
100
100
  *
101
101
  * @since 2.0.0
102
102
  */
103
- aspectRatio?: '4:3' | '16:9' | 'fill';
103
+ aspectRatio?: "4:3" | "16:9";
104
104
  /**
105
105
  * The grid overlay to display on the camera preview.
106
106
  * @default "none"
@@ -335,7 +335,7 @@ export interface CameraPreviewPlugin {
335
335
  * @since 7.4.0
336
336
  */
337
337
  setAspectRatio(options: {
338
- aspectRatio: '4:3' | '16:9';
338
+ aspectRatio: "4:3" | "16:9";
339
339
  x?: number;
340
340
  y?: number;
341
341
  }): Promise<{
@@ -351,7 +351,7 @@ export interface CameraPreviewPlugin {
351
351
  * @since 7.4.0
352
352
  */
353
353
  getAspectRatio(): Promise<{
354
- aspectRatio: '4:3' | '16:9';
354
+ aspectRatio: "4:3" | "16:9";
355
355
  }>;
356
356
  /**
357
357
  * Sets the grid mode of the camera preview overlay.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAMA,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":["export type CameraPosition = \"rear\" | \"front\";\n\nexport type FlashMode = CameraPreviewFlashMode;\n\nexport type GridMode = \"none\" | \"3x3\" | \"4x4\";\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\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?: '4:3' | '16:9' | 'fill';\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 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, enables high-resolution image capture.\n * @platform ios\n * @default false\n */\n enableHighResolution?: 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 * If true, enables pinch-to-zoom functionality on the preview.\n * @platform android\n * @default false\n */\n enableZoom?: boolean;\n /**\n * If true, uses the video-optimized preset for the camera session.\n * @platform ios\n * @default false\n */\n enableVideoMode?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /** The desired height of the picture in pixels. If not provided, the device default is used. */\n height?: number;\n /** The desired width of the picture in pixels. If not provided, the device default is used. */\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\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\n/**\n * The available flash modes for the camera.\n * 'torch' is a continuous light mode.\n */\nexport type CameraPreviewFlashMode =\n | \"off\"\n | \"on\"\n | \"auto\"\n | \"torch\";\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 * 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 * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * @param {CameraPreviewPictureOptions} options - The options for capturing the picture.\n * @returns {Promise<{ value: string }>} A promise that resolves with the captured image data.\n * The `value` is a base64 encoded string unless `storeToFile` is true, in which case it's a file path.\n * @since 0.0.1\n */\n capture(\n options: CameraPreviewPictureOptions\n ): 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 * 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: '4:3' | '16:9'; x?: number; y?: number }} options - The desired aspect ratio and optional position.\n * - aspectRatio: The desired aspect ratio ('4:3' or '16:9')\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.4.0\n */\n setAspectRatio(options: { aspectRatio: '4:3' | '16:9'; 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: '4:3' | '16:9' }>} A promise that resolves with the current aspect ratio.\n * @since 7.4.0\n */\n getAspectRatio(): Promise<{ aspectRatio: '4:3' | '16:9' }>;\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 * 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: {\n flashMode: CameraPreviewFlashMode | string;\n }): 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<{ videoFilePath: string }>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<{ videoFilePath: string }>;\n\n /**\n * Starts recording a video.\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 * 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.4.0\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.4.0\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.4.0\n */\n getZoom(): Promise<{\n min: number;\n max: number;\n current: number;\n lens: LensInfo;\n }>;\n\n /**\n * Sets the camera's zoom level.\n *\n * @param {{ level: number; ramp?: boolean }} options - The desired zoom level. `ramp` is currently unused.\n * @returns {Promise<void>} A promise that resolves when the zoom level is set.\n * @since 7.4.0\n */\n setZoom(options: { level: number; ramp?: 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.4.0\n */\n getFlashMode(): Promise<{ flashMode: FlashMode }>;\n\n /**\n * Removes all registered listeners.\n *\n * @since 7.4.0\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.4.0\n */\n setDeviceId(options: { deviceId: string }): Promise<void>;\n\n /**\n * Gets the ID of the currently active camera device.\n *\n * @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.\n * @since 7.4.0\n */\n getDeviceId(): Promise<{ deviceId: string }>;\n\n /**\n * Gets the current preview size and position.\n * @returns {Promise<{x: number, y: number, width: number, height: number}>}\n */\n getPreviewSize(): Promise<{x: number, y: number, width: number, height: number}>;\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 actual preview dimensions and position.\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"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAMA,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":["export type CameraPosition = \"rear\" | \"front\";\n\nexport type FlashMode = CameraPreviewFlashMode;\n\nexport type GridMode = \"none\" | \"3x3\" | \"4x4\";\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\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?: \"4:3\" | \"16:9\";\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 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, enables high-resolution image capture.\n * @platform ios\n * @default false\n */\n enableHighResolution?: 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 * If true, enables pinch-to-zoom functionality on the preview.\n * @platform android\n * @default false\n */\n enableZoom?: boolean;\n /**\n * If true, uses the video-optimized preset for the camera session.\n * @platform ios\n * @default false\n */\n enableVideoMode?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /** The desired height of the picture in pixels. If not provided, the device default is used. */\n height?: number;\n /** The desired width of the picture in pixels. If not provided, the device default is used. */\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\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\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/**\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 * 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 * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * @param {CameraPreviewPictureOptions} options - The options for capturing the picture.\n * @returns {Promise<{ value: string }>} A promise that resolves with the captured image data.\n * The `value` is a base64 encoded string unless `storeToFile` is true, in which case it's a file path.\n * @since 0.0.1\n */\n capture(\n options: CameraPreviewPictureOptions,\n ): 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 * 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: '4:3' | '16:9'; x?: number; y?: number }} options - The desired aspect ratio and optional position.\n * - aspectRatio: The desired aspect ratio ('4:3' or '16:9')\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.4.0\n */\n setAspectRatio(options: {\n aspectRatio: \"4:3\" | \"16:9\";\n x?: number;\n y?: number;\n }): 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: '4:3' | '16:9' }>} A promise that resolves with the current aspect ratio.\n * @since 7.4.0\n */\n getAspectRatio(): Promise<{ aspectRatio: \"4:3\" | \"16:9\" }>;\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 * 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: {\n flashMode: CameraPreviewFlashMode | string;\n }): 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<{ videoFilePath: string }>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<{ videoFilePath: string }>;\n\n /**\n * Starts recording a video.\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 * 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.4.0\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.4.0\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.4.0\n */\n getZoom(): Promise<{\n min: number;\n max: number;\n current: number;\n lens: LensInfo;\n }>;\n\n /**\n * Sets the camera's zoom level.\n *\n * @param {{ level: number; ramp?: boolean }} options - The desired zoom level. `ramp` is currently unused.\n * @returns {Promise<void>} A promise that resolves when the zoom level is set.\n * @since 7.4.0\n */\n setZoom(options: { level: number; ramp?: 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.4.0\n */\n getFlashMode(): Promise<{ flashMode: FlashMode }>;\n\n /**\n * Removes all registered listeners.\n *\n * @since 7.4.0\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.4.0\n */\n setDeviceId(options: { deviceId: string }): Promise<void>;\n\n /**\n * Gets the ID of the currently active camera device.\n *\n * @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.\n * @since 7.4.0\n */\n getDeviceId(): Promise<{ deviceId: string }>;\n\n /**\n * Gets the current preview size and position.\n * @returns {Promise<{x: number, y: number, width: number, height: number}>}\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 actual preview dimensions and position.\n */\n setPreviewSize(options: {\n x: number;\n y: number;\n width: number;\n height: number;\n }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -60,10 +60,10 @@ export declare class CameraPreviewWeb extends WebPlugin implements CameraPreview
60
60
  deviceId: string;
61
61
  }): Promise<void>;
62
62
  getAspectRatio(): Promise<{
63
- aspectRatio: '4:3' | '16:9';
63
+ aspectRatio: "4:3" | "16:9";
64
64
  }>;
65
65
  setAspectRatio(options: {
66
- aspectRatio: '4:3' | '16:9';
66
+ aspectRatio: "4:3" | "16:9";
67
67
  x?: number;
68
68
  y?: number;
69
69
  }): Promise<{
package/dist/esm/web.js CHANGED
@@ -34,7 +34,9 @@ export class CameraPreviewWeb extends WebPlugin {
34
34
  if (video) {
35
35
  video.remove();
36
36
  }
37
- const container = options.parent ? document.getElementById(options.parent) : document.body;
37
+ const container = options.parent
38
+ ? document.getElementById(options.parent)
39
+ : document.body;
38
40
  if (!container) {
39
41
  throw new Error("container not found");
40
42
  }
@@ -67,7 +69,9 @@ export class CameraPreviewWeb extends WebPlugin {
67
69
  this.videoElement.style.top = `${options.y}px`;
68
70
  }
69
71
  if (options.aspectRatio) {
70
- const [widthRatio, heightRatio] = options.aspectRatio.split(':').map(Number);
72
+ const [widthRatio, heightRatio] = options.aspectRatio
73
+ .split(":")
74
+ .map(Number);
71
75
  const ratio = widthRatio / heightRatio;
72
76
  if (options.width) {
73
77
  this.videoElement.height = options.width / ratio;
@@ -77,7 +81,7 @@ export class CameraPreviewWeb extends WebPlugin {
77
81
  }
78
82
  }
79
83
  else {
80
- this.videoElement.style.objectFit = 'cover';
84
+ this.videoElement.style.objectFit = "cover";
81
85
  }
82
86
  const constraints = {
83
87
  video: {
@@ -241,7 +245,7 @@ export class CameraPreviewWeb extends WebPlugin {
241
245
  throw new Error("getAvailableDevices not supported under the web platform");
242
246
  }
243
247
  const devices = await navigator.mediaDevices.enumerateDevices();
244
- const videoDevices = devices.filter(device => device.kind === 'videoinput');
248
+ const videoDevices = devices.filter((device) => device.kind === "videoinput");
245
249
  // Group devices by position (front/back)
246
250
  const frontDevices = [];
247
251
  const backDevices = [];
@@ -251,15 +255,19 @@ export class CameraPreviewWeb extends WebPlugin {
251
255
  // Determine device type based on label
252
256
  let deviceType = DeviceType.WIDE_ANGLE;
253
257
  let baseZoomRatio = 1.0;
254
- if (labelLower.includes('ultra') || labelLower.includes('0.5')) {
258
+ if (labelLower.includes("ultra") || labelLower.includes("0.5")) {
255
259
  deviceType = DeviceType.ULTRA_WIDE;
256
260
  baseZoomRatio = 0.5;
257
261
  }
258
- else if (labelLower.includes('telephoto') || labelLower.includes('tele') || labelLower.includes('2x') || labelLower.includes('3x')) {
262
+ else if (labelLower.includes("telephoto") ||
263
+ labelLower.includes("tele") ||
264
+ labelLower.includes("2x") ||
265
+ labelLower.includes("3x")) {
259
266
  deviceType = DeviceType.TELEPHOTO;
260
267
  baseZoomRatio = 2.0;
261
268
  }
262
- else if (labelLower.includes('depth') || labelLower.includes('truedepth')) {
269
+ else if (labelLower.includes("depth") ||
270
+ labelLower.includes("truedepth")) {
263
271
  deviceType = DeviceType.TRUE_DEPTH;
264
272
  baseZoomRatio = 1.0;
265
273
  }
@@ -270,10 +278,10 @@ export class CameraPreviewWeb extends WebPlugin {
270
278
  focalLength: 4.25,
271
279
  baseZoomRatio,
272
280
  minZoom: 1.0,
273
- maxZoom: 1.0
281
+ maxZoom: 1.0,
274
282
  };
275
283
  // Determine position and add to appropriate array
276
- if (labelLower.includes('back') || labelLower.includes('rear')) {
284
+ if (labelLower.includes("back") || labelLower.includes("rear")) {
277
285
  backDevices.push(lensInfo);
278
286
  }
279
287
  else {
@@ -288,8 +296,8 @@ export class CameraPreviewWeb extends WebPlugin {
288
296
  position: "front",
289
297
  lenses: frontDevices,
290
298
  isLogical: false,
291
- minZoom: Math.min(...frontDevices.map(d => d.minZoom)),
292
- maxZoom: Math.max(...frontDevices.map(d => d.maxZoom))
299
+ minZoom: Math.min(...frontDevices.map((d) => d.minZoom)),
300
+ maxZoom: Math.max(...frontDevices.map((d) => d.maxZoom)),
293
301
  });
294
302
  }
295
303
  if (backDevices.length > 0) {
@@ -299,8 +307,8 @@ export class CameraPreviewWeb extends WebPlugin {
299
307
  position: "rear",
300
308
  lenses: backDevices,
301
309
  isLogical: false,
302
- minZoom: Math.min(...backDevices.map(d => d.minZoom)),
303
- maxZoom: Math.max(...backDevices.map(d => d.maxZoom))
310
+ minZoom: Math.min(...backDevices.map((d) => d.minZoom)),
311
+ maxZoom: Math.max(...backDevices.map((d) => d.maxZoom)),
304
312
  });
305
313
  }
306
314
  return { devices: result };
@@ -325,18 +333,22 @@ export class CameraPreviewWeb extends WebPlugin {
325
333
  let baseZoomRatio = 1.0;
326
334
  if (this.currentDeviceId) {
327
335
  const devices = await navigator.mediaDevices.enumerateDevices();
328
- const device = devices.find(d => d.deviceId === this.currentDeviceId);
336
+ const device = devices.find((d) => d.deviceId === this.currentDeviceId);
329
337
  if (device) {
330
338
  const labelLower = device.label.toLowerCase();
331
- if (labelLower.includes('ultra') || labelLower.includes('0.5')) {
339
+ if (labelLower.includes("ultra") || labelLower.includes("0.5")) {
332
340
  deviceType = DeviceType.ULTRA_WIDE;
333
341
  baseZoomRatio = 0.5;
334
342
  }
335
- else if (labelLower.includes('telephoto') || labelLower.includes('tele') || labelLower.includes('2x') || labelLower.includes('3x')) {
343
+ else if (labelLower.includes("telephoto") ||
344
+ labelLower.includes("tele") ||
345
+ labelLower.includes("2x") ||
346
+ labelLower.includes("3x")) {
336
347
  deviceType = DeviceType.TELEPHOTO;
337
348
  baseZoomRatio = 2.0;
338
349
  }
339
- else if (labelLower.includes('depth') || labelLower.includes('truedepth')) {
350
+ else if (labelLower.includes("depth") ||
351
+ labelLower.includes("truedepth")) {
340
352
  deviceType = DeviceType.TRUE_DEPTH;
341
353
  baseZoomRatio = 1.0;
342
354
  }
@@ -347,7 +359,7 @@ export class CameraPreviewWeb extends WebPlugin {
347
359
  focalLength: 4.25,
348
360
  deviceType,
349
361
  baseZoomRatio,
350
- digitalZoom: currentZoom / baseZoomRatio
362
+ digitalZoom: currentZoom / baseZoomRatio,
351
363
  };
352
364
  return {
353
365
  min: capabilities.zoom.min || 1,
@@ -373,7 +385,7 @@ export class CameraPreviewWeb extends WebPlugin {
373
385
  const zoomLevel = Math.max(capabilities.zoom.min || 1, Math.min(capabilities.zoom.max || 1, options.level));
374
386
  try {
375
387
  await videoTrack.applyConstraints({
376
- advanced: [{ zoom: zoomLevel }]
388
+ advanced: [{ zoom: zoomLevel }],
377
389
  });
378
390
  }
379
391
  catch (error) {
@@ -406,8 +418,11 @@ export class CameraPreviewWeb extends WebPlugin {
406
418
  try {
407
419
  // Try to determine camera position from device
408
420
  const devices = await navigator.mediaDevices.enumerateDevices();
409
- const device = devices.find(d => d.deviceId === options.deviceId);
410
- this.isBackCamera = (device === null || device === void 0 ? void 0 : device.label.toLowerCase().includes('back')) || (device === null || device === void 0 ? void 0 : device.label.toLowerCase().includes('rear')) || false;
421
+ const device = devices.find((d) => d.deviceId === options.deviceId);
422
+ this.isBackCamera =
423
+ (device === null || device === void 0 ? void 0 : device.label.toLowerCase().includes("back")) ||
424
+ (device === null || device === void 0 ? void 0 : device.label.toLowerCase().includes("rear")) ||
425
+ false;
411
426
  const stream = await navigator.mediaDevices.getUserMedia(constraints);
412
427
  video.srcObject = stream;
413
428
  // Update video transform based on camera
@@ -435,15 +450,15 @@ export class CameraPreviewWeb extends WebPlugin {
435
450
  if (width && height) {
436
451
  const ratio = width / height;
437
452
  // Check for portrait camera ratios: 4:3 -> 3:4, 16:9 -> 9:16
438
- if (Math.abs(ratio - (3 / 4)) < 0.01) {
439
- return { aspectRatio: '4:3' };
453
+ if (Math.abs(ratio - 3 / 4) < 0.01) {
454
+ return { aspectRatio: "4:3" };
440
455
  }
441
- if (Math.abs(ratio - (9 / 16)) < 0.01) {
442
- return { aspectRatio: '16:9' };
456
+ if (Math.abs(ratio - 9 / 16) < 0.01) {
457
+ return { aspectRatio: "16:9" };
443
458
  }
444
459
  }
445
460
  // Default to 4:3 if no specific aspect ratio is matched
446
- return { aspectRatio: '4:3' };
461
+ return { aspectRatio: "4:3" };
447
462
  }
448
463
  async setAspectRatio(options) {
449
464
  const video = document.getElementById(DEFAULT_VIDEO_ID);
@@ -451,7 +466,9 @@ export class CameraPreviewWeb extends WebPlugin {
451
466
  throw new Error("camera is not running");
452
467
  }
453
468
  if (options.aspectRatio) {
454
- const [widthRatio, heightRatio] = options.aspectRatio.split(':').map(Number);
469
+ const [widthRatio, heightRatio] = options.aspectRatio
470
+ .split(":")
471
+ .map(Number);
455
472
  // For camera, use portrait orientation: 4:3 becomes 3:4, 16:9 becomes 9:16
456
473
  const ratio = heightRatio / widthRatio;
457
474
  // Get current position and size
@@ -487,22 +504,22 @@ export class CameraPreviewWeb extends WebPlugin {
487
504
  video.style.height = `${newHeight}px`;
488
505
  video.style.left = `${x}px`;
489
506
  video.style.top = `${y}px`;
490
- video.style.position = 'absolute';
507
+ video.style.position = "absolute";
491
508
  return {
492
509
  width: Math.round(newWidth),
493
510
  height: Math.round(newHeight),
494
511
  x: Math.round(x),
495
- y: Math.round(y)
512
+ y: Math.round(y),
496
513
  };
497
514
  }
498
515
  else {
499
- video.style.objectFit = 'cover';
516
+ video.style.objectFit = "cover";
500
517
  const rect = video.getBoundingClientRect();
501
518
  return {
502
519
  width: Math.round(rect.width),
503
520
  height: Math.round(rect.height),
504
521
  x: Math.round(rect.left),
505
- y: Math.round(rect.top)
522
+ y: Math.round(rect.top),
506
523
  };
507
524
  }
508
525
  }
@@ -554,7 +571,7 @@ export class CameraPreviewWeb extends WebPlugin {
554
571
  }
555
572
  async getGridMode() {
556
573
  // Web implementation - default to none
557
- return { gridMode: 'none' };
574
+ return { gridMode: "none" };
558
575
  }
559
576
  async getPreviewSize() {
560
577
  const video = document.getElementById(DEFAULT_VIDEO_ID);
@@ -565,7 +582,7 @@ export class CameraPreviewWeb extends WebPlugin {
565
582
  x: video.offsetLeft,
566
583
  y: video.offsetTop,
567
584
  width: video.width,
568
- height: video.height
585
+ height: video.height,
569
586
  };
570
587
  }
571
588
  async setPreviewSize(options) {
@@ -581,7 +598,7 @@ export class CameraPreviewWeb extends WebPlugin {
581
598
  width: options.width,
582
599
  height: options.height,
583
600
  x: options.x,
584
- y: options.y
601
+ y: options.y,
585
602
  };
586
603
  }
587
604
  }