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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +195 -31
  2. package/android/.gradle/8.14.2/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.14.2/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/8.14.2/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/8.14.2/executionHistory/executionHistory.bin +0 -0
  6. package/android/.gradle/8.14.2/executionHistory/executionHistory.lock +0 -0
  7. package/android/.gradle/8.14.2/fileHashes/fileHashes.bin +0 -0
  8. package/android/.gradle/8.14.2/fileHashes/fileHashes.lock +0 -0
  9. package/android/.gradle/8.14.2/fileHashes/resourceHashesCache.bin +0 -0
  10. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  11. package/android/.gradle/file-system.probe +0 -0
  12. package/android/build.gradle +3 -1
  13. package/android/src/main/AndroidManifest.xml +5 -3
  14. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +473 -88
  15. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +2065 -704
  16. package/android/src/main/java/com/ahm/capacitor/camera/preview/GridOverlayView.java +95 -0
  17. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraDevice.java +55 -46
  18. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraLens.java +61 -52
  19. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraSessionConfiguration.java +152 -59
  20. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/LensInfo.java +29 -23
  21. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/ZoomFactors.java +24 -23
  22. package/dist/docs.json +235 -6
  23. package/dist/esm/definitions.d.ts +119 -3
  24. package/dist/esm/definitions.js.map +1 -1
  25. package/dist/esm/web.d.ts +47 -3
  26. package/dist/esm/web.js +297 -96
  27. package/dist/esm/web.js.map +1 -1
  28. package/dist/plugin.cjs.js +293 -96
  29. package/dist/plugin.cjs.js.map +1 -1
  30. package/dist/plugin.js +293 -96
  31. package/dist/plugin.js.map +1 -1
  32. package/ios/Sources/CapgoCameraPreview/CameraController.swift +364 -218
  33. package/ios/Sources/CapgoCameraPreview/GridOverlayView.swift +65 -0
  34. package/ios/Sources/CapgoCameraPreview/Plugin.swift +886 -242
  35. package/package.json +1 -1
