@capgo/camera-preview 6.2.31 → 6.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,6 +20,40 @@ Use v5 for Capacitor 5 and below.
20
20
 
21
21
  -- [@riderx](https://github.com/riderx), current maintainers
22
22
 
23
+ Remember to add the style below on your app's HTML or body element:
24
+
25
+ ```css
26
+ :root {
27
+ --ion-background-color: transparent !important;
28
+ }
29
+ ```
30
+
31
+ Take into account that this will make transparent all ion-content on application, if you want to show camera preview only in one page, just add a custom class to your ion-content and make it transparent:
32
+
33
+ ```css
34
+ .my-custom-camera-preview-content {
35
+ --background: transparent;
36
+ }
37
+ ```
38
+
39
+ If the camera preview is not displaying after applying the above styles, apply transparent background color to the root div element of the parent component
40
+ Ex: VueJS >> App.vue component
41
+ ```html
42
+ <template>
43
+ <ion-app id="app">
44
+ <ion-router-outlet />
45
+ </ion-app>
46
+ </template>
47
+
48
+ <style>
49
+ #app {
50
+ background-color: transparent !important;
51
+ }
52
+ <style>
53
+ ```
54
+
55
+ If it don't work in dark mode here is issue who explain how to fix it: https://github.com/capacitor-community/camera-preview/issues/199
56
+
23
57
  <!-- # Features
24
58
 
25
59
  <ul>
@@ -99,7 +133,7 @@ Add `import '@capgo/camera-preview'` to you entry script in ionic on `app.module
99
133
  ### start(...)
100
134
 
101
135
  ```typescript
102
- start(options: CameraPreviewOptions) => any
136
+ start(options: CameraPreviewOptions) => Promise<void>
103
137
  ```
104
138
 
105
139
  Start the camera preview instance.
@@ -108,8 +142,6 @@ Start the camera preview instance.
108
142
  | ------------- | --------------------------------------------------------------------- | -------------------------------------------- |
109
143
  | **`options`** | <code><a href="#camerapreviewoptions">CameraPreviewOptions</a></code> | the options to start the camera preview with |
110
144
 
111
- **Returns:** <code>any</code>
112
-
113
145
  **Since:** 0.0.1
114
146
 
115
147
  --------------------
@@ -118,13 +150,11 @@ Start the camera preview instance.
118
150
  ### stop()
119
151
 
120
152
  ```typescript
121
- stop() => any
153
+ stop() => Promise<void>
122
154
  ```
123
155
 
124
156
  Stop the camera preview instance.
125
157
 
126
- **Returns:** <code>any</code>
127
-
128
158
  **Since:** 0.0.1
129
159
 
130
160
  --------------------
@@ -133,7 +163,7 @@ Stop the camera preview instance.
133
163
  ### capture(...)
134
164
 
135
165
  ```typescript
136
- capture(options: CameraPreviewPictureOptions) => any
166
+ capture(options: CameraPreviewPictureOptions) => Promise<{ value: string; }>
137
167
  ```
138
168
 
139
169
  Switch camera.
@@ -142,7 +172,7 @@ Switch camera.
142
172
  | ------------- | ----------------------------------------------------------------------------------- | ------------------------------------- |
143
173
  | **`options`** | <code><a href="#camerapreviewpictureoptions">CameraPreviewPictureOptions</a></code> | the options to switch the camera with |
144
174
 
145
- **Returns:** <code>any</code>
175
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
146
176
 
147
177
  **Since:** 0.0.1
148
178
 
@@ -152,7 +182,7 @@ Switch camera.
152
182
  ### captureSample(...)
153
183
 
154
184
  ```typescript
155
- captureSample(options: CameraSampleOptions) => any
185
+ captureSample(options: CameraSampleOptions) => Promise<{ value: string; }>
156
186
  ```
157
187
 
158
188
  Capture a sample image.
@@ -161,7 +191,7 @@ Capture a sample image.
161
191
  | ------------- | ------------------------------------------------------------------- | -------------------------------------------- |
162
192
  | **`options`** | <code><a href="#camerasampleoptions">CameraSampleOptions</a></code> | the options to capture the sample image with |
163
193
 
164
- **Returns:** <code>any</code>
194
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
165
195
 
166
196
  **Since:** 0.0.1
167
197
 
@@ -171,12 +201,12 @@ Capture a sample image.
171
201
  ### getSupportedFlashModes()
172
202
 
173
203
  ```typescript
174
- getSupportedFlashModes() => any
204
+ getSupportedFlashModes() => Promise<{ result: CameraPreviewFlashMode[]; }>
175
205
  ```
176
206
 
177
207
  Get supported flash modes.
178
208
 
179
- **Returns:** <code>any</code>
209
+ **Returns:** <code>Promise&lt;{ result: CameraPreviewFlashMode[]; }&gt;</code>
180
210
 
181
211
  **Since:** 0.0.1
182
212
 
@@ -186,12 +216,12 @@ Get supported flash modes.
186
216
  ### getHorizontalFov()
187
217
 
188
218
  ```typescript
189
- getHorizontalFov() => any
219
+ getHorizontalFov() => Promise<{ result: any; }>
190
220
  ```
191
221
 
192
222
  Get horizontal field of view.
193
223
 
194
- **Returns:** <code>any</code>
224
+ **Returns:** <code>Promise&lt;{ result: any; }&gt;</code>
195
225
 
196
226
  **Since:** 0.0.1
197
227
 
@@ -201,7 +231,7 @@ Get horizontal field of view.
201
231
  ### setFlashMode(...)
202
232
 
203
233
  ```typescript
204
- setFlashMode(options: { flashMode: CameraPreviewFlashMode | string; }) => any
234
+ setFlashMode(options: { flashMode: CameraPreviewFlashMode | string; }) => Promise<void>
205
235
  ```
206
236
 
207
237
  Set flash mode.
@@ -210,8 +240,6 @@ Set flash mode.
210
240
  | ------------- | ----------------------------------- | -------------------------------------- |
211
241
  | **`options`** | <code>{ flashMode: string; }</code> | the options to set the flash mode with |
212
242
 
213
- **Returns:** <code>any</code>
214
-
215
243
  **Since:** 0.0.1
216
244
 
217
245
  --------------------
@@ -220,13 +248,11 @@ Set flash mode.
220
248
  ### flip()
221
249
 
222
250
  ```typescript
223
- flip() => any
251
+ flip() => Promise<void>
224
252
  ```
225
253
 
226
254
  Flip camera.
227
255
 
228
- **Returns:** <code>any</code>
229
-
230
256
  **Since:** 0.0.1
231
257
 
232
258
  --------------------
@@ -235,7 +261,7 @@ Flip camera.
235
261
  ### setOpacity(...)
236
262
 
237
263
  ```typescript
238
- setOpacity(options: CameraOpacityOptions) => any
264
+ setOpacity(options: CameraOpacityOptions) => Promise<void>
239
265
  ```
240
266
 
241
267
  Set opacity.
@@ -244,8 +270,6 @@ Set opacity.
244
270
  | ------------- | --------------------------------------------------------------------- | ------------------------------------------ |
245
271
  | **`options`** | <code><a href="#cameraopacityoptions">CameraOpacityOptions</a></code> | the options to set the camera opacity with |
246
272
 
247
- **Returns:** <code>any</code>
248
-
249
273
  **Since:** 0.0.1
250
274
 
251
275
  --------------------
@@ -254,12 +278,12 @@ Set opacity.
254
278
  ### stopRecordVideo()
255
279
 
256
280
  ```typescript
257
- stopRecordVideo() => any
281
+ stopRecordVideo() => Promise<{ videoFilePath: string; }>
258
282
  ```
259
283
 
260
284
  Stop recording video.
261
285
 
262
- **Returns:** <code>any</code>
286
+ **Returns:** <code>Promise&lt;{ videoFilePath: string; }&gt;</code>
263
287
 
264
288
  **Since:** 0.0.1
265
289
 
@@ -269,7 +293,7 @@ Stop recording video.
269
293
  ### startRecordVideo(...)
270
294
 
271
295
  ```typescript
272
- startRecordVideo(options: CameraPreviewOptions) => any
296
+ startRecordVideo(options: CameraPreviewOptions) => Promise<void>
273
297
  ```
274
298
 
275
299
  Start recording video.
@@ -278,8 +302,6 @@ Start recording video.
278
302
  | ------------- | --------------------------------------------------------------------- | ----------------------------------------- |
279
303
  | **`options`** | <code><a href="#camerapreviewoptions">CameraPreviewOptions</a></code> | the options to start recording video with |
280
304
 
281
- **Returns:** <code>any</code>
282
-
283
305
  **Since:** 0.0.1
284
306
 
285
307
  --------------------
package/dist/docs.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "methods": [
8
8
  {
9
9
  "name": "start",
10
- "signature": "(options: CameraPreviewOptions) => any",
10
+ "signature": "(options: CameraPreviewOptions) => Promise<void>",
11
11
  "parameters": [
12
12
  {
13
13
  "name": "options",
@@ -15,7 +15,7 @@
15
15
  "type": "CameraPreviewOptions"
16
16
  }
17
17
  ],
18
- "returns": "any",
18
+ "returns": "Promise<void>",
19
19
  "tags": [
20
20
  {
21
21
  "name": "param",
@@ -42,9 +42,9 @@
42
42
  },
43
43
  {
44
44
  "name": "stop",
45
- "signature": "() => any",
45
+ "signature": "() => Promise<void>",
46
46
  "parameters": [],
47
- "returns": "any",
47
+ "returns": "Promise<void>",
48
48
  "tags": [
49
49
  {
50
50
  "name": "returns",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  {
67
67
  "name": "capture",
68
- "signature": "(options: CameraPreviewPictureOptions) => any",
68
+ "signature": "(options: CameraPreviewPictureOptions) => Promise<{ value: string; }>",
69
69
  "parameters": [
70
70
  {
71
71
  "name": "options",
@@ -73,7 +73,7 @@
73
73
  "type": "CameraPreviewPictureOptions"
74
74
  }
75
75
  ],
76
- "returns": "any",
76
+ "returns": "Promise<{ value: string; }>",
77
77
  "tags": [
78
78
  {
79
79
  "name": "param",
@@ -100,7 +100,7 @@
100
100
  },
101
101
  {
102
102
  "name": "captureSample",
103
- "signature": "(options: CameraSampleOptions) => any",
103
+ "signature": "(options: CameraSampleOptions) => Promise<{ value: string; }>",
104
104
  "parameters": [
105
105
  {
106
106
  "name": "options",
@@ -108,7 +108,7 @@
108
108
  "type": "CameraSampleOptions"
109
109
  }
110
110
  ],
111
- "returns": "any",
111
+ "returns": "Promise<{ value: string; }>",
112
112
  "tags": [
113
113
  {
114
114
  "name": "param",
@@ -135,9 +135,9 @@
135
135
  },
136
136
  {
137
137
  "name": "getSupportedFlashModes",
138
- "signature": "() => any",
138
+ "signature": "() => Promise<{ result: CameraPreviewFlashMode[]; }>",
139
139
  "parameters": [],
140
- "returns": "any",
140
+ "returns": "Promise<{ result: CameraPreviewFlashMode[]; }>",
141
141
  "tags": [
142
142
  {
143
143
  "name": "returns",
@@ -160,9 +160,9 @@
160
160
  },
161
161
  {
162
162
  "name": "getHorizontalFov",
163
- "signature": "() => any",
163
+ "signature": "() => Promise<{ result: any; }>",
164
164
  "parameters": [],
165
- "returns": "any",
165
+ "returns": "Promise<{ result: any; }>",
166
166
  "tags": [
167
167
  {
168
168
  "name": "returns",
@@ -183,7 +183,7 @@
183
183
  },
184
184
  {
185
185
  "name": "setFlashMode",
186
- "signature": "(options: { flashMode: CameraPreviewFlashMode | string; }) => any",
186
+ "signature": "(options: { flashMode: CameraPreviewFlashMode | string; }) => Promise<void>",
187
187
  "parameters": [
188
188
  {
189
189
  "name": "options",
@@ -191,7 +191,7 @@
191
191
  "type": "{ flashMode: string; }"
192
192
  }
193
193
  ],
194
- "returns": "any",
194
+ "returns": "Promise<void>",
195
195
  "tags": [
196
196
  {
197
197
  "name": "param",
@@ -218,9 +218,9 @@
218
218
  },
219
219
  {
220
220
  "name": "flip",
221
- "signature": "() => any",
221
+ "signature": "() => Promise<void>",
222
222
  "parameters": [],
223
- "returns": "any",
223
+ "returns": "Promise<void>",
224
224
  "tags": [
225
225
  {
226
226
  "name": "returns",
@@ -241,7 +241,7 @@
241
241
  },
242
242
  {
243
243
  "name": "setOpacity",
244
- "signature": "(options: CameraOpacityOptions) => any",
244
+ "signature": "(options: CameraOpacityOptions) => Promise<void>",
245
245
  "parameters": [
246
246
  {
247
247
  "name": "options",
@@ -249,7 +249,7 @@
249
249
  "type": "CameraOpacityOptions"
250
250
  }
251
251
  ],
252
- "returns": "any",
252
+ "returns": "Promise<void>",
253
253
  "tags": [
254
254
  {
255
255
  "name": "param",
@@ -276,9 +276,9 @@
276
276
  },
277
277
  {
278
278
  "name": "stopRecordVideo",
279
- "signature": "() => any",
279
+ "signature": "() => Promise<{ videoFilePath: string; }>",
280
280
  "parameters": [],
281
- "returns": "any",
281
+ "returns": "Promise<{ videoFilePath: string; }>",
282
282
  "tags": [
283
283
  {
284
284
  "name": "param",
@@ -303,7 +303,7 @@
303
303
  },
304
304
  {
305
305
  "name": "startRecordVideo",
306
- "signature": "(options: CameraPreviewOptions) => any",
306
+ "signature": "(options: CameraPreviewOptions) => Promise<void>",
307
307
  "parameters": [
308
308
  {
309
309
  "name": "options",
@@ -311,7 +311,7 @@
311
311
  "type": "CameraPreviewOptions"
312
312
  }
313
313
  ],
314
- "returns": "any",
314
+ "returns": "Promise<void>",
315
315
  "tags": [
316
316
  {
317
317
  "name": "param",
@@ -352,63 +352,63 @@
352
352
  "tags": [],
353
353
  "docs": "Parent element to attach the video preview element to (applicable to the web platform only)",
354
354
  "complexTypes": [],
355
- "type": "string"
355
+ "type": "string | undefined"
356
356
  },
357
357
  {
358
358
  "name": "className",
359
359
  "tags": [],
360
360
  "docs": "Class name to add to the video preview element (applicable to the web platform only)",
361
361
  "complexTypes": [],
362
- "type": "string"
362
+ "type": "string | undefined"
363
363
  },
364
364
  {
365
365
  "name": "width",
366
366
  "tags": [],
367
367
  "docs": "The preview width in pixels, default window.screen.width",
368
368
  "complexTypes": [],
369
- "type": "number"
369
+ "type": "number | undefined"
370
370
  },
371
371
  {
372
372
  "name": "height",
373
373
  "tags": [],
374
374
  "docs": "The preview height in pixels, default window.screen.height",
375
375
  "complexTypes": [],
376
- "type": "number"
376
+ "type": "number | undefined"
377
377
  },
378
378
  {
379
379
  "name": "x",
380
380
  "tags": [],
381
381
  "docs": "The x origin, default 0 (applicable to the android and ios platforms only)",
382
382
  "complexTypes": [],
383
- "type": "number"
383
+ "type": "number | undefined"
384
384
  },
385
385
  {
386
386
  "name": "y",
387
387
  "tags": [],
388
388
  "docs": "The y origin, default 0 (applicable to the android and ios platforms only)",
389
389
  "complexTypes": [],
390
- "type": "number"
390
+ "type": "number | undefined"
391
391
  },
392
392
  {
393
393
  "name": "toBack",
394
394
  "tags": [],
395
395
  "docs": "Brings your html in front of your preview, default false (applicable to the android only)",
396
396
  "complexTypes": [],
397
- "type": "boolean"
397
+ "type": "boolean | undefined"
398
398
  },
399
399
  {
400
400
  "name": "paddingBottom",
401
401
  "tags": [],
402
402
  "docs": "The preview bottom padding in pixes. Useful to keep the appropriate preview sizes when orientation changes (applicable to the android and ios platforms only)",
403
403
  "complexTypes": [],
404
- "type": "number"
404
+ "type": "number | undefined"
405
405
  },
406
406
  {
407
407
  "name": "rotateWhenOrientationChanged",
408
408
  "tags": [],
409
409
  "docs": "Rotate preview when orientation changes (applicable to the ios platforms only; default value is true)",
410
410
  "complexTypes": [],
411
- "type": "boolean"
411
+ "type": "boolean | undefined"
412
412
  },
413
413
  {
414
414
  "name": "position",
@@ -417,63 +417,63 @@
417
417
  "complexTypes": [
418
418
  "CameraPosition"
419
419
  ],
420
- "type": "string"
420
+ "type": "string | undefined"
421
421
  },
422
422
  {
423
423
  "name": "storeToFile",
424
424
  "tags": [],
425
425
  "docs": "Defaults to false - Capture images to a file and return the file path instead of returning base64 encoded data",
426
426
  "complexTypes": [],
427
- "type": "boolean"
427
+ "type": "boolean | undefined"
428
428
  },
429
429
  {
430
430
  "name": "disableExifHeaderStripping",
431
431
  "tags": [],
432
432
  "docs": "Defaults to false - Android Only - Disable automatic rotation of the image, and let the browser deal with it (keep reading on how to achieve it)",
433
433
  "complexTypes": [],
434
- "type": "boolean"
434
+ "type": "boolean | undefined"
435
435
  },
436
436
  {
437
437
  "name": "enableHighResolution",
438
438
  "tags": [],
439
439
  "docs": "Defaults to false - iOS only - Activate high resolution image capture so that output images are from the highest resolution possible on the device *",
440
440
  "complexTypes": [],
441
- "type": "boolean"
441
+ "type": "boolean | undefined"
442
442
  },
443
443
  {
444
444
  "name": "disableAudio",
445
445
  "tags": [],
446
446
  "docs": "Defaults to false - Web only - Disables audio stream to prevent permission requests and output switching",
447
447
  "complexTypes": [],
448
- "type": "boolean"
448
+ "type": "boolean | undefined"
449
449
  },
450
450
  {
451
451
  "name": "lockAndroidOrientation",
452
452
  "tags": [],
453
453
  "docs": "Android Only - Locks device orientation when camera is showing.",
454
454
  "complexTypes": [],
455
- "type": "boolean"
455
+ "type": "boolean | undefined"
456
456
  },
457
457
  {
458
458
  "name": "enableOpacity",
459
459
  "tags": [],
460
460
  "docs": "Defaults to false - Android and Web only. Set if camera preview can change opacity.",
461
461
  "complexTypes": [],
462
- "type": "boolean"
462
+ "type": "boolean | undefined"
463
463
  },
464
464
  {
465
465
  "name": "enableZoom",
466
466
  "tags": [],
467
467
  "docs": "Defaults to false - Android only. Set if camera preview will support pinch to zoom.",
468
468
  "complexTypes": [],
469
- "type": "boolean"
469
+ "type": "boolean | undefined"
470
470
  },
471
471
  {
472
472
  "name": "cameraMode",
473
473
  "tags": [],
474
474
  "docs": "default to false - IOS only. Set the CameraPreview to use the video mode preset",
475
475
  "complexTypes": [],
476
- "type": "boolean"
476
+ "type": "boolean | undefined"
477
477
  }
478
478
  ]
479
479
  },
@@ -489,21 +489,21 @@
489
489
  "tags": [],
490
490
  "docs": "The picture height, optional, default 0 (Device default)",
491
491
  "complexTypes": [],
492
- "type": "number"
492
+ "type": "number | undefined"
493
493
  },
494
494
  {
495
495
  "name": "width",
496
496
  "tags": [],
497
497
  "docs": "The picture width, optional, default 0 (Device default)",
498
498
  "complexTypes": [],
499
- "type": "number"
499
+ "type": "number | undefined"
500
500
  },
501
501
  {
502
502
  "name": "quality",
503
503
  "tags": [],
504
504
  "docs": "The picture quality, 0 - 100, default 85",
505
505
  "complexTypes": [],
506
- "type": "number"
506
+ "type": "number | undefined"
507
507
  },
508
508
  {
509
509
  "name": "format",
@@ -528,7 +528,7 @@
528
528
  "tags": [],
529
529
  "docs": "The picture quality, 0 - 100, default 85",
530
530
  "complexTypes": [],
531
- "type": "number"
531
+ "type": "number | undefined"
532
532
  }
533
533
  ]
534
534
  },
@@ -544,7 +544,7 @@
544
544
  "tags": [],
545
545
  "docs": "The percent opacity to set for camera view, default 1",
546
546
  "complexTypes": [],
547
- "type": "number"
547
+ "type": "number | undefined"
548
548
  }
549
549
  ]
550
550
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type CameraPosition = \"rear\" | \"front\";\nexport interface CameraPreviewOptions {\n /** Parent element to attach the video preview element to (applicable to the web platform only) */\n parent?: string;\n /** Class name to add to the video preview element (applicable to the web platform only) */\n className?: string;\n /** The preview width in pixels, default window.screen.width */\n width?: number;\n /** The preview height in pixels, default window.screen.height */\n height?: number;\n /** The x origin, default 0 (applicable to the android and ios platforms only) */\n x?: number;\n /** The y origin, default 0 (applicable to the android and ios platforms only) */\n y?: number;\n /** Brings your html in front of your preview, default false (applicable to the android only) */\n toBack?: boolean;\n /** The preview bottom padding in pixes. Useful to keep the appropriate preview sizes when orientation changes (applicable to the android and ios platforms only) */\n paddingBottom?: number;\n /** Rotate preview when orientation changes (applicable to the ios platforms only; default value is true) */\n rotateWhenOrientationChanged?: boolean;\n /** Choose the camera to use 'front' or 'rear', default 'front' */\n position?: CameraPosition | string;\n /** Defaults to false - Capture images to a file and return the file path instead of returning base64 encoded data */\n storeToFile?: boolean;\n /** Defaults to false - Android Only - Disable automatic rotation of the image, and let the browser deal with it (keep reading on how to achieve it) */\n disableExifHeaderStripping?: boolean;\n /** Defaults to false - iOS only - Activate high resolution image capture so that output images are from the highest resolution possible on the device **/\n enableHighResolution?: boolean;\n /** Defaults to false - Web only - Disables audio stream to prevent permission requests and output switching */\n disableAudio?: boolean;\n /** Android Only - Locks device orientation when camera is showing. */\n lockAndroidOrientation?: boolean;\n /** Defaults to false - Android and Web only. Set if camera preview can change opacity. */\n enableOpacity?: boolean;\n /** Defaults to false - Android only. Set if camera preview will support pinch to zoom. */\n enableZoom?: boolean;\n /** default to false - IOS only. Set the CameraPreview to use the video mode preset */\n cameraMode?: boolean;\n}\n\nexport interface CameraPreviewPictureOptions {\n /** The picture height, optional, default 0 (Device default) */\n height?: number;\n /** The picture width, optional, default 0 (Device default) */\n width?: number;\n /** The picture quality, 0 - 100, default 85 */\n quality?: number;\n /** The picture format, jpeg or png, default jpeg on `Web`.\n *\n * quality has no effect on png */\n format?: PictureFormat;\n}\n\nexport type PictureFormat = \"jpeg\" | \"png\";\n\nexport interface CameraSampleOptions {\n /** The picture quality, 0 - 100, default 85 */\n quality?: number;\n}\n\nexport type CameraPreviewFlashMode =\n | \"off\"\n | \"on\"\n | \"auto\"\n | \"red-eye\"\n | \"torch\";\n\nexport interface CameraOpacityOptions {\n /** The percent opacity to set for camera view, default 1 */\n opacity?: number;\n}\n\nexport interface CameraPreviewPlugin {\n /**\n * Start the camera preview instance.\n * @param {CameraPreviewOptions} options the options to start the camera preview with\n * @returns {Promise<void>} an Promise that resolves when the instance is started\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n start(options: CameraPreviewOptions): Promise<void>;\n /**\n * Stop the camera preview instance.\n * @returns {Promise<void>} an Promise that resolves when the instance is stopped\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n stop(): Promise<void>;\n /**\n * Switch camera.\n * @param {CameraPreviewOptions} options the options to switch the camera with\n * @returns {Promise<void>} an Promise that resolves when the camera is switched\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n capture(options: CameraPreviewPictureOptions): Promise<{ value: string }>;\n /**\n * Capture a sample image.\n * @param {CameraSampleOptions} options the options to capture the sample image with\n * @returns {Promise<string>} an Promise that resolves with the sample image as a base64 encoded string\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n captureSample(options: CameraSampleOptions): Promise<{ value: string }>;\n /**\n * Get supported flash modes.\n * @returns {Promise<CameraPreviewFlashMode[]>} an Promise that resolves with the supported flash modes\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n getSupportedFlashModes(): Promise<{\n result: CameraPreviewFlashMode[];\n }>;\n /**\n * Get horizontal field of view.\n * @returns {Promise<any>} an Promise that resolves with the horizontal field of view\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n getHorizontalFov(): Promise<{\n result: any;\n }>;\n /**\n * Set flash mode.\n * @param options the options to set the flash mode with\n * @returns {Promise<void>} an Promise that resolves when the flash mode is set\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n setFlashMode(options: {\n flashMode: CameraPreviewFlashMode | string;\n }): Promise<void>;\n /**\n * Flip camera.\n * @returns {Promise<void>} an Promise that resolves when the camera is flipped\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n flip(): Promise<void>;\n /**\n * Set opacity.\n * @param {CameraOpacityOptions} options the options to set the camera opacity with\n * @returns {Promise<void>} an Promise that resolves when the camera color effect is set\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n setOpacity(options: CameraOpacityOptions): Promise<void>;\n /**\n * Stop recording video.\n * @param {CameraPreviewOptions} options the options to stop recording video with\n * @returns {Promise<{videoFilePath: string}>} an Promise that resolves when the camera zoom is set\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<{videoFilePath: string}>;\n /**\n * Start recording video.\n * @param {CameraPreviewOptions} options the options to start recording video with\n * @returns {Promise<void>} an Promise that resolves when the video recording is started\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n startRecordVideo(options: CameraPreviewOptions): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type CameraPosition = \"rear\" | \"front\";\nexport interface CameraPreviewOptions {\n /** Parent element to attach the video preview element to (applicable to the web platform only) */\n parent?: string;\n /** Class name to add to the video preview element (applicable to the web platform only) */\n className?: string;\n /** The preview width in pixels, default window.screen.width */\n width?: number;\n /** The preview height in pixels, default window.screen.height */\n height?: number;\n /** The x origin, default 0 (applicable to the android and ios platforms only) */\n x?: number;\n /** The y origin, default 0 (applicable to the android and ios platforms only) */\n y?: number;\n /** Brings your html in front of your preview, default false (applicable to the android only) */\n toBack?: boolean;\n /** The preview bottom padding in pixes. Useful to keep the appropriate preview sizes when orientation changes (applicable to the android and ios platforms only) */\n paddingBottom?: number;\n /** Rotate preview when orientation changes (applicable to the ios platforms only; default value is true) */\n rotateWhenOrientationChanged?: boolean;\n /** Choose the camera to use 'front' or 'rear', default 'front' */\n position?: CameraPosition | string;\n /** Defaults to false - Capture images to a file and return the file path instead of returning base64 encoded data */\n storeToFile?: boolean;\n /** Defaults to false - Android Only - Disable automatic rotation of the image, and let the browser deal with it (keep reading on how to achieve it) */\n disableExifHeaderStripping?: boolean;\n /** Defaults to false - iOS only - Activate high resolution image capture so that output images are from the highest resolution possible on the device **/\n enableHighResolution?: boolean;\n /** Defaults to false - Web only - Disables audio stream to prevent permission requests and output switching */\n disableAudio?: boolean;\n /** Android Only - Locks device orientation when camera is showing. */\n lockAndroidOrientation?: boolean;\n /** Defaults to false - Android and Web only. Set if camera preview can change opacity. */\n enableOpacity?: boolean;\n /** Defaults to false - Android only. Set if camera preview will support pinch to zoom. */\n enableZoom?: boolean;\n /** default to false - IOS only. Set the CameraPreview to use the video mode preset */\n cameraMode?: boolean;\n}\n\nexport interface CameraPreviewPictureOptions {\n /** The picture height, optional, default 0 (Device default) */\n height?: number;\n /** The picture width, optional, default 0 (Device default) */\n width?: number;\n /** The picture quality, 0 - 100, default 85 */\n quality?: number;\n /** The picture format, jpeg or png, default jpeg on `Web`.\n *\n * quality has no effect on png */\n format?: PictureFormat;\n}\n\nexport type PictureFormat = \"jpeg\" | \"png\";\n\nexport interface CameraSampleOptions {\n /** The picture quality, 0 - 100, default 85 */\n quality?: number;\n}\n\nexport type CameraPreviewFlashMode =\n | \"off\"\n | \"on\"\n | \"auto\"\n | \"red-eye\"\n | \"torch\";\n\nexport interface CameraOpacityOptions {\n /** The percent opacity to set for camera view, default 1 */\n opacity?: number;\n}\n\nexport interface CameraPreviewPlugin {\n /**\n * Start the camera preview instance.\n * @param {CameraPreviewOptions} options the options to start the camera preview with\n * @returns {Promise<void>} an Promise that resolves when the instance is started\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n start(options: CameraPreviewOptions): Promise<void>;\n /**\n * Stop the camera preview instance.\n * @returns {Promise<void>} an Promise that resolves when the instance is stopped\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n stop(): Promise<void>;\n /**\n * Switch camera.\n * @param {CameraPreviewOptions} options the options to switch the camera with\n * @returns {Promise<void>} an Promise that resolves when the camera is switched\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n capture(options: CameraPreviewPictureOptions): Promise<{ value: string }>;\n /**\n * Capture a sample image.\n * @param {CameraSampleOptions} options the options to capture the sample image with\n * @returns {Promise<string>} an Promise that resolves with the sample image as a base64 encoded string\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n captureSample(options: CameraSampleOptions): Promise<{ value: string }>;\n /**\n * Get supported flash modes.\n * @returns {Promise<CameraPreviewFlashMode[]>} an Promise that resolves with the supported flash modes\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n getSupportedFlashModes(): Promise<{\n result: CameraPreviewFlashMode[];\n }>;\n /**\n * Get horizontal field of view.\n * @returns {Promise<any>} an Promise that resolves with the horizontal field of view\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n getHorizontalFov(): Promise<{\n result: any;\n }>;\n /**\n * Set flash mode.\n * @param options the options to set the flash mode with\n * @returns {Promise<void>} an Promise that resolves when the flash mode is set\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n setFlashMode(options: {\n flashMode: CameraPreviewFlashMode | string;\n }): Promise<void>;\n /**\n * Flip camera.\n * @returns {Promise<void>} an Promise that resolves when the camera is flipped\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n flip(): Promise<void>;\n /**\n * Set opacity.\n * @param {CameraOpacityOptions} options the options to set the camera opacity with\n * @returns {Promise<void>} an Promise that resolves when the camera color effect is set\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n setOpacity(options: CameraOpacityOptions): Promise<void>;\n /**\n * Stop recording video.\n * @param {CameraPreviewOptions} options the options to stop recording video with\n * @returns {Promise<{videoFilePath: string}>} an Promise that resolves when the camera zoom is set\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<{ videoFilePath: string }>;\n /**\n * Start recording video.\n * @param {CameraPreviewOptions} options the options to start recording video with\n * @returns {Promise<void>} an Promise that resolves when the video recording is started\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n startRecordVideo(options: CameraPreviewOptions): Promise<void>;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { CameraPreviewPlugin } from './definitions';
1
+ import type { CameraPreviewPlugin } from "./definitions";
2
2
  declare const CameraPreview: CameraPreviewPlugin;
3
- export * from './definitions';
3
+ export * from "./definitions";
4
4
  export { CameraPreview };
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { registerPlugin } from '@capacitor/core';
2
- const CameraPreview = registerPlugin('CameraPreview', {
3
- web: () => import('./web').then(m => new m.CameraPreviewWeb()),
1
+ import { registerPlugin } from "@capacitor/core";
2
+ const CameraPreview = registerPlugin("CameraPreview", {
3
+ web: () => import("./web").then((m) => new m.CameraPreviewWeb()),
4
4
  });
5
- export * from './definitions';
5
+ export * from "./definitions";
6
6
  export { CameraPreview };
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAIhD,MAAM,aAAa,GAAG,cAAc,CAAsB,eAAe,EAAE;IACzE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;CAC/D,CAAC,CAAA;AAEF,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,CAAA","sourcesContent":["import { registerPlugin } from '@capacitor/core'\n\nimport type { CameraPreviewPlugin } from './definitions'\n\nconst CameraPreview = registerPlugin<CameraPreviewPlugin>('CameraPreview', {\n web: () => import('./web').then(m => new m.CameraPreviewWeb()),\n})\n\nexport * from './definitions'\nexport { CameraPreview }\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,aAAa,GAAG,cAAc,CAAsB,eAAe,EAAE;IACzE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;CACjE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\n\nimport type { CameraPreviewPlugin } from \"./definitions\";\n\nconst CameraPreview = registerPlugin<CameraPreviewPlugin>(\"CameraPreview\", {\n web: () => import(\"./web\").then((m) => new m.CameraPreviewWeb()),\n});\n\nexport * from \"./definitions\";\nexport { CameraPreview };\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { WebPlugin } from '@capacitor/core';
2
- import type { CameraOpacityOptions, CameraPreviewFlashMode, CameraPreviewOptions, CameraPreviewPictureOptions, CameraPreviewPlugin, CameraSampleOptions } from './definitions';
1
+ import { WebPlugin } from "@capacitor/core";
2
+ import type { CameraOpacityOptions, CameraPreviewFlashMode, CameraPreviewOptions, CameraPreviewPictureOptions, CameraPreviewPlugin, CameraSampleOptions } 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