@capgo/camera-preview 7.6.1 → 7.7.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAUA,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 { 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 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, 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 /**\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 * 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 * 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\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\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 * 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 =\n | \"portrait\"\n | \"landscape\"\n | \"landscape-left\"\n | \"landscape-right\"\n | \"portrait-upside-down\"\n | \"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 * @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 * 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(\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.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\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. Only iOS.\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.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: {\n level: number;\n ramp?: boolean;\n autoFocus?: boolean;\n }): 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 currently active camera device.\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 preview size and position.\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 actual preview dimensions and position.\n * @since 7.5.0\n * @platform android, ios\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 /**\n * Sets the camera focus to a specific point in the preview.\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: {\n width: number;\n height: number;\n x: number;\n y: number;\n }) => 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 * 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"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAUA,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 { 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 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, 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 /**\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 * 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 * 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\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\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/** Reusable exposure mode type for cross-platform support. */\nexport type ExposureMode = \"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 =\n | \"portrait\"\n | \"landscape\"\n | \"landscape-left\"\n | \"landscape-right\"\n | \"portrait-upside-down\"\n | \"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 * @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 * 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(\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.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\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. Only iOS.\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.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: {\n level: number;\n ramp?: boolean;\n autoFocus?: boolean;\n }): 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 currently active camera device.\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 preview size and position.\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 actual preview dimensions and position.\n * @since 7.5.0\n * @platform android, ios\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 /**\n * Sets the camera focus to a specific point in the preview.\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: {\n width: number;\n height: number;\n x: number;\n y: number;\n }) => 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 * 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\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\n */\n getExposureCompensation(): Promise<{ value: number }>;\n\n /**\n * Sets the exposure compensation (EV bias). Value will be clamped to range.\n * @platform ios\n */\n setExposureCompensation(options: { value: number }): Promise<void>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
- import type { CameraDevice, CameraOpacityOptions, CameraPreviewFlashMode, CameraPreviewOptions, CameraPreviewPictureOptions, CameraPreviewPlugin, CameraSampleOptions, DeviceOrientation, GridMode, FlashMode, LensInfo, SafeAreaInsets } from "./definitions";
2
+ import type { CameraDevice, CameraOpacityOptions, CameraPreviewFlashMode, CameraPreviewOptions, CameraPreviewPictureOptions, CameraPreviewPlugin, CameraSampleOptions, DeviceOrientation, GridMode, ExposureMode, FlashMode, LensInfo, SafeAreaInsets } from "./definitions";
3
3
  export declare class CameraPreviewWeb extends WebPlugin implements CameraPreviewPlugin {
4
4
  /**
5
5
  * track which camera is used based on start options
@@ -111,6 +111,26 @@ export declare class CameraPreviewWeb extends WebPlugin implements CameraPreview
111
111
  x: number;
112
112
  y: number;
113
113
  }): Promise<void>;
114
+ getExposureModes(): Promise<{
115
+ modes: ExposureMode[];
116
+ }>;
117
+ getExposureMode(): Promise<{
118
+ mode: ExposureMode;
119
+ }>;
120
+ setExposureMode(_options: {
121
+ mode: ExposureMode;
122
+ }): Promise<void>;
123
+ getExposureCompensationRange(): Promise<{
124
+ min: number;
125
+ max: number;
126
+ step: number;
127
+ }>;
128
+ getExposureCompensation(): Promise<{
129
+ value: number;
130
+ }>;
131
+ setExposureCompensation(_options: {
132
+ value: number;
133
+ }): Promise<void>;
114
134
  deleteFile(_options: {
115
135
  path: string;
116
136
  }): Promise<{
package/dist/esm/web.js CHANGED
@@ -970,6 +970,25 @@ export class CameraPreviewWeb extends WebPlugin {
970
970
  console.warn("Focus control is not supported on this device. Focus coordinates were provided but cannot be applied.");
971
971
  }
972
972
  }
973
+ // Exposure stubs (unsupported on web)
974
+ async getExposureModes() {
975
+ throw new Error("getExposureModes not supported under the web platform");
976
+ }
977
+ async getExposureMode() {
978
+ throw new Error("getExposureMode not supported under the web platform");
979
+ }
980
+ async setExposureMode(_options) {
981
+ throw new Error("setExposureMode not supported under the web platform");
982
+ }
983
+ async getExposureCompensationRange() {
984
+ throw new Error("getExposureCompensationRange not supported under the web platform");
985
+ }
986
+ async getExposureCompensation() {
987
+ throw new Error("getExposureCompensation not supported under the web platform");
988
+ }
989
+ async setExposureCompensation(_options) {
990
+ throw new Error("setExposureCompensation not supported under the web platform");
991
+ }
973
992
  async deleteFile(_options) {
974
993
  // Mark parameter as intentionally unused to satisfy linter
975
994
  void _options;
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgB5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,gBAAgB,GAAG,aAAa,CAAC;AACvC,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAW7C;QACE,KAAK,EAAE,CAAC;QAX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uGAAuG,CACxG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAA0B;QACzC,2DAA2D;QAC3D,KAAK,QAAQ,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n CameraDevice,\n CameraOpacityOptions,\n CameraPreviewFlashMode,\n CameraPreviewOptions,\n CameraPreviewPictureOptions,\n CameraPreviewPlugin,\n CameraSampleOptions,\n DeviceOrientation,\n GridMode,\n FlashMode,\n LensInfo,\n SafeAreaInsets,\n} from \"./definitions\";\nimport { DeviceType } from \"./definitions\";\n\nconst DEFAULT_VIDEO_ID = \"capgo_video\";\nexport class CameraPreviewWeb extends WebPlugin implements CameraPreviewPlugin {\n /**\n * track which camera is used based on start options\n * used in capture\n */\n private isBackCamera = false;\n private currentDeviceId: string | null = null;\n private videoElement: HTMLVideoElement | null = null;\n private isStarted = false;\n private orientationListenerBound = false;\n\n constructor() {\n super();\n }\n private getCurrentOrientation(): DeviceOrientation {\n try {\n const so: any = (screen as any).orientation;\n const type = so?.type || so?.mozOrientation || so?.msOrientation;\n if (typeof type === \"string\") {\n if (type.includes(\"portrait-primary\")) return \"portrait\";\n if (type.includes(\"portrait-secondary\")) return \"portrait-upside-down\";\n if (type.includes(\"landscape-primary\")) return \"landscape-left\";\n if (type.includes(\"landscape-secondary\")) return \"landscape-right\";\n if (type.includes(\"landscape\")) return \"landscape\";\n if (type.includes(\"portrait\")) return \"portrait\";\n }\n const angle = (window as any).orientation;\n if (typeof angle === \"number\") {\n if (angle === 0) return \"portrait\";\n if (angle === 180) return \"portrait-upside-down\";\n if (angle === 90) return \"landscape-right\";\n if (angle === -90) return \"landscape-left\";\n if (angle === 270) return \"landscape-left\";\n }\n if (window.matchMedia(\"(orientation: portrait)\")?.matches) {\n return \"portrait\";\n }\n if (window.matchMedia(\"(orientation: landscape)\")?.matches) {\n return \"landscape\";\n }\n } catch (e) {\n console.error(e);\n }\n return \"unknown\";\n }\n private ensureOrientationListener() {\n if (this.orientationListenerBound) return;\n const emit = () => {\n this.notifyListeners(\"orientationChange\", {\n orientation: this.getCurrentOrientation(),\n });\n };\n window.addEventListener(\"orientationchange\", emit);\n window.addEventListener(\"resize\", emit);\n this.orientationListenerBound = true;\n }\n async getOrientation(): Promise<{ orientation: DeviceOrientation }> {\n return { orientation: this.getCurrentOrientation() };\n }\n getSafeAreaInsets(): Promise<SafeAreaInsets> {\n throw new Error(\"Method not implemented.\");\n }\n\n async getZoomButtonValues(): Promise<{ values: number[] }> {\n throw new Error(\"getZoomButtonValues not supported under the web platform\");\n }\n\n async getSupportedPictureSizes(): Promise<any> {\n throw new Error(\n \"getSupportedPictureSizes not supported under the web platform\",\n );\n }\n\n async start(\n options: CameraPreviewOptions,\n ): Promise<{ width: number; height: number; x: number; y: number }> {\n if (options.aspectRatio && (options.width || options.height)) {\n throw new Error(\n \"Cannot set both aspectRatio and size (width/height). Use setPreviewSize after start.\",\n );\n }\n if (this.isStarted) {\n throw new Error(\"camera already started\");\n }\n\n this.isBackCamera = true;\n this.isStarted = false;\n const parent = document.getElementById(options?.parent || \"\");\n const gridMode = options?.gridMode || \"none\";\n const positioning = options?.positioning || \"top\";\n\n if (options.position) {\n this.isBackCamera = options.position === \"rear\";\n }\n\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (video) {\n video.remove();\n }\n const container = options.parent\n ? document.getElementById(options.parent)\n : document.body;\n if (!container) {\n throw new Error(\"container not found\");\n }\n this.videoElement = document.createElement(\"video\");\n this.videoElement.id = DEFAULT_VIDEO_ID;\n this.videoElement.className = options.className || \"\";\n this.videoElement.playsInline = true;\n this.videoElement.muted = true;\n this.videoElement.autoplay = true;\n // Remove objectFit as we'll match camera's native aspect ratio\n this.videoElement.style.backgroundColor = \"transparent\";\n // Reset any default margins that might interfere\n this.videoElement.style.margin = \"0\";\n this.videoElement.style.padding = \"0\";\n\n container.appendChild(this.videoElement);\n if (options.toBack) {\n this.videoElement.style.zIndex = \"-1\";\n }\n\n // Default to 4:3 if no aspect ratio or size specified\n const useDefaultAspectRatio =\n !options.aspectRatio && !options.width && !options.height;\n const effectiveAspectRatio =\n options.aspectRatio || (useDefaultAspectRatio ? \"4:3\" : null);\n\n if (options.width) {\n this.videoElement.width = options.width;\n this.videoElement.style.width = `${options.width}px`;\n }\n\n if (options.height) {\n this.videoElement.height = options.height;\n this.videoElement.style.height = `${options.height}px`;\n }\n\n // Handle positioning - center if x or y not provided\n const centerX = options.x === undefined;\n const centerY = options.y === undefined;\n\n // Always set position to absolute for proper positioning\n this.videoElement.style.position = \"absolute\";\n\n console.log(\"Initial positioning flags:\", {\n centerX,\n centerY,\n x: options.x,\n y: options.y,\n });\n\n if (options.x !== undefined) {\n this.videoElement.style.left = `${options.x}px`;\n }\n\n if (options.y !== undefined) {\n this.videoElement.style.top = `${options.y}px`;\n }\n\n // Create and add grid overlay if needed\n if (gridMode !== \"none\") {\n const gridOverlay = this.createGridOverlay(gridMode);\n gridOverlay.id = \"camera-grid-overlay\";\n parent?.appendChild(gridOverlay);\n }\n\n // Aspect ratio handling is now done after getting camera stream\n\n // Store centering flags for later use\n const needsCenterX = centerX;\n const needsCenterY = centerY;\n\n console.log(\"Centering flags stored:\", { needsCenterX, needsCenterY });\n\n // First get the camera stream with basic constraints\n const constraints: MediaStreamConstraints = {\n video: {\n facingMode: this.isBackCamera ? \"environment\" : \"user\",\n },\n };\n\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n if (!stream) {\n throw new Error(\"could not acquire stream\");\n }\n if (!this.videoElement) {\n throw new Error(\"video element not found\");\n }\n\n // Get the actual camera dimensions from the video track\n const videoTrack = stream.getVideoTracks()[0];\n const settings = videoTrack.getSettings();\n const cameraWidth = settings.width || 640;\n const cameraHeight = settings.height || 480;\n const cameraAspectRatio = cameraWidth / cameraHeight;\n\n console.log(\"Camera native dimensions:\", {\n width: cameraWidth,\n height: cameraHeight,\n aspectRatio: cameraAspectRatio,\n });\n\n console.log(\"Container dimensions:\", {\n width: container.offsetWidth,\n height: container.offsetHeight,\n id: container.id,\n });\n\n // Now adjust video element size based on camera's native aspect ratio\n if (!options.width && !options.height && !options.aspectRatio) {\n // No size specified, fit camera view within container bounds\n const containerWidth = container.offsetWidth || window.innerWidth;\n const containerHeight = container.offsetHeight || window.innerHeight;\n\n // Calculate dimensions that fit within container while maintaining camera aspect ratio\n let targetWidth, targetHeight;\n\n // Try fitting to container width first\n targetWidth = containerWidth;\n targetHeight = targetWidth / cameraAspectRatio;\n\n // If height exceeds container, fit to height instead\n if (targetHeight > containerHeight) {\n targetHeight = containerHeight;\n targetWidth = targetHeight * cameraAspectRatio;\n }\n\n console.log(\"Video element dimensions:\", {\n width: targetWidth,\n height: targetHeight,\n container: { width: containerWidth, height: containerHeight },\n });\n\n this.videoElement.width = targetWidth;\n this.videoElement.height = targetHeight;\n this.videoElement.style.width = `${targetWidth}px`;\n this.videoElement.style.height = `${targetHeight}px`;\n\n // Center the video element within its parent container\n if (needsCenterX || options.x === undefined) {\n const x = Math.round((containerWidth - targetWidth) / 2);\n this.videoElement.style.left = `${x}px`;\n }\n if (needsCenterY || options.y === undefined) {\n let y: number;\n switch (positioning) {\n case \"top\":\n y = 0;\n break;\n case \"bottom\":\n y = window.innerHeight - targetHeight;\n break;\n case \"center\":\n default:\n y = Math.round((window.innerHeight - targetHeight) / 2);\n break;\n }\n this.videoElement.style.setProperty(\"top\", `${y}px`, \"important\");\n // Force a style recalculation\n this.videoElement.offsetHeight;\n console.log(\"Positioning video:\", {\n positioning,\n viewportHeight: window.innerHeight,\n targetHeight,\n calculatedY: y,\n actualTop: this.videoElement.style.top,\n position: this.videoElement.style.position,\n });\n }\n } else if (effectiveAspectRatio && !options.width && !options.height) {\n // Aspect ratio specified but no size\n const [widthRatio, heightRatio] = effectiveAspectRatio\n .split(\":\")\n .map(Number);\n const targetRatio = widthRatio / heightRatio;\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n let targetWidth, targetHeight;\n\n // Try fitting to viewport width first\n targetWidth = viewportWidth;\n targetHeight = targetWidth / targetRatio;\n\n // If height exceeds viewport, fit to height instead\n if (targetHeight > viewportHeight) {\n targetHeight = viewportHeight;\n targetWidth = targetHeight * targetRatio;\n }\n\n this.videoElement.width = targetWidth;\n this.videoElement.height = targetHeight;\n this.videoElement.style.width = `${targetWidth}px`;\n this.videoElement.style.height = `${targetHeight}px`;\n\n // Center the video element within its parent container\n if (needsCenterX || options.x === undefined) {\n const parentWidth = container.offsetWidth || viewportWidth;\n const x = Math.round((parentWidth - targetWidth) / 2);\n this.videoElement.style.left = `${x}px`;\n }\n if (needsCenterY || options.y === undefined) {\n const parentHeight = container.offsetHeight || viewportHeight;\n let y: number;\n switch (positioning) {\n case \"top\":\n y = 0;\n break;\n case \"bottom\":\n y = parentHeight - targetHeight;\n break;\n case \"center\":\n default:\n y = Math.round((parentHeight - targetHeight) / 2);\n break;\n }\n this.videoElement.style.top = `${y}px`;\n }\n }\n\n this.videoElement.srcObject = stream;\n if (!this.isBackCamera) {\n this.videoElement.style.transform = \"scaleX(-1)\";\n }\n\n // Set initial zoom level if specified and supported\n if (\n options.initialZoomLevel !== undefined &&\n options.initialZoomLevel !== 1.0\n ) {\n // videoTrack already declared above\n if (videoTrack) {\n const capabilities = videoTrack.getCapabilities() as any;\n\n if (capabilities.zoom) {\n const zoomLevel = options.initialZoomLevel;\n const minZoom = capabilities.zoom.min || 1;\n const maxZoom = capabilities.zoom.max || 1;\n\n if (zoomLevel < minZoom || zoomLevel > maxZoom) {\n stream.getTracks().forEach((track) => track.stop());\n throw new Error(\n `Initial zoom level ${zoomLevel} is not available. Valid range is ${minZoom} to ${maxZoom}`,\n );\n }\n\n try {\n await videoTrack.applyConstraints({\n advanced: [{ zoom: zoomLevel } as any],\n });\n } catch (error) {\n console.warn(`Failed to set initial zoom level: ${error}`);\n // Don't throw, just continue without zoom\n }\n }\n }\n }\n\n this.isStarted = true;\n this.ensureOrientationListener();\n\n // Wait for video to be ready and get actual dimensions\n await new Promise<void>((resolve) => {\n const videoEl = this.videoElement;\n if (!videoEl) {\n throw new Error(\"video element not found\");\n }\n if (videoEl.readyState >= 2) {\n resolve();\n } else {\n videoEl.addEventListener(\"loadeddata\", () => resolve(), {\n once: true,\n });\n }\n });\n\n // Ensure centering is applied after DOM updates\n await new Promise((resolve) => requestAnimationFrame(resolve));\n\n console.log(\"About to re-center, flags:\", { needsCenterX, needsCenterY });\n\n // Re-apply centering with correct parent dimensions\n if (needsCenterX) {\n const parentWidth = container.offsetWidth;\n const x = Math.round((parentWidth - this.videoElement.offsetWidth) / 2);\n this.videoElement.style.left = `${x}px`;\n console.log(\"Re-centering X:\", {\n parentWidth,\n videoWidth: this.videoElement.offsetWidth,\n x,\n });\n }\n if (needsCenterY) {\n let y: number;\n switch (positioning) {\n case \"top\":\n y = 0;\n break;\n case \"bottom\":\n y = window.innerHeight - this.videoElement.offsetHeight;\n break;\n case \"center\":\n default:\n y = Math.round(\n (window.innerHeight - this.videoElement.offsetHeight) / 2,\n );\n break;\n }\n this.videoElement.style.setProperty(\"top\", `${y}px`, \"important\");\n console.log(\"Re-positioning Y:\", {\n positioning,\n viewportHeight: window.innerHeight,\n videoHeight: this.videoElement.offsetHeight,\n y,\n position: this.videoElement.style.position,\n top: this.videoElement.style.top,\n });\n }\n\n // Get the actual rendered dimensions after video is loaded\n const rect = this.videoElement.getBoundingClientRect();\n const computedStyle = window.getComputedStyle(this.videoElement);\n\n console.log(\"Final video element state:\", {\n rect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },\n style: {\n position: computedStyle.position,\n left: computedStyle.left,\n top: computedStyle.top,\n width: computedStyle.width,\n height: computedStyle.height,\n },\n });\n\n return {\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n x: Math.round(rect.x),\n y: Math.round(rect.y),\n };\n }\n\n private stopStream(stream: any) {\n if (stream) {\n const tracks = stream.getTracks();\n\n for (const track of tracks) track.stop();\n }\n }\n\n async stop(): Promise<void> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (video) {\n video.pause();\n\n this.stopStream(video.srcObject);\n\n video.remove();\n this.isStarted = false;\n }\n\n // Remove grid overlay if it exists\n const gridOverlay = document.getElementById(\"camera-grid-overlay\");\n gridOverlay?.remove();\n }\n\n async capture(options: CameraPreviewPictureOptions): Promise<any> {\n return new Promise((resolve, reject) => {\n const video = document.getElementById(\n DEFAULT_VIDEO_ID,\n ) as HTMLVideoElement;\n if (!video?.srcObject) {\n reject(new Error(\"camera is not running\"));\n return;\n }\n\n // video.width = video.offsetWidth;\n\n let base64EncodedImage;\n\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n\n // Calculate capture dimensions\n let captureWidth = video.videoWidth;\n let captureHeight = video.videoHeight;\n const sourceX = 0;\n const sourceY = 0;\n\n // If width or height is specified, resize to fit within both maximums while maintaining aspect ratio\n if (options.width || options.height) {\n const originalAspectRatio = video.videoWidth / video.videoHeight;\n const targetWidth = options.width || video.videoWidth;\n const targetHeight = options.height || video.videoHeight;\n\n // Calculate dimensions that fit within both maximums\n if (options.width && options.height) {\n // Both dimensions specified - fit within both\n const maxAspectRatio = targetWidth / targetHeight;\n if (originalAspectRatio > maxAspectRatio) {\n // Original is wider - fit by width\n captureWidth = targetWidth;\n captureHeight = targetWidth / originalAspectRatio;\n } else {\n // Original is taller - fit by height\n captureWidth = targetHeight * originalAspectRatio;\n captureHeight = targetHeight;\n }\n } else if (options.width) {\n // Only width specified - maintain aspect ratio\n captureWidth = targetWidth;\n captureHeight = targetWidth / originalAspectRatio;\n } else {\n // Only height specified - maintain aspect ratio\n captureWidth = targetHeight * originalAspectRatio;\n captureHeight = targetHeight;\n }\n }\n\n canvas.width = captureWidth;\n canvas.height = captureHeight;\n\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context?.translate(captureWidth, 0);\n context?.scale(-1, 1);\n }\n context?.drawImage(\n video,\n sourceX,\n sourceY,\n captureWidth,\n captureHeight,\n 0,\n 0,\n captureWidth,\n captureHeight,\n );\n\n if (options.saveToGallery) {\n // saveToGallery is not supported on web\n }\n\n if (options.withExifLocation) {\n // withExifLocation is not supported on web\n }\n\n if ((options.format || \"jpeg\") === \"jpeg\") {\n base64EncodedImage = canvas\n .toDataURL(\"image/jpeg\", (options.quality || 85) / 100.0)\n .replace(\"data:image/jpeg;base64,\", \"\");\n } else {\n base64EncodedImage = canvas\n .toDataURL(\"image/png\")\n .replace(\"data:image/png;base64,\", \"\");\n }\n }\n\n resolve({\n value: base64EncodedImage,\n exif: {},\n });\n });\n }\n\n async captureSample(_options: CameraSampleOptions): Promise<any> {\n return this.capture(_options);\n }\n\n async stopRecordVideo(): Promise<any> {\n throw new Error(\"stopRecordVideo not supported under the web platform\");\n }\n\n async startRecordVideo(_options: CameraPreviewOptions): Promise<any> {\n console.log(\"startRecordVideo\", _options);\n throw new Error(\"startRecordVideo not supported under the web platform\");\n }\n\n async getSupportedFlashModes(): Promise<{\n result: CameraPreviewFlashMode[];\n }> {\n throw new Error(\n \"getSupportedFlashModes not supported under the web platform\",\n );\n }\n\n async getHorizontalFov(): Promise<{\n result: any;\n }> {\n throw new Error(\"getHorizontalFov not supported under the web platform\");\n }\n\n async setFlashMode(_options: {\n flashMode: CameraPreviewFlashMode | string;\n }): Promise<void> {\n throw new Error(\n `setFlashMode not supported under the web platform${_options}`,\n );\n }\n\n async flip(): Promise<void> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n // Stop current stream\n this.stopStream(video.srcObject);\n\n // Toggle camera position\n this.isBackCamera = !this.isBackCamera;\n\n // Get new constraints\n const constraints: MediaStreamConstraints = {\n video: {\n facingMode: this.isBackCamera ? \"environment\" : \"user\",\n width: { ideal: video.videoWidth || 640 },\n height: { ideal: video.videoHeight || 480 },\n },\n };\n\n try {\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n video.srcObject = stream;\n\n // Update current device ID from the new stream\n const videoTrack = stream.getVideoTracks()[0];\n if (videoTrack) {\n this.currentDeviceId = videoTrack.getSettings().deviceId || null;\n }\n\n // Update video transform based on camera\n if (this.isBackCamera) {\n video.style.transform = \"none\";\n video.style.webkitTransform = \"none\";\n } else {\n video.style.transform = \"scaleX(-1)\";\n video.style.webkitTransform = \"scaleX(-1)\";\n }\n\n await video.play();\n } catch (error) {\n throw new Error(`Failed to flip camera: ${error}`);\n }\n }\n\n async setOpacity(_options: CameraOpacityOptions): Promise<any> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!!video && !!_options.opacity)\n video.style.setProperty(\"opacity\", _options.opacity.toString());\n }\n\n async isRunning(): Promise<{ isRunning: boolean }> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n return { isRunning: !!video && !!video.srcObject };\n }\n\n async getAvailableDevices(): Promise<{ devices: CameraDevice[] }> {\n if (!navigator.mediaDevices?.enumerateDevices) {\n throw new Error(\n \"getAvailableDevices not supported under the web platform\",\n );\n }\n\n const devices = await navigator.mediaDevices.enumerateDevices();\n const videoDevices = devices.filter(\n (device) => device.kind === \"videoinput\",\n );\n\n // Group devices by position (front/back)\n const frontDevices: any[] = [];\n const backDevices: any[] = [];\n\n videoDevices.forEach((device, index) => {\n const label = device.label || `Camera ${index + 1}`;\n const labelLower = label.toLowerCase();\n\n // Determine device type based on label\n let deviceType: DeviceType = DeviceType.WIDE_ANGLE;\n let baseZoomRatio = 1.0;\n\n if (labelLower.includes(\"ultra\") || labelLower.includes(\"0.5\")) {\n deviceType = DeviceType.ULTRA_WIDE;\n baseZoomRatio = 0.5;\n } else if (\n labelLower.includes(\"telephoto\") ||\n labelLower.includes(\"tele\") ||\n labelLower.includes(\"2x\") ||\n labelLower.includes(\"3x\")\n ) {\n deviceType = DeviceType.TELEPHOTO;\n baseZoomRatio = 2.0;\n } else if (\n labelLower.includes(\"depth\") ||\n labelLower.includes(\"truedepth\")\n ) {\n deviceType = DeviceType.TRUE_DEPTH;\n baseZoomRatio = 1.0;\n }\n\n const lensInfo = {\n deviceId: device.deviceId,\n label,\n deviceType,\n focalLength: 4.25,\n baseZoomRatio,\n minZoom: 1.0,\n maxZoom: 1.0,\n };\n\n // Determine position and add to appropriate array\n if (labelLower.includes(\"back\") || labelLower.includes(\"rear\")) {\n backDevices.push(lensInfo);\n } else {\n frontDevices.push(lensInfo);\n }\n });\n\n const result: CameraDevice[] = [];\n\n if (frontDevices.length > 0) {\n result.push({\n deviceId: frontDevices[0].deviceId,\n label: \"Front Camera\",\n position: \"front\",\n lenses: frontDevices,\n isLogical: false,\n minZoom: Math.min(...frontDevices.map((d) => d.minZoom)),\n maxZoom: Math.max(...frontDevices.map((d) => d.maxZoom)),\n });\n }\n\n if (backDevices.length > 0) {\n result.push({\n deviceId: backDevices[0].deviceId,\n label: \"Back Camera\",\n position: \"rear\",\n lenses: backDevices,\n isLogical: false,\n minZoom: Math.min(...backDevices.map((d) => d.minZoom)),\n maxZoom: Math.max(...backDevices.map((d) => d.maxZoom)),\n });\n }\n\n return { devices: result };\n }\n\n async getZoom(): Promise<{\n min: number;\n max: number;\n current: number;\n lens: LensInfo;\n }> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n const stream = video.srcObject as MediaStream;\n const videoTrack = stream.getVideoTracks()[0];\n\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n\n const capabilities = videoTrack.getCapabilities() as any;\n const settings = videoTrack.getSettings() as any;\n\n if (!capabilities.zoom) {\n throw new Error(\"zoom not supported by this device\");\n }\n\n // Get current device info to determine lens type\n let deviceType: DeviceType = DeviceType.WIDE_ANGLE;\n let baseZoomRatio = 1.0;\n\n if (this.currentDeviceId) {\n const devices = await navigator.mediaDevices.enumerateDevices();\n const device = devices.find((d) => d.deviceId === this.currentDeviceId);\n if (device) {\n const labelLower = device.label.toLowerCase();\n if (labelLower.includes(\"ultra\") || labelLower.includes(\"0.5\")) {\n deviceType = DeviceType.ULTRA_WIDE;\n baseZoomRatio = 0.5;\n } else if (\n labelLower.includes(\"telephoto\") ||\n labelLower.includes(\"tele\") ||\n labelLower.includes(\"2x\") ||\n labelLower.includes(\"3x\")\n ) {\n deviceType = DeviceType.TELEPHOTO;\n baseZoomRatio = 2.0;\n } else if (\n labelLower.includes(\"depth\") ||\n labelLower.includes(\"truedepth\")\n ) {\n deviceType = DeviceType.TRUE_DEPTH;\n baseZoomRatio = 1.0;\n }\n }\n }\n\n const currentZoom = settings.zoom || 1;\n const lensInfo: LensInfo = {\n focalLength: 4.25,\n deviceType,\n baseZoomRatio,\n digitalZoom: currentZoom / baseZoomRatio,\n };\n\n return {\n min: capabilities.zoom.min || 1,\n max: capabilities.zoom.max || 1,\n current: currentZoom,\n lens: lensInfo,\n };\n }\n\n async setZoom(options: {\n level: number;\n ramp?: boolean;\n autoFocus?: boolean;\n }): Promise<void> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n const stream = video.srcObject as MediaStream;\n const videoTrack = stream.getVideoTracks()[0];\n\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n\n const capabilities = videoTrack.getCapabilities() as any;\n\n if (!capabilities.zoom) {\n throw new Error(\"zoom not supported by this device\");\n }\n\n const zoomLevel = Math.max(\n capabilities.zoom.min || 1,\n Math.min(capabilities.zoom.max || 1, options.level),\n );\n\n // Note: autoFocus is not supported on web platform\n\n try {\n await videoTrack.applyConstraints({\n advanced: [{ zoom: zoomLevel } as any],\n });\n } catch (error) {\n throw new Error(`Failed to set zoom: ${error}`);\n }\n }\n\n async getFlashMode(): Promise<{ flashMode: FlashMode }> {\n throw new Error(\"getFlashMode not supported under the web platform\");\n }\n\n async getDeviceId(): Promise<{ deviceId: string }> {\n return { deviceId: this.currentDeviceId || \"\" };\n }\n\n async setDeviceId(options: { deviceId: string }): Promise<void> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n // Stop current stream\n this.stopStream(video.srcObject);\n\n // Update current device ID\n this.currentDeviceId = options.deviceId;\n\n // Get new constraints with specific device ID\n const constraints: MediaStreamConstraints = {\n video: {\n deviceId: { exact: options.deviceId },\n width: { ideal: video.videoWidth || 640 },\n height: { ideal: video.videoHeight || 480 },\n },\n };\n\n try {\n // Try to determine camera position from device\n const devices = await navigator.mediaDevices.enumerateDevices();\n const device = devices.find((d) => d.deviceId === options.deviceId);\n this.isBackCamera =\n device?.label.toLowerCase().includes(\"back\") ||\n device?.label.toLowerCase().includes(\"rear\") ||\n false;\n\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n video.srcObject = stream;\n\n // Update video transform based on camera\n if (this.isBackCamera) {\n video.style.transform = \"none\";\n video.style.webkitTransform = \"none\";\n } else {\n video.style.transform = \"scaleX(-1)\";\n video.style.webkitTransform = \"scaleX(-1)\";\n }\n\n await video.play();\n } catch (error) {\n throw new Error(`Failed to swap to device ${options.deviceId}: ${error}`);\n }\n }\n\n async getAspectRatio(): Promise<{ aspectRatio: \"4:3\" | \"16:9\" }> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n\n const width = video.offsetWidth;\n const height = video.offsetHeight;\n\n if (width && height) {\n const ratio = width / height;\n // Check for portrait camera ratios: 4:3 -> 3:4, 16:9 -> 9:16\n if (Math.abs(ratio - 3 / 4) < 0.01) {\n return { aspectRatio: \"4:3\" };\n }\n if (Math.abs(ratio - 9 / 16) < 0.01) {\n return { aspectRatio: \"16:9\" };\n }\n }\n\n // Default to 4:3 if no specific aspect ratio is matched\n return { aspectRatio: \"4:3\" };\n }\n\n async 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 const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n\n if (options.aspectRatio) {\n const [widthRatio, heightRatio] = options.aspectRatio\n .split(\":\")\n .map(Number);\n // For camera, use portrait orientation: 4:3 becomes 3:4, 16:9 becomes 9:16\n const ratio = heightRatio / widthRatio;\n\n // Get current position and size\n const rect = video.getBoundingClientRect();\n const currentWidth = rect.width;\n const currentHeight = rect.height;\n const currentRatio = currentWidth / currentHeight;\n\n let newWidth: number;\n let newHeight: number;\n\n if (currentRatio > ratio) {\n // Width is larger, fit by height and center horizontally\n newWidth = currentHeight * ratio;\n newHeight = currentHeight;\n } else {\n // Height is larger, fit by width and center vertically\n newWidth = currentWidth;\n newHeight = currentWidth / ratio;\n }\n\n // Calculate position\n let x: number, y: number;\n if (options.x !== undefined && options.y !== undefined) {\n // Use provided coordinates, ensuring they stay within screen boundaries\n x = Math.max(0, Math.min(options.x, window.innerWidth - newWidth));\n y = Math.max(0, Math.min(options.y, window.innerHeight - newHeight));\n } else {\n // Auto-center the view\n x = (window.innerWidth - newWidth) / 2;\n y = (window.innerHeight - newHeight) / 2;\n }\n\n video.style.width = `${newWidth}px`;\n video.style.height = `${newHeight}px`;\n video.style.left = `${x}px`;\n video.style.top = `${y}px`;\n video.style.position = \"absolute\";\n\n const offsetX = newWidth / 8;\n const offsetY = newHeight / 8;\n\n return {\n width: Math.round(newWidth),\n height: Math.round(newHeight),\n x: Math.round(x + offsetX),\n y: Math.round(y + offsetY),\n };\n } else {\n video.style.objectFit = \"cover\";\n const rect = video.getBoundingClientRect();\n const offsetX = rect.width / 8;\n const offsetY = rect.height / 8;\n\n return {\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n x: Math.round(rect.left + offsetX),\n y: Math.round(rect.top + offsetY),\n };\n }\n }\n\n private createGridOverlay(gridMode: string): HTMLElement {\n const overlay = document.createElement(\"div\");\n overlay.style.position = \"absolute\";\n overlay.style.top = \"0\";\n overlay.style.left = \"0\";\n overlay.style.width = \"100%\";\n overlay.style.height = \"100%\";\n overlay.style.pointerEvents = \"none\";\n overlay.style.zIndex = \"10\";\n\n const divisions = gridMode === \"3x3\" ? 3 : 4;\n\n // Create SVG for grid lines\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.style.width = \"100%\";\n svg.style.height = \"100%\";\n svg.style.position = \"absolute\";\n svg.style.top = \"0\";\n svg.style.left = \"0\";\n\n // Create grid lines\n for (let i = 1; i < divisions; i++) {\n // Vertical lines\n const verticalLine = document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"line\",\n );\n verticalLine.setAttribute(\"x1\", `${(i / divisions) * 100}%`);\n verticalLine.setAttribute(\"y1\", \"0%\");\n verticalLine.setAttribute(\"x2\", `${(i / divisions) * 100}%`);\n verticalLine.setAttribute(\"y2\", \"100%\");\n verticalLine.setAttribute(\"stroke\", \"rgba(255, 255, 255, 0.5)\");\n verticalLine.setAttribute(\"stroke-width\", \"1\");\n svg.appendChild(verticalLine);\n\n // Horizontal lines\n const horizontalLine = document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"line\",\n );\n horizontalLine.setAttribute(\"x1\", \"0%\");\n horizontalLine.setAttribute(\"y1\", `${(i / divisions) * 100}%`);\n horizontalLine.setAttribute(\"x2\", \"100%\");\n horizontalLine.setAttribute(\"y2\", `${(i / divisions) * 100}%`);\n horizontalLine.setAttribute(\"stroke\", \"rgba(255, 255, 255, 0.5)\");\n horizontalLine.setAttribute(\"stroke-width\", \"1\");\n svg.appendChild(horizontalLine);\n }\n\n overlay.appendChild(svg);\n return overlay;\n }\n\n async setGridMode(options: { gridMode: GridMode }): Promise<void> {\n // Web implementation of grid mode would need to be implemented\n // For now, just resolve as a no-op\n console.warn(\n `Grid mode '${options.gridMode}' is not yet implemented for web platform`,\n );\n }\n\n async getGridMode(): Promise<{ gridMode: GridMode }> {\n // Web implementation - default to none\n return { gridMode: \"none\" };\n }\n\n async getPreviewSize(): Promise<{\n x: number;\n y: number;\n width: number;\n height: number;\n }> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n const offsetX = video.width / 8;\n const offsetY = video.height / 8;\n\n return {\n x: video.offsetLeft + offsetX,\n y: video.offsetTop + offsetY,\n width: video.width,\n height: video.height,\n };\n }\n async 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 const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n video.style.left = `${options.x}px`;\n video.style.top = `${options.y}px`;\n video.width = options.width;\n video.height = options.height;\n\n const offsetX = options.width / 8;\n const offsetY = options.height / 8;\n\n return {\n width: options.width,\n height: options.height,\n x: options.x + offsetX,\n y: options.y + offsetY,\n };\n }\n\n async setFocus(options: { x: number; y: number }): Promise<void> {\n // Reject if values are outside 0-1 range\n if (options.x < 0 || options.x > 1 || options.y < 0 || options.y > 1) {\n throw new Error(\"Focus coordinates must be between 0 and 1\");\n }\n\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n const stream = video.srcObject as MediaStream;\n const videoTrack = stream.getVideoTracks()[0];\n\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n\n const capabilities = videoTrack.getCapabilities() as any;\n\n // Check if focusing is supported\n if (capabilities.focusMode) {\n try {\n // Web API supports focus mode settings but not coordinate-based focus\n // Setting to manual mode allows for coordinate focus if supported\n await videoTrack.applyConstraints({\n advanced: [\n {\n focusMode: \"manual\",\n focusDistance: 0.5, // Mid-range focus as fallback\n } as any,\n ],\n });\n } catch (error) {\n console.warn(\n `setFocus is not fully supported on this device: ${error}. Focus coordinates (${options.x}, ${options.y}) were provided but cannot be applied.`,\n );\n }\n } else {\n console.warn(\n \"Focus control is not supported on this device. Focus coordinates were provided but cannot be applied.\",\n );\n }\n }\n\n async deleteFile(_options: { path: string }): Promise<{ success: boolean }> {\n // Mark parameter as intentionally unused to satisfy linter\n void _options;\n throw new Error(\"deleteFile not supported under the web platform\");\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAiB5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,gBAAgB,GAAG,aAAa,CAAC;AACvC,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAW7C;QACE,KAAK,EAAE,CAAC;QAXV;;;WAGG;QACK,iBAAY,GAAG,KAAK,CAAC;QACrB,oBAAe,GAAkB,IAAI,CAAC;QACtC,iBAAY,GAA4B,IAAI,CAAC;QAC7C,cAAS,GAAG,KAAK,CAAC;QAClB,6BAAwB,GAAG,KAAK,CAAC;IAIzC,CAAC;IACO,qBAAqB;;QAC3B,IAAI,CAAC;YACH,MAAM,EAAE,GAAS,MAAc,CAAC,WAAW,CAAC;YAC5C,MAAM,IAAI,GAAG,CAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,IAAI,MAAI,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,cAAc,CAAA,KAAI,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,aAAa,CAAA,CAAC;YACjE,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;oBAAE,OAAO,UAAU,CAAC;gBACzD,IAAI,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC;oBAAE,OAAO,sBAAsB,CAAC;gBACvE,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AK,QAAQ,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n CameraDevice,\n CameraOpacityOptions,\n CameraPreviewFlashMode,\n CameraPreviewOptions,\n CameraPreviewPictureOptions,\n CameraPreviewPlugin,\n CameraSampleOptions,\n DeviceOrientation,\n GridMode,\n ExposureMode,\n FlashMode,\n LensInfo,\n SafeAreaInsets,\n} from \"./definitions\";\nimport { DeviceType } from \"./definitions\";\n\nconst DEFAULT_VIDEO_ID = \"capgo_video\";\nexport class CameraPreviewWeb extends WebPlugin implements CameraPreviewPlugin {\n /**\n * track which camera is used based on start options\n * used in capture\n */\n private isBackCamera = false;\n private currentDeviceId: string | null = null;\n private videoElement: HTMLVideoElement | null = null;\n private isStarted = false;\n private orientationListenerBound = false;\n\n constructor() {\n super();\n }\n private getCurrentOrientation(): DeviceOrientation {\n try {\n const so: any = (screen as any).orientation;\n const type = so?.type || so?.mozOrientation || so?.msOrientation;\n if (typeof type === \"string\") {\n if (type.includes(\"portrait-primary\")) return \"portrait\";\n if (type.includes(\"portrait-secondary\")) return \"portrait-upside-down\";\n if (type.includes(\"landscape-primary\")) return \"landscape-left\";\n if (type.includes(\"landscape-secondary\")) return \"landscape-right\";\n if (type.includes(\"landscape\")) return \"landscape\";\n if (type.includes(\"portrait\")) return \"portrait\";\n }\n const angle = (window as any).orientation;\n if (typeof angle === \"number\") {\n if (angle === 0) return \"portrait\";\n if (angle === 180) return \"portrait-upside-down\";\n if (angle === 90) return \"landscape-right\";\n if (angle === -90) return \"landscape-left\";\n if (angle === 270) return \"landscape-left\";\n }\n if (window.matchMedia(\"(orientation: portrait)\")?.matches) {\n return \"portrait\";\n }\n if (window.matchMedia(\"(orientation: landscape)\")?.matches) {\n return \"landscape\";\n }\n } catch (e) {\n console.error(e);\n }\n return \"unknown\";\n }\n private ensureOrientationListener() {\n if (this.orientationListenerBound) return;\n const emit = () => {\n this.notifyListeners(\"orientationChange\", {\n orientation: this.getCurrentOrientation(),\n });\n };\n window.addEventListener(\"orientationchange\", emit);\n window.addEventListener(\"resize\", emit);\n this.orientationListenerBound = true;\n }\n async getOrientation(): Promise<{ orientation: DeviceOrientation }> {\n return { orientation: this.getCurrentOrientation() };\n }\n getSafeAreaInsets(): Promise<SafeAreaInsets> {\n throw new Error(\"Method not implemented.\");\n }\n\n async getZoomButtonValues(): Promise<{ values: number[] }> {\n throw new Error(\"getZoomButtonValues not supported under the web platform\");\n }\n\n async getSupportedPictureSizes(): Promise<any> {\n throw new Error(\n \"getSupportedPictureSizes not supported under the web platform\",\n );\n }\n\n async start(\n options: CameraPreviewOptions,\n ): Promise<{ width: number; height: number; x: number; y: number }> {\n if (options.aspectRatio && (options.width || options.height)) {\n throw new Error(\n \"Cannot set both aspectRatio and size (width/height). Use setPreviewSize after start.\",\n );\n }\n if (this.isStarted) {\n throw new Error(\"camera already started\");\n }\n\n this.isBackCamera = true;\n this.isStarted = false;\n const parent = document.getElementById(options?.parent || \"\");\n const gridMode = options?.gridMode || \"none\";\n const positioning = options?.positioning || \"top\";\n\n if (options.position) {\n this.isBackCamera = options.position === \"rear\";\n }\n\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (video) {\n video.remove();\n }\n const container = options.parent\n ? document.getElementById(options.parent)\n : document.body;\n if (!container) {\n throw new Error(\"container not found\");\n }\n this.videoElement = document.createElement(\"video\");\n this.videoElement.id = DEFAULT_VIDEO_ID;\n this.videoElement.className = options.className || \"\";\n this.videoElement.playsInline = true;\n this.videoElement.muted = true;\n this.videoElement.autoplay = true;\n // Remove objectFit as we'll match camera's native aspect ratio\n this.videoElement.style.backgroundColor = \"transparent\";\n // Reset any default margins that might interfere\n this.videoElement.style.margin = \"0\";\n this.videoElement.style.padding = \"0\";\n\n container.appendChild(this.videoElement);\n if (options.toBack) {\n this.videoElement.style.zIndex = \"-1\";\n }\n\n // Default to 4:3 if no aspect ratio or size specified\n const useDefaultAspectRatio =\n !options.aspectRatio && !options.width && !options.height;\n const effectiveAspectRatio =\n options.aspectRatio || (useDefaultAspectRatio ? \"4:3\" : null);\n\n if (options.width) {\n this.videoElement.width = options.width;\n this.videoElement.style.width = `${options.width}px`;\n }\n\n if (options.height) {\n this.videoElement.height = options.height;\n this.videoElement.style.height = `${options.height}px`;\n }\n\n // Handle positioning - center if x or y not provided\n const centerX = options.x === undefined;\n const centerY = options.y === undefined;\n\n // Always set position to absolute for proper positioning\n this.videoElement.style.position = \"absolute\";\n\n console.log(\"Initial positioning flags:\", {\n centerX,\n centerY,\n x: options.x,\n y: options.y,\n });\n\n if (options.x !== undefined) {\n this.videoElement.style.left = `${options.x}px`;\n }\n\n if (options.y !== undefined) {\n this.videoElement.style.top = `${options.y}px`;\n }\n\n // Create and add grid overlay if needed\n if (gridMode !== \"none\") {\n const gridOverlay = this.createGridOverlay(gridMode);\n gridOverlay.id = \"camera-grid-overlay\";\n parent?.appendChild(gridOverlay);\n }\n\n // Aspect ratio handling is now done after getting camera stream\n\n // Store centering flags for later use\n const needsCenterX = centerX;\n const needsCenterY = centerY;\n\n console.log(\"Centering flags stored:\", { needsCenterX, needsCenterY });\n\n // First get the camera stream with basic constraints\n const constraints: MediaStreamConstraints = {\n video: {\n facingMode: this.isBackCamera ? \"environment\" : \"user\",\n },\n };\n\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n if (!stream) {\n throw new Error(\"could not acquire stream\");\n }\n if (!this.videoElement) {\n throw new Error(\"video element not found\");\n }\n\n // Get the actual camera dimensions from the video track\n const videoTrack = stream.getVideoTracks()[0];\n const settings = videoTrack.getSettings();\n const cameraWidth = settings.width || 640;\n const cameraHeight = settings.height || 480;\n const cameraAspectRatio = cameraWidth / cameraHeight;\n\n console.log(\"Camera native dimensions:\", {\n width: cameraWidth,\n height: cameraHeight,\n aspectRatio: cameraAspectRatio,\n });\n\n console.log(\"Container dimensions:\", {\n width: container.offsetWidth,\n height: container.offsetHeight,\n id: container.id,\n });\n\n // Now adjust video element size based on camera's native aspect ratio\n if (!options.width && !options.height && !options.aspectRatio) {\n // No size specified, fit camera view within container bounds\n const containerWidth = container.offsetWidth || window.innerWidth;\n const containerHeight = container.offsetHeight || window.innerHeight;\n\n // Calculate dimensions that fit within container while maintaining camera aspect ratio\n let targetWidth, targetHeight;\n\n // Try fitting to container width first\n targetWidth = containerWidth;\n targetHeight = targetWidth / cameraAspectRatio;\n\n // If height exceeds container, fit to height instead\n if (targetHeight > containerHeight) {\n targetHeight = containerHeight;\n targetWidth = targetHeight * cameraAspectRatio;\n }\n\n console.log(\"Video element dimensions:\", {\n width: targetWidth,\n height: targetHeight,\n container: { width: containerWidth, height: containerHeight },\n });\n\n this.videoElement.width = targetWidth;\n this.videoElement.height = targetHeight;\n this.videoElement.style.width = `${targetWidth}px`;\n this.videoElement.style.height = `${targetHeight}px`;\n\n // Center the video element within its parent container\n if (needsCenterX || options.x === undefined) {\n const x = Math.round((containerWidth - targetWidth) / 2);\n this.videoElement.style.left = `${x}px`;\n }\n if (needsCenterY || options.y === undefined) {\n let y: number;\n switch (positioning) {\n case \"top\":\n y = 0;\n break;\n case \"bottom\":\n y = window.innerHeight - targetHeight;\n break;\n case \"center\":\n default:\n y = Math.round((window.innerHeight - targetHeight) / 2);\n break;\n }\n this.videoElement.style.setProperty(\"top\", `${y}px`, \"important\");\n // Force a style recalculation\n this.videoElement.offsetHeight;\n console.log(\"Positioning video:\", {\n positioning,\n viewportHeight: window.innerHeight,\n targetHeight,\n calculatedY: y,\n actualTop: this.videoElement.style.top,\n position: this.videoElement.style.position,\n });\n }\n } else if (effectiveAspectRatio && !options.width && !options.height) {\n // Aspect ratio specified but no size\n const [widthRatio, heightRatio] = effectiveAspectRatio\n .split(\":\")\n .map(Number);\n const targetRatio = widthRatio / heightRatio;\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n let targetWidth, targetHeight;\n\n // Try fitting to viewport width first\n targetWidth = viewportWidth;\n targetHeight = targetWidth / targetRatio;\n\n // If height exceeds viewport, fit to height instead\n if (targetHeight > viewportHeight) {\n targetHeight = viewportHeight;\n targetWidth = targetHeight * targetRatio;\n }\n\n this.videoElement.width = targetWidth;\n this.videoElement.height = targetHeight;\n this.videoElement.style.width = `${targetWidth}px`;\n this.videoElement.style.height = `${targetHeight}px`;\n\n // Center the video element within its parent container\n if (needsCenterX || options.x === undefined) {\n const parentWidth = container.offsetWidth || viewportWidth;\n const x = Math.round((parentWidth - targetWidth) / 2);\n this.videoElement.style.left = `${x}px`;\n }\n if (needsCenterY || options.y === undefined) {\n const parentHeight = container.offsetHeight || viewportHeight;\n let y: number;\n switch (positioning) {\n case \"top\":\n y = 0;\n break;\n case \"bottom\":\n y = parentHeight - targetHeight;\n break;\n case \"center\":\n default:\n y = Math.round((parentHeight - targetHeight) / 2);\n break;\n }\n this.videoElement.style.top = `${y}px`;\n }\n }\n\n this.videoElement.srcObject = stream;\n if (!this.isBackCamera) {\n this.videoElement.style.transform = \"scaleX(-1)\";\n }\n\n // Set initial zoom level if specified and supported\n if (\n options.initialZoomLevel !== undefined &&\n options.initialZoomLevel !== 1.0\n ) {\n // videoTrack already declared above\n if (videoTrack) {\n const capabilities = videoTrack.getCapabilities() as any;\n\n if (capabilities.zoom) {\n const zoomLevel = options.initialZoomLevel;\n const minZoom = capabilities.zoom.min || 1;\n const maxZoom = capabilities.zoom.max || 1;\n\n if (zoomLevel < minZoom || zoomLevel > maxZoom) {\n stream.getTracks().forEach((track) => track.stop());\n throw new Error(\n `Initial zoom level ${zoomLevel} is not available. Valid range is ${minZoom} to ${maxZoom}`,\n );\n }\n\n try {\n await videoTrack.applyConstraints({\n advanced: [{ zoom: zoomLevel } as any],\n });\n } catch (error) {\n console.warn(`Failed to set initial zoom level: ${error}`);\n // Don't throw, just continue without zoom\n }\n }\n }\n }\n\n this.isStarted = true;\n this.ensureOrientationListener();\n\n // Wait for video to be ready and get actual dimensions\n await new Promise<void>((resolve) => {\n const videoEl = this.videoElement;\n if (!videoEl) {\n throw new Error(\"video element not found\");\n }\n if (videoEl.readyState >= 2) {\n resolve();\n } else {\n videoEl.addEventListener(\"loadeddata\", () => resolve(), {\n once: true,\n });\n }\n });\n\n // Ensure centering is applied after DOM updates\n await new Promise((resolve) => requestAnimationFrame(resolve));\n\n console.log(\"About to re-center, flags:\", { needsCenterX, needsCenterY });\n\n // Re-apply centering with correct parent dimensions\n if (needsCenterX) {\n const parentWidth = container.offsetWidth;\n const x = Math.round((parentWidth - this.videoElement.offsetWidth) / 2);\n this.videoElement.style.left = `${x}px`;\n console.log(\"Re-centering X:\", {\n parentWidth,\n videoWidth: this.videoElement.offsetWidth,\n x,\n });\n }\n if (needsCenterY) {\n let y: number;\n switch (positioning) {\n case \"top\":\n y = 0;\n break;\n case \"bottom\":\n y = window.innerHeight - this.videoElement.offsetHeight;\n break;\n case \"center\":\n default:\n y = Math.round(\n (window.innerHeight - this.videoElement.offsetHeight) / 2,\n );\n break;\n }\n this.videoElement.style.setProperty(\"top\", `${y}px`, \"important\");\n console.log(\"Re-positioning Y:\", {\n positioning,\n viewportHeight: window.innerHeight,\n videoHeight: this.videoElement.offsetHeight,\n y,\n position: this.videoElement.style.position,\n top: this.videoElement.style.top,\n });\n }\n\n // Get the actual rendered dimensions after video is loaded\n const rect = this.videoElement.getBoundingClientRect();\n const computedStyle = window.getComputedStyle(this.videoElement);\n\n console.log(\"Final video element state:\", {\n rect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },\n style: {\n position: computedStyle.position,\n left: computedStyle.left,\n top: computedStyle.top,\n width: computedStyle.width,\n height: computedStyle.height,\n },\n });\n\n return {\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n x: Math.round(rect.x),\n y: Math.round(rect.y),\n };\n }\n\n private stopStream(stream: any) {\n if (stream) {\n const tracks = stream.getTracks();\n\n for (const track of tracks) track.stop();\n }\n }\n\n async stop(): Promise<void> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (video) {\n video.pause();\n\n this.stopStream(video.srcObject);\n\n video.remove();\n this.isStarted = false;\n }\n\n // Remove grid overlay if it exists\n const gridOverlay = document.getElementById(\"camera-grid-overlay\");\n gridOverlay?.remove();\n }\n\n async capture(options: CameraPreviewPictureOptions): Promise<any> {\n return new Promise((resolve, reject) => {\n const video = document.getElementById(\n DEFAULT_VIDEO_ID,\n ) as HTMLVideoElement;\n if (!video?.srcObject) {\n reject(new Error(\"camera is not running\"));\n return;\n }\n\n // video.width = video.offsetWidth;\n\n let base64EncodedImage;\n\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n\n // Calculate capture dimensions\n let captureWidth = video.videoWidth;\n let captureHeight = video.videoHeight;\n const sourceX = 0;\n const sourceY = 0;\n\n // If width or height is specified, resize to fit within both maximums while maintaining aspect ratio\n if (options.width || options.height) {\n const originalAspectRatio = video.videoWidth / video.videoHeight;\n const targetWidth = options.width || video.videoWidth;\n const targetHeight = options.height || video.videoHeight;\n\n // Calculate dimensions that fit within both maximums\n if (options.width && options.height) {\n // Both dimensions specified - fit within both\n const maxAspectRatio = targetWidth / targetHeight;\n if (originalAspectRatio > maxAspectRatio) {\n // Original is wider - fit by width\n captureWidth = targetWidth;\n captureHeight = targetWidth / originalAspectRatio;\n } else {\n // Original is taller - fit by height\n captureWidth = targetHeight * originalAspectRatio;\n captureHeight = targetHeight;\n }\n } else if (options.width) {\n // Only width specified - maintain aspect ratio\n captureWidth = targetWidth;\n captureHeight = targetWidth / originalAspectRatio;\n } else {\n // Only height specified - maintain aspect ratio\n captureWidth = targetHeight * originalAspectRatio;\n captureHeight = targetHeight;\n }\n }\n\n canvas.width = captureWidth;\n canvas.height = captureHeight;\n\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context?.translate(captureWidth, 0);\n context?.scale(-1, 1);\n }\n context?.drawImage(\n video,\n sourceX,\n sourceY,\n captureWidth,\n captureHeight,\n 0,\n 0,\n captureWidth,\n captureHeight,\n );\n\n if (options.saveToGallery) {\n // saveToGallery is not supported on web\n }\n\n if (options.withExifLocation) {\n // withExifLocation is not supported on web\n }\n\n if ((options.format || \"jpeg\") === \"jpeg\") {\n base64EncodedImage = canvas\n .toDataURL(\"image/jpeg\", (options.quality || 85) / 100.0)\n .replace(\"data:image/jpeg;base64,\", \"\");\n } else {\n base64EncodedImage = canvas\n .toDataURL(\"image/png\")\n .replace(\"data:image/png;base64,\", \"\");\n }\n }\n\n resolve({\n value: base64EncodedImage,\n exif: {},\n });\n });\n }\n\n async captureSample(_options: CameraSampleOptions): Promise<any> {\n return this.capture(_options);\n }\n\n async stopRecordVideo(): Promise<any> {\n throw new Error(\"stopRecordVideo not supported under the web platform\");\n }\n\n async startRecordVideo(_options: CameraPreviewOptions): Promise<any> {\n console.log(\"startRecordVideo\", _options);\n throw new Error(\"startRecordVideo not supported under the web platform\");\n }\n\n async getSupportedFlashModes(): Promise<{\n result: CameraPreviewFlashMode[];\n }> {\n throw new Error(\n \"getSupportedFlashModes not supported under the web platform\",\n );\n }\n\n async getHorizontalFov(): Promise<{\n result: any;\n }> {\n throw new Error(\"getHorizontalFov not supported under the web platform\");\n }\n\n async setFlashMode(_options: {\n flashMode: CameraPreviewFlashMode | string;\n }): Promise<void> {\n throw new Error(\n `setFlashMode not supported under the web platform${_options}`,\n );\n }\n\n async flip(): Promise<void> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n // Stop current stream\n this.stopStream(video.srcObject);\n\n // Toggle camera position\n this.isBackCamera = !this.isBackCamera;\n\n // Get new constraints\n const constraints: MediaStreamConstraints = {\n video: {\n facingMode: this.isBackCamera ? \"environment\" : \"user\",\n width: { ideal: video.videoWidth || 640 },\n height: { ideal: video.videoHeight || 480 },\n },\n };\n\n try {\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n video.srcObject = stream;\n\n // Update current device ID from the new stream\n const videoTrack = stream.getVideoTracks()[0];\n if (videoTrack) {\n this.currentDeviceId = videoTrack.getSettings().deviceId || null;\n }\n\n // Update video transform based on camera\n if (this.isBackCamera) {\n video.style.transform = \"none\";\n video.style.webkitTransform = \"none\";\n } else {\n video.style.transform = \"scaleX(-1)\";\n video.style.webkitTransform = \"scaleX(-1)\";\n }\n\n await video.play();\n } catch (error) {\n throw new Error(`Failed to flip camera: ${error}`);\n }\n }\n\n async setOpacity(_options: CameraOpacityOptions): Promise<any> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!!video && !!_options.opacity)\n video.style.setProperty(\"opacity\", _options.opacity.toString());\n }\n\n async isRunning(): Promise<{ isRunning: boolean }> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n return { isRunning: !!video && !!video.srcObject };\n }\n\n async getAvailableDevices(): Promise<{ devices: CameraDevice[] }> {\n if (!navigator.mediaDevices?.enumerateDevices) {\n throw new Error(\n \"getAvailableDevices not supported under the web platform\",\n );\n }\n\n const devices = await navigator.mediaDevices.enumerateDevices();\n const videoDevices = devices.filter(\n (device) => device.kind === \"videoinput\",\n );\n\n // Group devices by position (front/back)\n const frontDevices: any[] = [];\n const backDevices: any[] = [];\n\n videoDevices.forEach((device, index) => {\n const label = device.label || `Camera ${index + 1}`;\n const labelLower = label.toLowerCase();\n\n // Determine device type based on label\n let deviceType: DeviceType = DeviceType.WIDE_ANGLE;\n let baseZoomRatio = 1.0;\n\n if (labelLower.includes(\"ultra\") || labelLower.includes(\"0.5\")) {\n deviceType = DeviceType.ULTRA_WIDE;\n baseZoomRatio = 0.5;\n } else if (\n labelLower.includes(\"telephoto\") ||\n labelLower.includes(\"tele\") ||\n labelLower.includes(\"2x\") ||\n labelLower.includes(\"3x\")\n ) {\n deviceType = DeviceType.TELEPHOTO;\n baseZoomRatio = 2.0;\n } else if (\n labelLower.includes(\"depth\") ||\n labelLower.includes(\"truedepth\")\n ) {\n deviceType = DeviceType.TRUE_DEPTH;\n baseZoomRatio = 1.0;\n }\n\n const lensInfo = {\n deviceId: device.deviceId,\n label,\n deviceType,\n focalLength: 4.25,\n baseZoomRatio,\n minZoom: 1.0,\n maxZoom: 1.0,\n };\n\n // Determine position and add to appropriate array\n if (labelLower.includes(\"back\") || labelLower.includes(\"rear\")) {\n backDevices.push(lensInfo);\n } else {\n frontDevices.push(lensInfo);\n }\n });\n\n const result: CameraDevice[] = [];\n\n if (frontDevices.length > 0) {\n result.push({\n deviceId: frontDevices[0].deviceId,\n label: \"Front Camera\",\n position: \"front\",\n lenses: frontDevices,\n isLogical: false,\n minZoom: Math.min(...frontDevices.map((d) => d.minZoom)),\n maxZoom: Math.max(...frontDevices.map((d) => d.maxZoom)),\n });\n }\n\n if (backDevices.length > 0) {\n result.push({\n deviceId: backDevices[0].deviceId,\n label: \"Back Camera\",\n position: \"rear\",\n lenses: backDevices,\n isLogical: false,\n minZoom: Math.min(...backDevices.map((d) => d.minZoom)),\n maxZoom: Math.max(...backDevices.map((d) => d.maxZoom)),\n });\n }\n\n return { devices: result };\n }\n\n async getZoom(): Promise<{\n min: number;\n max: number;\n current: number;\n lens: LensInfo;\n }> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n const stream = video.srcObject as MediaStream;\n const videoTrack = stream.getVideoTracks()[0];\n\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n\n const capabilities = videoTrack.getCapabilities() as any;\n const settings = videoTrack.getSettings() as any;\n\n if (!capabilities.zoom) {\n throw new Error(\"zoom not supported by this device\");\n }\n\n // Get current device info to determine lens type\n let deviceType: DeviceType = DeviceType.WIDE_ANGLE;\n let baseZoomRatio = 1.0;\n\n if (this.currentDeviceId) {\n const devices = await navigator.mediaDevices.enumerateDevices();\n const device = devices.find((d) => d.deviceId === this.currentDeviceId);\n if (device) {\n const labelLower = device.label.toLowerCase();\n if (labelLower.includes(\"ultra\") || labelLower.includes(\"0.5\")) {\n deviceType = DeviceType.ULTRA_WIDE;\n baseZoomRatio = 0.5;\n } else if (\n labelLower.includes(\"telephoto\") ||\n labelLower.includes(\"tele\") ||\n labelLower.includes(\"2x\") ||\n labelLower.includes(\"3x\")\n ) {\n deviceType = DeviceType.TELEPHOTO;\n baseZoomRatio = 2.0;\n } else if (\n labelLower.includes(\"depth\") ||\n labelLower.includes(\"truedepth\")\n ) {\n deviceType = DeviceType.TRUE_DEPTH;\n baseZoomRatio = 1.0;\n }\n }\n }\n\n const currentZoom = settings.zoom || 1;\n const lensInfo: LensInfo = {\n focalLength: 4.25,\n deviceType,\n baseZoomRatio,\n digitalZoom: currentZoom / baseZoomRatio,\n };\n\n return {\n min: capabilities.zoom.min || 1,\n max: capabilities.zoom.max || 1,\n current: currentZoom,\n lens: lensInfo,\n };\n }\n\n async setZoom(options: {\n level: number;\n ramp?: boolean;\n autoFocus?: boolean;\n }): Promise<void> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n const stream = video.srcObject as MediaStream;\n const videoTrack = stream.getVideoTracks()[0];\n\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n\n const capabilities = videoTrack.getCapabilities() as any;\n\n if (!capabilities.zoom) {\n throw new Error(\"zoom not supported by this device\");\n }\n\n const zoomLevel = Math.max(\n capabilities.zoom.min || 1,\n Math.min(capabilities.zoom.max || 1, options.level),\n );\n\n // Note: autoFocus is not supported on web platform\n\n try {\n await videoTrack.applyConstraints({\n advanced: [{ zoom: zoomLevel } as any],\n });\n } catch (error) {\n throw new Error(`Failed to set zoom: ${error}`);\n }\n }\n\n async getFlashMode(): Promise<{ flashMode: FlashMode }> {\n throw new Error(\"getFlashMode not supported under the web platform\");\n }\n\n async getDeviceId(): Promise<{ deviceId: string }> {\n return { deviceId: this.currentDeviceId || \"\" };\n }\n\n async setDeviceId(options: { deviceId: string }): Promise<void> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n // Stop current stream\n this.stopStream(video.srcObject);\n\n // Update current device ID\n this.currentDeviceId = options.deviceId;\n\n // Get new constraints with specific device ID\n const constraints: MediaStreamConstraints = {\n video: {\n deviceId: { exact: options.deviceId },\n width: { ideal: video.videoWidth || 640 },\n height: { ideal: video.videoHeight || 480 },\n },\n };\n\n try {\n // Try to determine camera position from device\n const devices = await navigator.mediaDevices.enumerateDevices();\n const device = devices.find((d) => d.deviceId === options.deviceId);\n this.isBackCamera =\n device?.label.toLowerCase().includes(\"back\") ||\n device?.label.toLowerCase().includes(\"rear\") ||\n false;\n\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n video.srcObject = stream;\n\n // Update video transform based on camera\n if (this.isBackCamera) {\n video.style.transform = \"none\";\n video.style.webkitTransform = \"none\";\n } else {\n video.style.transform = \"scaleX(-1)\";\n video.style.webkitTransform = \"scaleX(-1)\";\n }\n\n await video.play();\n } catch (error) {\n throw new Error(`Failed to swap to device ${options.deviceId}: ${error}`);\n }\n }\n\n async getAspectRatio(): Promise<{ aspectRatio: \"4:3\" | \"16:9\" }> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n\n const width = video.offsetWidth;\n const height = video.offsetHeight;\n\n if (width && height) {\n const ratio = width / height;\n // Check for portrait camera ratios: 4:3 -> 3:4, 16:9 -> 9:16\n if (Math.abs(ratio - 3 / 4) < 0.01) {\n return { aspectRatio: \"4:3\" };\n }\n if (Math.abs(ratio - 9 / 16) < 0.01) {\n return { aspectRatio: \"16:9\" };\n }\n }\n\n // Default to 4:3 if no specific aspect ratio is matched\n return { aspectRatio: \"4:3\" };\n }\n\n async 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 const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n\n if (options.aspectRatio) {\n const [widthRatio, heightRatio] = options.aspectRatio\n .split(\":\")\n .map(Number);\n // For camera, use portrait orientation: 4:3 becomes 3:4, 16:9 becomes 9:16\n const ratio = heightRatio / widthRatio;\n\n // Get current position and size\n const rect = video.getBoundingClientRect();\n const currentWidth = rect.width;\n const currentHeight = rect.height;\n const currentRatio = currentWidth / currentHeight;\n\n let newWidth: number;\n let newHeight: number;\n\n if (currentRatio > ratio) {\n // Width is larger, fit by height and center horizontally\n newWidth = currentHeight * ratio;\n newHeight = currentHeight;\n } else {\n // Height is larger, fit by width and center vertically\n newWidth = currentWidth;\n newHeight = currentWidth / ratio;\n }\n\n // Calculate position\n let x: number, y: number;\n if (options.x !== undefined && options.y !== undefined) {\n // Use provided coordinates, ensuring they stay within screen boundaries\n x = Math.max(0, Math.min(options.x, window.innerWidth - newWidth));\n y = Math.max(0, Math.min(options.y, window.innerHeight - newHeight));\n } else {\n // Auto-center the view\n x = (window.innerWidth - newWidth) / 2;\n y = (window.innerHeight - newHeight) / 2;\n }\n\n video.style.width = `${newWidth}px`;\n video.style.height = `${newHeight}px`;\n video.style.left = `${x}px`;\n video.style.top = `${y}px`;\n video.style.position = \"absolute\";\n\n const offsetX = newWidth / 8;\n const offsetY = newHeight / 8;\n\n return {\n width: Math.round(newWidth),\n height: Math.round(newHeight),\n x: Math.round(x + offsetX),\n y: Math.round(y + offsetY),\n };\n } else {\n video.style.objectFit = \"cover\";\n const rect = video.getBoundingClientRect();\n const offsetX = rect.width / 8;\n const offsetY = rect.height / 8;\n\n return {\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n x: Math.round(rect.left + offsetX),\n y: Math.round(rect.top + offsetY),\n };\n }\n }\n\n private createGridOverlay(gridMode: string): HTMLElement {\n const overlay = document.createElement(\"div\");\n overlay.style.position = \"absolute\";\n overlay.style.top = \"0\";\n overlay.style.left = \"0\";\n overlay.style.width = \"100%\";\n overlay.style.height = \"100%\";\n overlay.style.pointerEvents = \"none\";\n overlay.style.zIndex = \"10\";\n\n const divisions = gridMode === \"3x3\" ? 3 : 4;\n\n // Create SVG for grid lines\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.style.width = \"100%\";\n svg.style.height = \"100%\";\n svg.style.position = \"absolute\";\n svg.style.top = \"0\";\n svg.style.left = \"0\";\n\n // Create grid lines\n for (let i = 1; i < divisions; i++) {\n // Vertical lines\n const verticalLine = document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"line\",\n );\n verticalLine.setAttribute(\"x1\", `${(i / divisions) * 100}%`);\n verticalLine.setAttribute(\"y1\", \"0%\");\n verticalLine.setAttribute(\"x2\", `${(i / divisions) * 100}%`);\n verticalLine.setAttribute(\"y2\", \"100%\");\n verticalLine.setAttribute(\"stroke\", \"rgba(255, 255, 255, 0.5)\");\n verticalLine.setAttribute(\"stroke-width\", \"1\");\n svg.appendChild(verticalLine);\n\n // Horizontal lines\n const horizontalLine = document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"line\",\n );\n horizontalLine.setAttribute(\"x1\", \"0%\");\n horizontalLine.setAttribute(\"y1\", `${(i / divisions) * 100}%`);\n horizontalLine.setAttribute(\"x2\", \"100%\");\n horizontalLine.setAttribute(\"y2\", `${(i / divisions) * 100}%`);\n horizontalLine.setAttribute(\"stroke\", \"rgba(255, 255, 255, 0.5)\");\n horizontalLine.setAttribute(\"stroke-width\", \"1\");\n svg.appendChild(horizontalLine);\n }\n\n overlay.appendChild(svg);\n return overlay;\n }\n\n async setGridMode(options: { gridMode: GridMode }): Promise<void> {\n // Web implementation of grid mode would need to be implemented\n // For now, just resolve as a no-op\n console.warn(\n `Grid mode '${options.gridMode}' is not yet implemented for web platform`,\n );\n }\n\n async getGridMode(): Promise<{ gridMode: GridMode }> {\n // Web implementation - default to none\n return { gridMode: \"none\" };\n }\n\n async getPreviewSize(): Promise<{\n x: number;\n y: number;\n width: number;\n height: number;\n }> {\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n const offsetX = video.width / 8;\n const offsetY = video.height / 8;\n\n return {\n x: video.offsetLeft + offsetX,\n y: video.offsetTop + offsetY,\n width: video.width,\n height: video.height,\n };\n }\n async 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 const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n video.style.left = `${options.x}px`;\n video.style.top = `${options.y}px`;\n video.width = options.width;\n video.height = options.height;\n\n const offsetX = options.width / 8;\n const offsetY = options.height / 8;\n\n return {\n width: options.width,\n height: options.height,\n x: options.x + offsetX,\n y: options.y + offsetY,\n };\n }\n\n async setFocus(options: { x: number; y: number }): Promise<void> {\n // Reject if values are outside 0-1 range\n if (options.x < 0 || options.x > 1 || options.y < 0 || options.y > 1) {\n throw new Error(\"Focus coordinates must be between 0 and 1\");\n }\n\n const video = document.getElementById(DEFAULT_VIDEO_ID) as HTMLVideoElement;\n if (!video?.srcObject) {\n throw new Error(\"camera is not running\");\n }\n\n const stream = video.srcObject as MediaStream;\n const videoTrack = stream.getVideoTracks()[0];\n\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n\n const capabilities = videoTrack.getCapabilities() as any;\n\n // Check if focusing is supported\n if (capabilities.focusMode) {\n try {\n // Web API supports focus mode settings but not coordinate-based focus\n // Setting to manual mode allows for coordinate focus if supported\n await videoTrack.applyConstraints({\n advanced: [\n {\n focusMode: \"manual\",\n focusDistance: 0.5, // Mid-range focus as fallback\n } as any,\n ],\n });\n } catch (error) {\n console.warn(\n `setFocus is not fully supported on this device: ${error}. Focus coordinates (${options.x}, ${options.y}) were provided but cannot be applied.`,\n );\n }\n } else {\n console.warn(\n \"Focus control is not supported on this device. Focus coordinates were provided but cannot be applied.\",\n );\n }\n }\n\n // Exposure stubs (unsupported on web)\n async getExposureModes(): Promise<{ modes: ExposureMode[] }> {\n throw new Error(\"getExposureModes not supported under the web platform\");\n }\n\n async getExposureMode(): Promise<{ mode: ExposureMode }> {\n throw new Error(\"getExposureMode not supported under the web platform\");\n }\n\n async setExposureMode(_options: { mode: ExposureMode }): Promise<void> {\n throw new Error(\"setExposureMode not supported under the web platform\");\n }\n\n async getExposureCompensationRange(): Promise<{\n min: number;\n max: number;\n step: number;\n }> {\n throw new Error(\n \"getExposureCompensationRange not supported under the web platform\",\n );\n }\n\n async getExposureCompensation(): Promise<{ value: number }> {\n throw new Error(\n \"getExposureCompensation not supported under the web platform\",\n );\n }\n\n async setExposureCompensation(_options: { value: number }): Promise<void> {\n throw new Error(\n \"setExposureCompensation not supported under the web platform\",\n );\n }\n\n async deleteFile(_options: { path: string }): Promise<{ success: boolean }> {\n // Mark parameter as intentionally unused to satisfy linter\n void _options;\n throw new Error(\"deleteFile not supported under the web platform\");\n }\n}\n"]}
@@ -1006,6 +1006,25 @@ class CameraPreviewWeb extends core.WebPlugin {
1006
1006
  console.warn("Focus control is not supported on this device. Focus coordinates were provided but cannot be applied.");
1007
1007
  }
1008
1008
  }
1009
+ // Exposure stubs (unsupported on web)
1010
+ async getExposureModes() {
1011
+ throw new Error("getExposureModes not supported under the web platform");
1012
+ }
1013
+ async getExposureMode() {
1014
+ throw new Error("getExposureMode not supported under the web platform");
1015
+ }
1016
+ async setExposureMode(_options) {
1017
+ throw new Error("setExposureMode not supported under the web platform");
1018
+ }
1019
+ async getExposureCompensationRange() {
1020
+ throw new Error("getExposureCompensationRange not supported under the web platform");
1021
+ }
1022
+ async getExposureCompensation() {
1023
+ throw new Error("getExposureCompensation not supported under the web platform");
1024
+ }
1025
+ async setExposureCompensation(_options) {
1026
+ throw new Error("setExposureCompensation not supported under the web platform");
1027
+ }
1009
1028
  async deleteFile(_options) {
1010
1029
  throw new Error("deleteFile not supported under the web platform");
1011
1030
  }