package/dist/docs.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "methods": [
8
8
  {
9
9
  "name": "start",
10
- "signature": "(options: CameraPreviewOptions) => Promise<void>",
10
+ "signature": "(options: CameraPreviewOptions) => Promise<{ width: number; height: number; x: number; y: number; }>",
11
11
  "parameters": [
12
12
  {
13
13
  "name": "options",
@@ -15,7 +15,7 @@
15
15
  "type": "CameraPreviewOptions"
16
16
  }
17
17
  ],
18
- "returns": "Promise<void>",
18
+ "returns": "Promise<{ width: number; height: number; x: number; y: number; }>",
19
19
  "tags": [
20
20
  {
21
21
  "name": "param",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  {
25
25
  "name": "returns",
26
- "text": "A promise that resolves when the camera preview is started."
26
+ "text": "A promise that resolves with the preview dimensions."
27
27
  },
28
28
  {
29
29
  "name": "since",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  {
59
59
  "name": "capture",
60
- "signature": "(options: CameraPreviewPictureOptions) => Promise<{ value: string; }>",
60
+ "signature": "(options: CameraPreviewPictureOptions) => Promise<{ value: string; exif: ExifData; }>",
61
61
  "parameters": [
62
62
  {
63
63
  "name": "options",
@@ -65,7 +65,7 @@
65
65
  "type": "CameraPreviewPictureOptions"
66
66
  }
67
67
  ],
68
- "returns": "Promise<{ value: string; }>",
68
+ "returns": "Promise<{ value: string; exif: ExifData; }>",
69
69
  "tags": [
70
70
  {
71
71
  "name": "param",
@@ -82,6 +82,7 @@
82
82
  ],
83
83
  "docs": "Captures a picture from the camera.",
84
84
  "complexTypes": [
85
+ "ExifData",
85
86
  "CameraPreviewPictureOptions"
86
87
  ],
87
88
  "slug": "capture"
@@ -138,6 +139,106 @@
138
139
  ],
139
140
  "slug": "getsupportedflashmodes"
140
141
  },
142
+ {
143
+ "name": "setAspectRatio",
144
+ "signature": "(options: { aspectRatio: \"4:3\" | \"16:9\"; x?: number; y?: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>",
145
+ "parameters": [
146
+ {
147
+ "name": "options",
148
+ "docs": "- 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.",
149
+ "type": "{ aspectRatio: '4:3' | '16:9'; x?: number | undefined; y?: number | undefined; }"
150
+ }
151
+ ],
152
+ "returns": "Promise<{ width: number; height: number; x: number; y: number; }>",
153
+ "tags": [
154
+ {
155
+ "name": "param",
156
+ "text": "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."
157
+ },
158
+ {
159
+ "name": "returns",
160
+ "text": "A promise that resolves with the actual preview dimensions and position."
161
+ },
162
+ {
163
+ "name": "since",
164
+ "text": "7.4.0"
165
+ }
166
+ ],
167
+ "docs": "Set the aspect ratio of the camera preview.",
168
+ "complexTypes": [],
169
+ "slug": "setaspectratio"
170
+ },
171
+ {
172
+ "name": "getAspectRatio",
173
+ "signature": "() => Promise<{ aspectRatio: \"4:3\" | \"16:9\"; }>",
174
+ "parameters": [],
175
+ "returns": "Promise<{ aspectRatio: '4:3' | '16:9'; }>",
176
+ "tags": [
177
+ {
178
+ "name": "returns",
179
+ "text": "A promise that resolves with the current aspect ratio."
180
+ },
181
+ {
182
+ "name": "since",
183
+ "text": "7.4.0"
184
+ }
185
+ ],
186
+ "docs": "Gets the current aspect ratio of the camera preview.",
187
+ "complexTypes": [],
188
+ "slug": "getaspectratio"
189
+ },
190
+ {
191
+ "name": "setGridMode",
192
+ "signature": "(options: { gridMode: GridMode; }) => Promise<void>",
193
+ "parameters": [
194
+ {
195
+ "name": "options",
196
+ "docs": "- The desired grid mode ('none', '3x3', or '4x4').",
197
+ "type": "{ gridMode: GridMode; }"
198
+ }
199
+ ],
200
+ "returns": "Promise<void>",
201
+ "tags": [
202
+ {
203
+ "name": "param",
204
+ "text": "options - The desired grid mode ('none', '3x3', or '4x4')."
205
+ },
206
+ {
207
+ "name": "returns",
208
+ "text": "A promise that resolves when the grid mode is set."
209
+ },
210
+ {
211
+ "name": "since",
212
+ "text": "8.0.0"
213
+ }
214
+ ],
215
+ "docs": "Sets the grid mode of the camera preview overlay.",
216
+ "complexTypes": [
217
+ "GridMode"
218
+ ],
219
+ "slug": "setgridmode"
220
+ },
221
+ {
222
+ "name": "getGridMode",
223
+ "signature": "() => Promise<{ gridMode: GridMode; }>",
224
+ "parameters": [],
225
+ "returns": "Promise<{ gridMode: GridMode; }>",
226
+ "tags": [
227
+ {
228
+ "name": "returns",
229
+ "text": "A promise that resolves with the current grid mode."
230
+ },
231
+ {
232
+ "name": "since",
233
+ "text": "8.0.0"
234
+ }
235
+ ],
236
+ "docs": "Gets the current grid mode of the camera preview overlay.",
237
+ "complexTypes": [
238
+ "GridMode"
239
+ ],
240
+ "slug": "getgridmode"
241
+ },
141
242
  {
142
243
  "name": "getHorizontalFov",
143
244
  "signature": "() => Promise<{ result: number; }>",
@@ -482,6 +583,45 @@
482
583
  "docs": "Gets the ID of the currently active camera device.",
483
584
  "complexTypes": [],
484
585
  "slug": "getdeviceid"
586
+ },
587
+ {
588
+ "name": "getPreviewSize",
589
+ "signature": "() => Promise<{ x: number; y: number; width: number; height: number; }>",
590
+ "parameters": [],
591
+ "returns": "Promise<{ x: number; y: number; width: number; height: number; }>",
592
+ "tags": [
593
+ {
594
+ "name": "returns"
595
+ }
596
+ ],
597
+ "docs": "Gets the current preview size and position.",
598
+ "complexTypes": [],
599
+ "slug": "getpreviewsize"
600
+ },
601
+ {
602
+ "name": "setPreviewSize",
603
+ "signature": "(options: { x: number; y: number; width: number; height: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>",
604
+ "parameters": [
605
+ {
606
+ "name": "options",
607
+ "docs": "The new position and dimensions.",
608
+ "type": "{ x: number; y: number; width: number; height: number; }"
609
+ }
610
+ ],
611
+ "returns": "Promise<{ width: number; height: number; x: number; y: number; }>",
612
+ "tags": [
613
+ {
614
+ "name": "param",
615
+ "text": "options The new position and dimensions."
616
+ },
617
+ {
618
+ "name": "returns",
619
+ "text": "A promise that resolves with the actual preview dimensions and position."
620
+ }
621
+ ],
622
+ "docs": "Sets the preview size and position.",
623
+ "complexTypes": [],
624
+ "slug": "setpreviewsize"
485
625
  }
486
626
  ],
487
627
  "properties": []
@@ -566,6 +706,36 @@
566
706
  "complexTypes": [],
567
707
  "type": "number | undefined"
568
708
  },
709
+ {
710
+ "name": "aspectRatio",
711
+ "tags": [
712
+ {
713
+ "text": "2.0.0",
714
+ "name": "since"
715
+ }
716
+ ],
717
+ "docs": "The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\nCannot be set if width or height is provided, otherwise the call will be rejected.\nUse setPreviewSize to adjust size after starting.",
718
+ "complexTypes": [],
719
+ "type": "'4:3' | '16:9' | undefined"
720
+ },
721
+ {
722
+ "name": "gridMode",
723
+ "tags": [
724
+ {
725
+ "text": "\"none\"",
726
+ "name": "default"
727
+ },
728
+ {
729
+ "text": "2.1.0",
730
+ "name": "since"
731
+ }
732
+ ],
733
+ "docs": "The grid overlay to display on the camera preview.",
734
+ "complexTypes": [
735
+ "GridMode"
736
+ ],
737
+ "type": "GridMode"
738
+ },
569
739
  {
570
740
  "name": "includeSafeAreaInsets",
571
741
  "tags": [
@@ -688,7 +858,7 @@
688
858
  "name": "disableAudio",
689
859
  "tags": [
690
860
  {
691
- "text": "false",
861
+ "text": "true",
692
862
  "name": "default"
693
863
  }
694
864
  ],
@@ -774,6 +944,14 @@
774
944
  }
775
945
  ]
776
946
  },
947
+ {
948
+ "name": "ExifData",
949
+ "slug": "exifdata",
950
+ "docs": "Represents EXIF data extracted from an image.",
951
+ "tags": [],
952
+ "methods": [],
953
+ "properties": []
954
+ },
777
955
  {
778
956
  "name": "CameraPreviewPictureOptions",
779
957
  "slug": "camerapreviewpictureoptions",
@@ -820,6 +998,38 @@
820
998
  "PictureFormat"
821
999
  ],
822
1000
  "type": "PictureFormat"
1001
+ },
1002
+ {
1003
+ "name": "saveToGallery",
1004
+ "tags": [
1005
+ {
1006
+ "text": "false",
1007
+ "name": "default"
1008
+ },
1009
+ {
1010
+ "text": "7.5.0",
1011
+ "name": "since"
1012
+ }
1013
+ ],
1014
+ "docs": "If true, the captured image will be saved to the user's gallery.",
1015
+ "complexTypes": [],
1016
+ "type": "boolean | undefined"
1017
+ },
1018
+ {
1019
+ "name": "withExifLocation",
1020
+ "tags": [
1021
+ {
1022
+ "text": "false",
1023
+ "name": "default"
1024
+ },
1025
+ {
1026
+ "text": "7.6.0",
1027
+ "name": "since"
1028
+ }
1029
+ ],
1030
+ "docs": "If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.\nThis may prompt the user for location permissions.",
1031
+ "complexTypes": [],
1032
+ "type": "boolean | undefined"
823
1033
  }
824
1034
  ]
825
1035
  },
@@ -1119,6 +1329,25 @@
1119
1329
  }
1120
1330
  ],
1121
1331
  "typeAliases": [
1332
+ {
1333
+ "name": "GridMode",
1334
+ "slug": "gridmode",
1335
+ "docs": "",
1336
+ "types": [
1337
+ {
1338
+ "text": "\"none\"",
1339
+ "complexTypes": []
1340
+ },
1341
+ {
1342
+ "text": "\"3x3\"",
1343
+ "complexTypes": []
1344
+ },
1345
+ {
1346
+ "text": "\"4x4\"",
1347
+ "complexTypes": []
1348
+ }
1349
+ ]
1350
+ },
1122
1351
  {
1123
1352
  "name": "CameraPosition",
1124
1353
  "slug": "cameraposition",
@@ -1,5 +1,6 @@
1
1
  export type CameraPosition = "rear" | "front";
2
2
  export type FlashMode = CameraPreviewFlashMode;
3
+ export type GridMode = "none" | "3x3" | "4x4";
3
4
  export declare enum DeviceType {
4
5
  ULTRA_WIDE = "ultraWide",
5
6
  WIDE_ANGLE = "wideAngle",
@@ -92,6 +93,20 @@ export interface CameraPreviewOptions {
92
93
  * @platform android, ios
93
94
  */
94
95
  y?: number;
96
+ /**
97
+ * The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.
98
+ * Cannot be set if width or height is provided, otherwise the call will be rejected.
99
+ * Use setPreviewSize to adjust size after starting.
100
+ *
101
+ * @since 2.0.0
102
+ */
103
+ aspectRatio?: "4:3" | "16:9";
104
+ /**
105
+ * The grid overlay to display on the camera preview.
106
+ * @default "none"
107
+ * @since 2.1.0
108
+ */
109
+ gridMode?: GridMode;
95
110
  /**
96
111
  * Adjusts the y-position to account for safe areas (e.g., notches).
97
112
  * @platform ios
@@ -140,7 +155,7 @@ export interface CameraPreviewOptions {
140
155
  enableHighResolution?: boolean;
141
156
  /**
142
157
  * If true, disables the audio stream, preventing audio permission requests.
143
- * @default false
158
+ * @default true
144
159
  */
145
160
  disableAudio?: boolean;
146
161
  /**
@@ -192,6 +207,23 @@ export interface CameraPreviewPictureOptions {
192
207
  * @default "jpeg"
193
208
  */
194
209
  format?: PictureFormat;
210
+ /**
211
+ * If true, the captured image will be saved to the user's gallery.
212
+ * @default false
213
+ * @since 7.5.0
214
+ */
215
+ saveToGallery?: boolean;
216
+ /**
217
+ * If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.
218
+ * This may prompt the user for location permissions.
219
+ * @default false
220
+ * @since 7.6.0
221
+ */
222
+ withExifLocation?: boolean;
223
+ }
224
+ /** Represents EXIF data extracted from an image. */
225
+ export interface ExifData {
226
+ [key: string]: any;
195
227
  }
196
228
  export type PictureFormat = "jpeg" | "png";
197
229
  /** Defines a standard picture size with width and height. */
@@ -241,10 +273,19 @@ export interface CameraPreviewPlugin {
241
273
  * Starts the camera preview.
242
274
  *
243
275
  * @param {CameraPreviewOptions} options - The configuration for the camera preview.
244
- * @returns {Promise<void>} A promise that resolves when the camera preview is started.
276
+ * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the preview dimensions.
245
277
  * @since 0.0.1
246
278
  */
247
- start(options: CameraPreviewOptions): Promise<void>;
279
+ start(options: CameraPreviewOptions): Promise<{
280
+ /** The width of the preview in pixels. */
281
+ width: number;
282
+ /** The height of the preview in pixels. */
283
+ height: number;
284
+ /** The horizontal origin of the preview, in pixels. */
285
+ x: number;
286
+ /** The vertical origin of the preview, in pixels. */
287
+ y: number;
288
+ }>;
248
289
  /**
249
290
  * Stops the camera preview.
250
291
  *
@@ -262,6 +303,7 @@ export interface CameraPreviewPlugin {
262
303
  */
263
304
  capture(options: CameraPreviewPictureOptions): Promise<{
264
305
  value: string;
306
+ exif: ExifData;
265
307
  }>;
266
308
  /**
267
309
  * Captures a single frame from the camera preview stream.
@@ -282,6 +324,54 @@ export interface CameraPreviewPlugin {
282
324
  getSupportedFlashModes(): Promise<{
283
325
  result: CameraPreviewFlashMode[];
284
326
  }>;
327
+ /**
328
+ * Set the aspect ratio of the camera preview.
329
+ *
330
+ * @param {{ aspectRatio: '4:3' | '16:9'; x?: number; y?: number }} options - The desired aspect ratio and optional position.
331
+ * - aspectRatio: The desired aspect ratio ('4:3' or '16:9')
332
+ * - x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.
333
+ * - y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.
334
+ * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.
335
+ * @since 7.4.0
336
+ */
337
+ setAspectRatio(options: {
338
+ aspectRatio: "4:3" | "16:9";
339
+ x?: number;
340
+ y?: number;
341
+ }): Promise<{
342
+ width: number;
343
+ height: number;
344
+ x: number;
345
+ y: number;
346
+ }>;
347
+ /**
348
+ * Gets the current aspect ratio of the camera preview.
349
+ *
350
+ * @returns {Promise<{ aspectRatio: '4:3' | '16:9' }>} A promise that resolves with the current aspect ratio.
351
+ * @since 7.4.0
352
+ */
353
+ getAspectRatio(): Promise<{
354
+ aspectRatio: "4:3" | "16:9";
355
+ }>;
356
+ /**
357
+ * Sets the grid mode of the camera preview overlay.
358
+ *
359
+ * @param {{ gridMode: GridMode }} options - The desired grid mode ('none', '3x3', or '4x4').
360
+ * @returns {Promise<void>} A promise that resolves when the grid mode is set.
361
+ * @since 8.0.0
362
+ */
363
+ setGridMode(options: {
364
+ gridMode: GridMode;
365
+ }): Promise<void>;
366
+ /**
367
+ * Gets the current grid mode of the camera preview overlay.
368
+ *
369
+ * @returns {Promise<{ gridMode: GridMode }>} A promise that resolves with the current grid mode.
370
+ * @since 8.0.0
371
+ */
372
+ getGridMode(): Promise<{
373
+ gridMode: GridMode;
374
+ }>;
285
375
  /**
286
376
  * Gets the horizontal field of view (FoV) for the active camera.
287
377
  * Note: This can be an estimate on some devices.
@@ -418,4 +508,30 @@ export interface CameraPreviewPlugin {
418
508
  getDeviceId(): Promise<{
419
509
  deviceId: string;
420
510
  }>;
511
+ /**
512
+ * Gets the current preview size and position.
513
+ * @returns {Promise<{x: number, y: number, width: number, height: number}>}
514
+ */
515
+ getPreviewSize(): Promise<{
516
+ x: number;
517
+ y: number;
518
+ width: number;
519
+ height: number;
520
+ }>;
521
+ /**
522
+ * Sets the preview size and position.
523
+ * @param options The new position and dimensions.
524
+ * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.
525
+ */
526
+ setPreviewSize(options: {
527
+ x: number;
528
+ y: number;
529
+ width: number;
530
+ height: number;
531
+ }): Promise<{
532
+ width: number;
533
+ height: number;
534
+ x: number;
535
+ y: number;
536
+ }>;
421
537
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,sCAAwB,CAAA;IACxB,sCAAwB,CAAA;IACxB,qCAAuB,CAAA;IACvB,sCAAwB,CAAA;IACxB,2BAAa,CAAA;IACb,oCAAsB,CAAA;IACtB,+BAAiB,CAAA;AACnB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB","sourcesContent":["export type CameraPosition = \"rear\" | \"front\";\n\nexport type FlashMode = CameraPreviewFlashMode;\n\nexport 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 * Adjusts the y-position to account for safe areas (e.g., notches).\n * @platform ios\n * @default false\n */\n includeSafeAreaInsets?: boolean;\n /** \n * If true, places the preview behind the webview.\n * @platform android\n * @default true\n */\n toBack?: boolean;\n /** \n * Bottom padding for the preview, in pixels.\n * @platform android, ios\n */\n paddingBottom?: number;\n /** \n * Whether to rotate the preview when the device orientation changes.\n * @platform ios\n * @default true\n */\n rotateWhenOrientationChanged?: boolean;\n /** \n * The camera to use.\n * @default \"rear\"\n */\n position?: CameraPosition | string;\n /** \n * If true, saves the captured image to a file and returns the file path.\n * If false, returns a base64 encoded string.\n * @default false\n */\n storeToFile?: boolean;\n /** \n * If true, prevents the plugin from rotating the image based on EXIF data.\n * @platform android\n * @default false\n */\n disableExifHeaderStripping?: boolean;\n /** \n * If true, enables high-resolution image capture.\n * @platform ios\n * @default false\n */\n enableHighResolution?: boolean;\n /** \n * If true, disables the audio stream, preventing audio permission requests.\n * @default false\n */\n disableAudio?: boolean;\n /** \n * If true, locks the device orientation while the camera is active.\n * @platform android\n * @default false\n */\n lockAndroidOrientation?: boolean;\n /** \n * If true, allows the camera preview's opacity to be changed.\n * @platform android, web\n * @default false\n */\n enableOpacity?: boolean;\n /** \n * If true, enables pinch-to-zoom functionality on the preview.\n * @platform android\n * @default false\n */\n enableZoom?: boolean;\n /** \n * If true, uses the video-optimized preset for the camera session.\n * @platform ios\n * @default false\n */\n enableVideoMode?: boolean;\n /** \n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /** The desired height of the picture in pixels. If not provided, the device default is used. */\n height?: number;\n /** The desired width of the picture in pixels. If not provided, the device default is used. */\n width?: number;\n /** \n * The quality of the captured image, from 0 to 100.\n * Does not apply to `png` format.\n * @default 85\n */\n quality?: number;\n /** \n * The format of the captured image.\n * @default \"jpeg\"\n */\n format?: PictureFormat;\n}\n\nexport type PictureFormat = \"jpeg\" | \"png\";\n\n/** Defines a standard picture size with width and height. */\nexport interface PictureSize {\n /** The width of the picture in pixels. */\n width: number;\n /** The height of the picture in pixels. */\n height: number;\n}\n\n/** Represents the supported picture sizes for a camera facing a certain direction. */\nexport interface SupportedPictureSizes {\n /** The camera direction (\"front\" or \"rear\"). */\n facing: string;\n /** A list of supported picture sizes for this camera. */\n supportedPictureSizes: PictureSize[];\n}\n\n/**\n * Defines the options for capturing a sample frame from the camera preview.\n */\nexport interface CameraSampleOptions {\n /** \n * The quality of the captured sample, from 0 to 100.\n * @default 85\n */\n quality?: number;\n}\n\n/**\n * The available flash modes for the camera.\n * 'torch' is a continuous light mode.\n */\nexport type CameraPreviewFlashMode =\n | \"off\"\n | \"on\"\n | \"auto\"\n | \"torch\";\n\n/**\n * Defines the options for setting the camera preview's opacity.\n */\nexport interface CameraOpacityOptions {\n /** \n * The opacity percentage, from 0.0 (fully transparent) to 1.0 (fully opaque).\n * @default 1.0\n */\n opacity?: number;\n}\n\n/**\n * The main interface for the CameraPreview plugin.\n */\nexport interface CameraPreviewPlugin {\n /**\n * Starts the camera preview.\n *\n * @param {CameraPreviewOptions} options - The configuration for the camera preview.\n * @returns {Promise<void>} A promise that resolves when the camera preview is started.\n * @since 0.0.1\n */\n start(options: CameraPreviewOptions): Promise<void>;\n\n /**\n * Stops the camera preview.\n *\n * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * @param {CameraPreviewPictureOptions} options - The options for capturing the picture.\n * @returns {Promise<{ value: string }>} A promise that resolves with the captured image data.\n * The `value` is a base64 encoded string unless `storeToFile` is true, in which case it's a file path.\n * @since 0.0.1\n */\n capture(options: CameraPreviewPictureOptions): Promise<{ value: string }>;\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 * Gets the horizontal field of view (FoV) for the active camera.\n * Note: This can be an estimate on some devices.\n *\n * @returns {Promise<{ result: number }>} A promise that resolves with the horizontal field of view in degrees.\n * @since 0.0.1\n */\n getHorizontalFov(): Promise<{\n result: number;\n }>;\n\n /**\n * Gets the supported picture sizes for all cameras.\n *\n * @returns {Promise<{ supportedPictureSizes: SupportedPictureSizes[] }>} A promise that resolves with the list of supported sizes.\n * @since 7.4.0\n */\n getSupportedPictureSizes(): Promise<{\n supportedPictureSizes: SupportedPictureSizes[];\n }>;\n\n /**\n * Sets the flash mode for the active camera.\n *\n * @param {{ flashMode: CameraPreviewFlashMode | string }} options - The desired flash mode.\n * @returns {Promise<void>} A promise that resolves when the flash mode is set.\n * @since 0.0.1\n */\n setFlashMode(options: {\n flashMode: CameraPreviewFlashMode | string;\n }): Promise<void>;\n\n /**\n * Toggles between the front and rear cameras.\n *\n * @returns {Promise<void>} A promise that resolves when the camera is flipped.\n * @since 0.0.1\n */\n flip(): Promise<void>;\n\n /**\n * Sets the opacity of the camera preview.\n *\n * @param {CameraOpacityOptions} options - The opacity options.\n * @returns {Promise<void>} A promise that resolves when the opacity is set.\n * @since 0.0.1\n */\n setOpacity(options: CameraOpacityOptions): Promise<void>;\n\n /**\n * Stops an ongoing video recording.\n *\n * @returns {Promise<{ videoFilePath: string }>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<{ videoFilePath: string }>;\n\n /**\n * Starts recording a video.\n *\n * @param {CameraPreviewOptions} options - The options for video recording.\n * @returns {Promise<void>} A promise that resolves when video recording starts.\n * @since 0.0.1\n */\n startRecordVideo(options: CameraPreviewOptions): Promise<void>;\n\n /**\n * Checks if the camera preview is currently running.\n *\n * @returns {Promise<{ isRunning: boolean }>} A promise that resolves with the running state.\n * @since 7.4.0\n */\n isRunning(): Promise<{ isRunning: boolean }>;\n\n /**\n * Gets all available camera devices.\n *\n * @returns {Promise<{ devices: CameraDevice[] }>} A promise that resolves with the list of available camera devices.\n * @since 7.4.0\n */\n getAvailableDevices(): Promise<{ devices: CameraDevice[] }>;\n\n /**\n * Gets the current zoom state, including min/max and current lens info.\n *\n * @returns {Promise<{ min: number; max: number; current: number; lens: LensInfo }>} A promise that resolves with the zoom state.\n * @since 7.4.0\n */\n getZoom(): Promise<{ \n min: number; \n max: number; \n current: number;\n lens: LensInfo;\n }>;\n\n /**\n * Sets the camera's zoom level.\n *\n * @param {{ level: number; ramp?: boolean }} options - The desired zoom level. `ramp` is currently unused.\n * @returns {Promise<void>} A promise that resolves when the zoom level is set.\n * @since 7.4.0\n */\n setZoom(options: { level: number; ramp?: boolean }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.4.0\n */\n getFlashMode(): Promise<{ flashMode: FlashMode }>;\n\n /**\n * Removes all registered listeners.\n *\n * @since 7.4.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Switches the active camera to the one with the specified `deviceId`.\n *\n * @param {{ deviceId: string }} options - The ID of the device to switch to.\n * @returns {Promise<void>} A promise that resolves when the camera is switched.\n * @since 7.4.0\n */\n setDeviceId(options: { deviceId: string }): Promise<void>;\n\n /**\n * Gets the ID of the currently active camera device.\n *\n * @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.\n * @since 7.4.0\n */\n getDeviceId(): Promise<{ deviceId: string }>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,sCAAwB,CAAA;IACxB,sCAAwB,CAAA;IACxB,qCAAuB,CAAA;IACvB,sCAAwB,CAAA;IACxB,2BAAa,CAAA;IACb,oCAAsB,CAAA;IACtB,+BAAiB,CAAA;AACnB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB","sourcesContent":["export type CameraPosition = \"rear\" | \"front\";\n\nexport type FlashMode = CameraPreviewFlashMode;\n\nexport type GridMode = \"none\" | \"3x3\" | \"4x4\";\n\nexport enum DeviceType {\n ULTRA_WIDE = \"ultraWide\",\n WIDE_ANGLE = \"wideAngle\",\n TELEPHOTO = \"telephoto\",\n TRUE_DEPTH = \"trueDepth\",\n DUAL = \"dual\",\n DUAL_WIDE = \"dualWide\",\n TRIPLE = \"triple\",\n}\n\n/**\n * Represents a single camera lens on a device. A {@link CameraDevice} can have multiple lenses.\n */\nexport interface CameraLens {\n /** A human-readable name for the lens, e.g., \"Ultra-Wide\". */\n label: string;\n /** The type of the camera lens. */\n deviceType: DeviceType;\n /** The focal length of the lens in millimeters. */\n focalLength: number;\n /** The base zoom factor for this lens (e.g., 0.5 for ultra-wide, 1.0 for wide). */\n baseZoomRatio: number;\n /** The minimum zoom factor supported by this specific lens. */\n minZoom: number;\n /** The maximum zoom factor supported by this specific lens. */\n maxZoom: number;\n}\n\n/**\n * Represents a physical camera on the device (e.g., the front-facing camera).\n */\nexport interface CameraDevice {\n /** A unique identifier for the camera device. */\n deviceId: string;\n /** A human-readable name for the camera device. */\n label: string;\n /** The physical position of the camera on the device. */\n position: CameraPosition;\n /** A list of all available lenses for this camera device. */\n lenses: CameraLens[];\n /** The overall minimum zoom factor available across all lenses on this device. */\n minZoom: number;\n /** The overall maximum zoom factor available across all lenses on this device. */\n maxZoom: number;\n /** Identifies whether the device is a logical camera (composed of multiple physical lenses). */\n isLogical: boolean;\n}\n\n/**\n * Represents the detailed information of the currently active lens.\n */\nexport interface LensInfo {\n /** The focal length of the active lens in millimeters. */\n focalLength: number;\n /** The device type of the active lens. */\n deviceType: DeviceType;\n /** The base zoom ratio of the active lens (e.g., 0.5x, 1.0x). */\n baseZoomRatio: number;\n /** The current digital zoom factor applied on top of the base zoom. */\n digitalZoom: number;\n}\n\n/**\n * Defines the configuration options for starting the camera preview.\n */\nexport interface CameraPreviewOptions {\n /**\n * The parent element to attach the video preview to.\n * @platform web\n */\n parent?: string;\n /**\n * A CSS class name to add to the preview element.\n * @platform web\n */\n className?: string;\n /**\n * The width of the preview in pixels. Defaults to the screen width.\n * @platform android, ios, web\n */\n width?: number;\n /**\n * The height of the preview in pixels. Defaults to the screen height.\n * @platform android, ios, web\n */\n height?: number;\n /**\n * The horizontal origin of the preview, in pixels.\n * @platform android, ios\n */\n x?: number;\n /**\n * The vertical origin of the preview, in pixels.\n * @platform android, ios\n */\n y?: number;\n /**\n * The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\n * Cannot be set if width or height is provided, otherwise the call will be rejected.\n * Use setPreviewSize to adjust size after starting.\n *\n * @since 2.0.0\n */\n aspectRatio?: \"4:3\" | \"16:9\";\n /**\n * The grid overlay to display on the camera preview.\n * @default \"none\"\n * @since 2.1.0\n */\n gridMode?: GridMode;\n /**\n * Adjusts the y-position to account for safe areas (e.g., notches).\n * @platform ios\n * @default false\n */\n includeSafeAreaInsets?: boolean;\n /**\n * If true, places the preview behind the webview.\n * @platform android\n * @default true\n */\n toBack?: boolean;\n /**\n * Bottom padding for the preview, in pixels.\n * @platform android, ios\n */\n paddingBottom?: number;\n /**\n * Whether to rotate the preview when the device orientation changes.\n * @platform ios\n * @default true\n */\n rotateWhenOrientationChanged?: boolean;\n /**\n * The camera to use.\n * @default \"rear\"\n */\n position?: CameraPosition | string;\n /**\n * If true, saves the captured image to a file and returns the file path.\n * If false, returns a base64 encoded string.\n * @default false\n */\n storeToFile?: boolean;\n /**\n * If true, prevents the plugin from rotating the image based on EXIF data.\n * @platform android\n * @default false\n */\n disableExifHeaderStripping?: boolean;\n /**\n * If true, enables high-resolution image capture.\n * @platform ios\n * @default false\n */\n enableHighResolution?: boolean;\n /**\n * If true, disables the audio stream, preventing audio permission requests.\n * @default true\n */\n disableAudio?: boolean;\n /**\n * If true, locks the device orientation while the camera is active.\n * @platform android\n * @default false\n */\n lockAndroidOrientation?: boolean;\n /**\n * If true, allows the camera preview's opacity to be changed.\n * @platform android, web\n * @default false\n */\n enableOpacity?: boolean;\n /**\n * If true, enables pinch-to-zoom functionality on the preview.\n * @platform android\n * @default false\n */\n enableZoom?: boolean;\n /**\n * If true, uses the video-optimized preset for the camera session.\n * @platform ios\n * @default false\n */\n enableVideoMode?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /** The desired height of the picture in pixels. If not provided, the device default is used. */\n height?: number;\n /** The desired width of the picture in pixels. If not provided, the device default is used. */\n width?: number;\n /**\n * The quality of the captured image, from 0 to 100.\n * Does not apply to `png` format.\n * @default 85\n */\n quality?: number;\n /**\n * The format of the captured image.\n * @default \"jpeg\"\n */\n format?: PictureFormat;\n /**\n * If true, the captured image will be saved to the user's gallery.\n * @default false\n * @since 7.5.0\n */\n saveToGallery?: boolean;\n /**\n * If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.\n * This may prompt the user for location permissions.\n * @default false\n * @since 7.6.0\n */\n withExifLocation?: boolean;\n}\n\n/** Represents EXIF data extracted from an image. */\nexport interface ExifData {\n [key: string]: any;\n}\n\nexport type PictureFormat = \"jpeg\" | \"png\";\n\n/** Defines a standard picture size with width and height. */\nexport interface PictureSize {\n /** The width of the picture in pixels. */\n width: number;\n /** The height of the picture in pixels. */\n height: number;\n}\n\n/** Represents the supported picture sizes for a camera facing a certain direction. */\nexport interface SupportedPictureSizes {\n /** The camera direction (\"front\" or \"rear\"). */\n facing: string;\n /** A list of supported picture sizes for this camera. */\n supportedPictureSizes: PictureSize[];\n}\n\n/**\n * Defines the options for capturing a sample frame from the camera preview.\n */\nexport interface CameraSampleOptions {\n /**\n * The quality of the captured sample, from 0 to 100.\n * @default 85\n */\n quality?: number;\n}\n\n/**\n * The available flash modes for the camera.\n * 'torch' is a continuous light mode.\n */\nexport type CameraPreviewFlashMode = \"off\" | \"on\" | \"auto\" | \"torch\";\n\n/**\n * Defines the options for setting the camera preview's opacity.\n */\nexport interface CameraOpacityOptions {\n /**\n * The opacity percentage, from 0.0 (fully transparent) to 1.0 (fully opaque).\n * @default 1.0\n */\n opacity?: number;\n}\n\n/**\n * The main interface for the CameraPreview plugin.\n */\nexport interface CameraPreviewPlugin {\n /**\n * Starts the camera preview.\n *\n * @param {CameraPreviewOptions} options - The configuration for the camera preview.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the preview dimensions.\n * @since 0.0.1\n */\n start(options: CameraPreviewOptions): Promise<{\n /** The width of the preview in pixels. */\n width: number;\n /** The height of the preview in pixels. */\n height: number;\n /** The horizontal origin of the preview, in pixels. */\n x: number;\n /** The vertical origin of the preview, in pixels. */\n y: number;\n }>;\n\n /**\n * Stops the camera preview.\n *\n * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * @param {CameraPreviewPictureOptions} options - The options for capturing the picture.\n * @returns {Promise<{ value: string }>} A promise that resolves with the captured image data.\n * The `value` is a base64 encoded string unless `storeToFile` is true, in which case it's a file path.\n * @since 0.0.1\n */\n capture(\n options: CameraPreviewPictureOptions,\n ): Promise<{ value: string; exif: ExifData }>;\n\n /**\n * Captures a single frame from the camera preview stream.\n *\n * @param {CameraSampleOptions} options - The options for capturing the sample.\n * @returns {Promise<{ value: string }>} A promise that resolves with the sample image as a base64 encoded string.\n * @since 0.0.1\n */\n captureSample(options: CameraSampleOptions): Promise<{ value: string }>;\n\n /**\n * Gets the flash modes supported by the active camera.\n *\n * @returns {Promise<{ result: CameraPreviewFlashMode[] }>} A promise that resolves with an array of supported flash modes.\n * @since 0.0.1\n */\n getSupportedFlashModes(): Promise<{\n result: CameraPreviewFlashMode[];\n }>;\n\n /**\n * Set the aspect ratio of the camera preview.\n *\n * @param {{ aspectRatio: '4:3' | '16:9'; x?: number; y?: number }} options - The desired aspect ratio and optional position.\n * - aspectRatio: The desired aspect ratio ('4:3' or '16:9')\n * - x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.\n * - y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.\n * @since 7.4.0\n */\n setAspectRatio(options: {\n aspectRatio: \"4:3\" | \"16:9\";\n x?: number;\n y?: number;\n }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n\n /**\n * Gets the current aspect ratio of the camera preview.\n *\n * @returns {Promise<{ aspectRatio: '4:3' | '16:9' }>} A promise that resolves with the current aspect ratio.\n * @since 7.4.0\n */\n getAspectRatio(): Promise<{ aspectRatio: \"4:3\" | \"16:9\" }>;\n\n /**\n * Sets the grid mode of the camera preview overlay.\n *\n * @param {{ gridMode: GridMode }} options - The desired grid mode ('none', '3x3', or '4x4').\n * @returns {Promise<void>} A promise that resolves when the grid mode is set.\n * @since 8.0.0\n */\n setGridMode(options: { gridMode: GridMode }): Promise<void>;\n\n /**\n * Gets the current grid mode of the camera preview overlay.\n *\n * @returns {Promise<{ gridMode: GridMode }>} A promise that resolves with the current grid mode.\n * @since 8.0.0\n */\n getGridMode(): Promise<{ gridMode: GridMode }>;\n\n /**\n * Gets the horizontal field of view (FoV) for the active camera.\n * Note: This can be an estimate on some devices.\n *\n * @returns {Promise<{ result: number }>} A promise that resolves with the horizontal field of view in degrees.\n * @since 0.0.1\n */\n getHorizontalFov(): Promise<{\n result: number;\n }>;\n\n /**\n * Gets the supported picture sizes for all cameras.\n *\n * @returns {Promise<{ supportedPictureSizes: SupportedPictureSizes[] }>} A promise that resolves with the list of supported sizes.\n * @since 7.4.0\n */\n getSupportedPictureSizes(): Promise<{\n supportedPictureSizes: SupportedPictureSizes[];\n }>;\n\n /**\n * Sets the flash mode for the active camera.\n *\n * @param {{ flashMode: CameraPreviewFlashMode | string }} options - The desired flash mode.\n * @returns {Promise<void>} A promise that resolves when the flash mode is set.\n * @since 0.0.1\n */\n setFlashMode(options: {\n flashMode: CameraPreviewFlashMode | string;\n }): Promise<void>;\n\n /**\n * Toggles between the front and rear cameras.\n *\n * @returns {Promise<void>} A promise that resolves when the camera is flipped.\n * @since 0.0.1\n */\n flip(): Promise<void>;\n\n /**\n * Sets the opacity of the camera preview.\n *\n * @param {CameraOpacityOptions} options - The opacity options.\n * @returns {Promise<void>} A promise that resolves when the opacity is set.\n * @since 0.0.1\n */\n setOpacity(options: CameraOpacityOptions): Promise<void>;\n\n /**\n * Stops an ongoing video recording.\n *\n * @returns {Promise<{ videoFilePath: string }>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<{ videoFilePath: string }>;\n\n /**\n * Starts recording a video.\n *\n * @param {CameraPreviewOptions} options - The options for video recording.\n * @returns {Promise<void>} A promise that resolves when video recording starts.\n * @since 0.0.1\n */\n startRecordVideo(options: CameraPreviewOptions): Promise<void>;\n\n /**\n * Checks if the camera preview is currently running.\n *\n * @returns {Promise<{ isRunning: boolean }>} A promise that resolves with the running state.\n * @since 7.4.0\n */\n isRunning(): Promise<{ isRunning: boolean }>;\n\n /**\n * Gets all available camera devices.\n *\n * @returns {Promise<{ devices: CameraDevice[] }>} A promise that resolves with the list of available camera devices.\n * @since 7.4.0\n */\n getAvailableDevices(): Promise<{ devices: CameraDevice[] }>;\n\n /**\n * Gets the current zoom state, including min/max and current lens info.\n *\n * @returns {Promise<{ min: number; max: number; current: number; lens: LensInfo }>} A promise that resolves with the zoom state.\n * @since 7.4.0\n */\n getZoom(): Promise<{\n min: number;\n max: number;\n current: number;\n lens: LensInfo;\n }>;\n\n /**\n * Sets the camera's zoom level.\n *\n * @param {{ level: number; ramp?: boolean }} options - The desired zoom level. `ramp` is currently unused.\n * @returns {Promise<void>} A promise that resolves when the zoom level is set.\n * @since 7.4.0\n */\n setZoom(options: { level: number; ramp?: boolean }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.4.0\n */\n getFlashMode(): Promise<{ flashMode: FlashMode }>;\n\n /**\n * Removes all registered listeners.\n *\n * @since 7.4.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Switches the active camera to the one with the specified `deviceId`.\n *\n * @param {{ deviceId: string }} options - The ID of the device to switch to.\n * @returns {Promise<void>} A promise that resolves when the camera is switched.\n * @since 7.4.0\n */\n setDeviceId(options: { deviceId: string }): Promise<void>;\n\n /**\n * Gets the ID of the currently active camera device.\n *\n * @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.\n * @since 7.4.0\n */\n getDeviceId(): Promise<{ deviceId: string }>;\n\n /**\n * Gets the current preview size and position.\n * @returns {Promise<{x: number, y: number, width: number, height: number}>}\n */\n getPreviewSize(): Promise<{\n x: number;\n y: number;\n width: number;\n height: number;\n }>;\n /**\n * Sets the preview size and position.\n * @param options The new position and dimensions.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.\n */\n setPreviewSize(options: {\n x: number;\n y: number;\n width: number;\n height: number;\n }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
- import type { CameraDevice, CameraOpacityOptions, CameraPreviewFlashMode, CameraPreviewOptions, CameraPreviewPictureOptions, CameraPreviewPlugin, CameraSampleOptions, FlashMode, LensInfo } from "./definitions";
2
+ import type { CameraDevice, CameraOpacityOptions, CameraPreviewFlashMode, CameraPreviewOptions, CameraPreviewPictureOptions, CameraPreviewPlugin, CameraSampleOptions, GridMode, FlashMode, LensInfo } 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
@@ -7,11 +7,18 @@ export declare class CameraPreviewWeb extends WebPlugin implements CameraPreview
7
7
  */
8
8
  private isBackCamera;
9
9
  private currentDeviceId;
10
+ private videoElement;
11
+ private isStarted;
10
12
  constructor();
11
13
  getSupportedPictureSizes(): Promise<any>;
12
- start(options: CameraPreviewOptions): Promise<void>;
14
+ start(options: CameraPreviewOptions): Promise<{
15
+ width: number;
16
+ height: number;
17
+ x: number;
18
+ y: number;
19
+ }>;
13
20
  private stopStream;
14
- stop(): Promise<any>;
21
+ stop(): Promise<void>;
15
22
  capture(options: CameraPreviewPictureOptions): Promise<any>;
16
23
  captureSample(_options: CameraSampleOptions): Promise<any>;
17
24
  stopRecordVideo(): Promise<any>;
@@ -52,4 +59,41 @@ export declare class CameraPreviewWeb extends WebPlugin implements CameraPreview
52
59
  setDeviceId(options: {
53
60
  deviceId: string;
54
61
  }): Promise<void>;
62
+ getAspectRatio(): Promise<{
63
+ aspectRatio: "4:3" | "16:9";
64
+ }>;
65
+ setAspectRatio(options: {
66
+ aspectRatio: "4:3" | "16:9";
67
+ x?: number;
68
+ y?: number;
69
+ }): Promise<{
70
+ width: number;
71
+ height: number;
72
+ x: number;
73
+ y: number;
74
+ }>;
75
+ private createGridOverlay;
76
+ setGridMode(options: {
77
+ gridMode: GridMode;
78
+ }): Promise<void>;
79
+ getGridMode(): Promise<{
80
+ gridMode: GridMode;
81
+ }>;
82
+ getPreviewSize(): Promise<{
83
+ x: number;
84
+ y: number;
85
+ width: number;
86
+ height: number;
87
+ }>;
88
+ setPreviewSize(options: {
89
+ x: number;
90
+ y: number;
91
+ width: number;
92
+ height: number;
93
+ }): Promise<{
94
+ width: number;
95
+ height: number;
96
+ x: number;
97
+ y: number;
98
+ }>;
55
99
  }