@capgo/camera-preview 7.4.0-beta.9 → 7.4.1
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 +246 -50
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +1249 -143
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +3400 -1432
- package/android/src/main/java/com/ahm/capacitor/camera/preview/GridOverlayView.java +95 -58
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraDevice.java +55 -46
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraLens.java +61 -52
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraSessionConfiguration.java +160 -72
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/LensInfo.java +29 -23
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/ZoomFactors.java +24 -23
- package/dist/docs.json +443 -42
- package/dist/esm/definitions.d.ts +173 -27
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +24 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +23 -3
- package/dist/esm/web.js +463 -65
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +485 -64
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +485 -64
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/{CapgoCameraPreview → CapgoCameraPreviewPlugin}/CameraController.swift +731 -315
- package/ios/Sources/CapgoCameraPreviewPlugin/Plugin.swift +1902 -0
- package/package.json +11 -3
- package/android/.gradle/8.14.2/checksums/checksums.lock +0 -0
- package/android/.gradle/8.14.2/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.14.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.14.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/8.14.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.14.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.14.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.14.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.14.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/8.14.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/ios/Sources/CapgoCameraPreview/Plugin.swift +0 -1369
- /package/ios/Sources/{CapgoCameraPreview → CapgoCameraPreviewPlugin}/GridOverlayView.swift +0 -0
package/README.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
6
|
-
<h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo
|
|
7
|
-
<h2><a href="https://capgo.app/consulting/?ref=plugin">
|
|
6
|
+
<h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo</a></h2>
|
|
7
|
+
<h2><a href="https://capgo.app/consulting/?ref=plugin"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
10
|
<p>
|
|
@@ -37,7 +37,7 @@ Take into account that this will make transparent all ion-content on application
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
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
|
|
40
|
+
Ex: VueJS >> App.vue component
|
|
41
41
|
```html
|
|
42
42
|
<template>
|
|
43
43
|
<ion-app id="app">
|
|
@@ -76,6 +76,25 @@ Video and photo taken with the plugin are never removed, so do not forget to rem
|
|
|
76
76
|
use https://capacitorjs.com/docs/apis/filesystem#deletefile for that
|
|
77
77
|
|
|
78
78
|
|
|
79
|
+
## Fast base64 from file path (no bridge)
|
|
80
|
+
|
|
81
|
+
When using `storeToFile: true`, you can avoid sending large base64 strings over the Capacitor bridge:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { CameraPreview, getBase64FromFilePath } from '@capgo/camera-preview'
|
|
85
|
+
|
|
86
|
+
await CameraPreview.start({ storeToFile: true });
|
|
87
|
+
// Take a picture and get a file path
|
|
88
|
+
const { value: filePath } = await CameraPreview.capture({ quality: 85 })
|
|
89
|
+
|
|
90
|
+
// Convert the file to base64 entirely on the JS side (fast, no bridge)
|
|
91
|
+
const base64 = await getBase64FromFilePath(filePath)
|
|
92
|
+
|
|
93
|
+
// Optionally cleanup the temp file natively
|
|
94
|
+
await CameraPreview.deleteFile({ path: filePath })
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
|
|
79
98
|
# Installation
|
|
80
99
|
|
|
81
100
|
```
|
|
@@ -234,6 +253,7 @@ Documentation for the [uploader](https://github.com/Cap-go/capacitor-uploader)
|
|
|
234
253
|
* [`isRunning()`](#isrunning)
|
|
235
254
|
* [`getAvailableDevices()`](#getavailabledevices)
|
|
236
255
|
* [`getZoom()`](#getzoom)
|
|
256
|
+
* [`getZoomButtonValues()`](#getzoombuttonvalues)
|
|
237
257
|
* [`setZoom(...)`](#setzoom)
|
|
238
258
|
* [`getFlashMode()`](#getflashmode)
|
|
239
259
|
* [`removeAllListeners()`](#removealllisteners)
|
|
@@ -241,6 +261,12 @@ Documentation for the [uploader](https://github.com/Cap-go/capacitor-uploader)
|
|
|
241
261
|
* [`getDeviceId()`](#getdeviceid)
|
|
242
262
|
* [`getPreviewSize()`](#getpreviewsize)
|
|
243
263
|
* [`setPreviewSize(...)`](#setpreviewsize)
|
|
264
|
+
* [`setFocus(...)`](#setfocus)
|
|
265
|
+
* [`addListener('screenResize', ...)`](#addlistenerscreenresize-)
|
|
266
|
+
* [`addListener('orientationChange', ...)`](#addlistenerorientationchange-)
|
|
267
|
+
* [`deleteFile(...)`](#deletefile)
|
|
268
|
+
* [`getSafeAreaInsets()`](#getsafeareainsets)
|
|
269
|
+
* [`getOrientation()`](#getorientation)
|
|
244
270
|
* [Interfaces](#interfaces)
|
|
245
271
|
* [Type Aliases](#type-aliases)
|
|
246
272
|
* [Enums](#enums)
|
|
@@ -292,6 +318,9 @@ capture(options: CameraPreviewPictureOptions) => Promise<{ value: string; exif:
|
|
|
292
318
|
|
|
293
319
|
Captures a picture from the camera.
|
|
294
320
|
|
|
321
|
+
If `storeToFile` was set to `true` when starting the preview, the returned
|
|
322
|
+
`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.
|
|
323
|
+
|
|
295
324
|
| Param | Type | Description |
|
|
296
325
|
| ------------- | ----------------------------------------------------------------------------------- | ---------------------------------------- |
|
|
297
326
|
| **`options`** | <code><a href="#camerapreviewpictureoptions">CameraPreviewPictureOptions</a></code> | - The options for capturing the picture. |
|
|
@@ -340,7 +369,7 @@ Gets the flash modes supported by the active camera.
|
|
|
340
369
|
### setAspectRatio(...)
|
|
341
370
|
|
|
342
371
|
```typescript
|
|
343
|
-
setAspectRatio(options: { aspectRatio:
|
|
372
|
+
setAspectRatio(options: { aspectRatio: "4:3" | "16:9"; x?: number; y?: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>
|
|
344
373
|
```
|
|
345
374
|
|
|
346
375
|
Set the aspect ratio of the camera preview.
|
|
@@ -351,7 +380,7 @@ Set the aspect ratio of the camera preview.
|
|
|
351
380
|
|
|
352
381
|
**Returns:** <code>Promise<{ width: number; height: number; x: number; y: number; }></code>
|
|
353
382
|
|
|
354
|
-
**Since:** 7.
|
|
383
|
+
**Since:** 7.5.0
|
|
355
384
|
|
|
356
385
|
--------------------
|
|
357
386
|
|
|
@@ -359,14 +388,14 @@ Set the aspect ratio of the camera preview.
|
|
|
359
388
|
### getAspectRatio()
|
|
360
389
|
|
|
361
390
|
```typescript
|
|
362
|
-
getAspectRatio() => Promise<{ aspectRatio:
|
|
391
|
+
getAspectRatio() => Promise<{ aspectRatio: "4:3" | "16:9"; }>
|
|
363
392
|
```
|
|
364
393
|
|
|
365
394
|
Gets the current aspect ratio of the camera preview.
|
|
366
395
|
|
|
367
396
|
**Returns:** <code>Promise<{ aspectRatio: '4:3' | '16:9'; }></code>
|
|
368
397
|
|
|
369
|
-
**Since:** 7.
|
|
398
|
+
**Since:** 7.5.0
|
|
370
399
|
|
|
371
400
|
--------------------
|
|
372
401
|
|
|
@@ -523,7 +552,7 @@ Checks if the camera preview is currently running.
|
|
|
523
552
|
|
|
524
553
|
**Returns:** <code>Promise<{ isRunning: boolean; }></code>
|
|
525
554
|
|
|
526
|
-
**Since:** 7.
|
|
555
|
+
**Since:** 7.5.0
|
|
527
556
|
|
|
528
557
|
--------------------
|
|
529
558
|
|
|
@@ -538,7 +567,7 @@ Gets all available camera devices.
|
|
|
538
567
|
|
|
539
568
|
**Returns:** <code>Promise<{ devices: CameraDevice[]; }></code>
|
|
540
569
|
|
|
541
|
-
**Since:** 7.
|
|
570
|
+
**Since:** 7.5.0
|
|
542
571
|
|
|
543
572
|
--------------------
|
|
544
573
|
|
|
@@ -553,7 +582,24 @@ Gets the current zoom state, including min/max and current lens info.
|
|
|
553
582
|
|
|
554
583
|
**Returns:** <code>Promise<{ min: number; max: number; current: number; lens: <a href="#lensinfo">LensInfo</a>; }></code>
|
|
555
584
|
|
|
556
|
-
**Since:** 7.
|
|
585
|
+
**Since:** 7.5.0
|
|
586
|
+
|
|
587
|
+
--------------------
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
### getZoomButtonValues()
|
|
591
|
+
|
|
592
|
+
```typescript
|
|
593
|
+
getZoomButtonValues() => Promise<{ values: number[]; }>
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
Returns zoom button values for quick switching.
|
|
597
|
+
- iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available
|
|
598
|
+
- Web: unsupported
|
|
599
|
+
|
|
600
|
+
**Returns:** <code>Promise<{ values: number[]; }></code>
|
|
601
|
+
|
|
602
|
+
**Since:** 7.5.0
|
|
557
603
|
|
|
558
604
|
--------------------
|
|
559
605
|
|
|
@@ -561,16 +607,16 @@ Gets the current zoom state, including min/max and current lens info.
|
|
|
561
607
|
### setZoom(...)
|
|
562
608
|
|
|
563
609
|
```typescript
|
|
564
|
-
setZoom(options: { level: number; ramp?: boolean; }) => Promise<void>
|
|
610
|
+
setZoom(options: { level: number; ramp?: boolean; autoFocus?: boolean; }) => Promise<void>
|
|
565
611
|
```
|
|
566
612
|
|
|
567
|
-
Sets the
|
|
613
|
+
Sets the zoom level of the camera.
|
|
568
614
|
|
|
569
|
-
| Param | Type
|
|
570
|
-
| ------------- |
|
|
571
|
-
| **`options`** | <code>{ level: number; ramp?: boolean; }</code> | - The desired zoom level. `ramp` is currently unused. |
|
|
615
|
+
| Param | Type | Description |
|
|
616
|
+
| ------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
617
|
+
| **`options`** | <code>{ level: number; ramp?: boolean; autoFocus?: boolean; }</code> | - The desired zoom level. `ramp` is currently unused. `autoFocus` defaults to true. |
|
|
572
618
|
|
|
573
|
-
**Since:** 7.
|
|
619
|
+
**Since:** 7.5.0
|
|
574
620
|
|
|
575
621
|
--------------------
|
|
576
622
|
|
|
@@ -585,7 +631,7 @@ Gets the current flash mode.
|
|
|
585
631
|
|
|
586
632
|
**Returns:** <code>Promise<{ flashMode: <a href="#camerapreviewflashmode">CameraPreviewFlashMode</a>; }></code>
|
|
587
633
|
|
|
588
|
-
**Since:** 7.
|
|
634
|
+
**Since:** 7.5.0
|
|
589
635
|
|
|
590
636
|
--------------------
|
|
591
637
|
|
|
@@ -598,7 +644,7 @@ removeAllListeners() => Promise<void>
|
|
|
598
644
|
|
|
599
645
|
Removes all registered listeners.
|
|
600
646
|
|
|
601
|
-
**Since:** 7.
|
|
647
|
+
**Since:** 7.5.0
|
|
602
648
|
|
|
603
649
|
--------------------
|
|
604
650
|
|
|
@@ -615,7 +661,7 @@ Switches the active camera to the one with the specified `deviceId`.
|
|
|
615
661
|
| ------------- | ---------------------------------- | ------------------------------------ |
|
|
616
662
|
| **`options`** | <code>{ deviceId: string; }</code> | - The ID of the device to switch to. |
|
|
617
663
|
|
|
618
|
-
**Since:** 7.
|
|
664
|
+
**Since:** 7.5.0
|
|
619
665
|
|
|
620
666
|
--------------------
|
|
621
667
|
|
|
@@ -630,7 +676,7 @@ Gets the ID of the currently active camera device.
|
|
|
630
676
|
|
|
631
677
|
**Returns:** <code>Promise<{ deviceId: string; }></code>
|
|
632
678
|
|
|
633
|
-
**Since:** 7.
|
|
679
|
+
**Since:** 7.5.0
|
|
634
680
|
|
|
635
681
|
--------------------
|
|
636
682
|
|
|
@@ -645,23 +691,140 @@ Gets the current preview size and position.
|
|
|
645
691
|
|
|
646
692
|
**Returns:** <code>Promise<{ x: number; y: number; width: number; height: number; }></code>
|
|
647
693
|
|
|
694
|
+
**Since:** 7.5.0
|
|
695
|
+
|
|
648
696
|
--------------------
|
|
649
697
|
|
|
650
698
|
|
|
651
699
|
### setPreviewSize(...)
|
|
652
700
|
|
|
653
701
|
```typescript
|
|
654
|
-
setPreviewSize(options: { x
|
|
702
|
+
setPreviewSize(options: { x?: number; y?: number; width: number; height: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>
|
|
655
703
|
```
|
|
656
704
|
|
|
657
705
|
Sets the preview size and position.
|
|
658
706
|
|
|
659
|
-
| Param | Type
|
|
660
|
-
| ------------- |
|
|
661
|
-
| **`options`** | <code>{ x
|
|
707
|
+
| Param | Type | Description |
|
|
708
|
+
| ------------- | ----------------------------------------------------------------------- | -------------------------------- |
|
|
709
|
+
| **`options`** | <code>{ x?: number; y?: number; width: number; height: number; }</code> | The new position and dimensions. |
|
|
662
710
|
|
|
663
711
|
**Returns:** <code>Promise<{ width: number; height: number; x: number; y: number; }></code>
|
|
664
712
|
|
|
713
|
+
**Since:** 7.5.0
|
|
714
|
+
|
|
715
|
+
--------------------
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
### setFocus(...)
|
|
719
|
+
|
|
720
|
+
```typescript
|
|
721
|
+
setFocus(options: { x: number; y: number; }) => Promise<void>
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
Sets the camera focus to a specific point in the preview.
|
|
725
|
+
|
|
726
|
+
| Param | Type | Description |
|
|
727
|
+
| ------------- | -------------------------------------- | -------------------- |
|
|
728
|
+
| **`options`** | <code>{ x: number; y: number; }</code> | - The focus options. |
|
|
729
|
+
|
|
730
|
+
**Since:** 7.5.0
|
|
731
|
+
|
|
732
|
+
--------------------
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
### addListener('screenResize', ...)
|
|
736
|
+
|
|
737
|
+
```typescript
|
|
738
|
+
addListener(eventName: "screenResize", listenerFunc: (data: { width: number; height: number; x: number; y: number; }) => void) => Promise<PluginListenerHandle>
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
Adds a listener for screen resize events.
|
|
742
|
+
|
|
743
|
+
| Param | Type | Description |
|
|
744
|
+
| ------------------ | ---------------------------------------------------------------------------------------- | --------------------------------------------------- |
|
|
745
|
+
| **`eventName`** | <code>'screenResize'</code> | - The event name to listen for. |
|
|
746
|
+
| **`listenerFunc`** | <code>(data: { width: number; height: number; x: number; y: number; }) => void</code> | - The function to call when the event is triggered. |
|
|
747
|
+
|
|
748
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
749
|
+
|
|
750
|
+
**Since:** 7.5.0
|
|
751
|
+
|
|
752
|
+
--------------------
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
### addListener('orientationChange', ...)
|
|
756
|
+
|
|
757
|
+
```typescript
|
|
758
|
+
addListener(eventName: "orientationChange", listenerFunc: (data: { orientation: DeviceOrientation; }) => void) => Promise<PluginListenerHandle>
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
Adds a listener for orientation change events.
|
|
762
|
+
|
|
763
|
+
| Param | Type | Description |
|
|
764
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
|
|
765
|
+
| **`eventName`** | <code>'orientationChange'</code> | - The event name to listen for. |
|
|
766
|
+
| **`listenerFunc`** | <code>(data: { orientation: <a href="#deviceorientation">DeviceOrientation</a>; }) => void</code> | - The function to call when the event is triggered. |
|
|
767
|
+
|
|
768
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
769
|
+
|
|
770
|
+
**Since:** 7.5.0
|
|
771
|
+
|
|
772
|
+
--------------------
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
### deleteFile(...)
|
|
776
|
+
|
|
777
|
+
```typescript
|
|
778
|
+
deleteFile(options: { path: string; }) => Promise<{ success: boolean; }>
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
Deletes a file at the given absolute path on the device.
|
|
782
|
+
Use this to quickly clean up temporary images created with `storeToFile`.
|
|
783
|
+
On web, this is not supported and will throw.
|
|
784
|
+
|
|
785
|
+
| Param | Type |
|
|
786
|
+
| ------------- | ------------------------------ |
|
|
787
|
+
| **`options`** | <code>{ path: string; }</code> |
|
|
788
|
+
|
|
789
|
+
**Returns:** <code>Promise<{ success: boolean; }></code>
|
|
790
|
+
|
|
791
|
+
**Since:** 7.5.0
|
|
792
|
+
|
|
793
|
+
--------------------
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
### getSafeAreaInsets()
|
|
797
|
+
|
|
798
|
+
```typescript
|
|
799
|
+
getSafeAreaInsets() => Promise<SafeAreaInsets>
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
Gets the safe area insets for devices.
|
|
803
|
+
Returns the orientation-aware notch/camera cutout inset and the current orientation.
|
|
804
|
+
In portrait mode: returns top inset (notch at top).
|
|
805
|
+
In landscape mode: returns left inset (notch moved to side).
|
|
806
|
+
This specifically targets the cutout area (notch, punch hole, etc.) that all modern phones have.
|
|
807
|
+
|
|
808
|
+
Android: Values returned in dp (logical pixels).
|
|
809
|
+
iOS: Values returned in physical pixels, excluding status bar (only pure notch/cutout size).
|
|
810
|
+
|
|
811
|
+
**Returns:** <code>Promise<<a href="#safeareainsets">SafeAreaInsets</a>></code>
|
|
812
|
+
|
|
813
|
+
--------------------
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
### getOrientation()
|
|
817
|
+
|
|
818
|
+
```typescript
|
|
819
|
+
getOrientation() => Promise<{ orientation: DeviceOrientation; }>
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
Gets the current device orientation in a cross-platform format.
|
|
823
|
+
|
|
824
|
+
**Returns:** <code>Promise<{ orientation: <a href="#deviceorientation">DeviceOrientation</a>; }></code>
|
|
825
|
+
|
|
826
|
+
**Since:** 7.5.0
|
|
827
|
+
|
|
665
828
|
--------------------
|
|
666
829
|
|
|
667
830
|
|
|
@@ -672,30 +835,31 @@ Sets the preview size and position.
|
|
|
672
835
|
|
|
673
836
|
Defines the configuration options for starting the camera preview.
|
|
674
837
|
|
|
675
|
-
| Prop | Type
|
|
676
|
-
| ---------------------------------- |
|
|
677
|
-
| **`parent`** | <code>string</code>
|
|
678
|
-
| **`className`** | <code>string</code>
|
|
679
|
-
| **`width`** | <code>number</code>
|
|
680
|
-
| **`height`** | <code>number</code>
|
|
681
|
-
| **`x`** | <code>number</code>
|
|
682
|
-
| **`y`** | <code>number</code>
|
|
683
|
-
| **`aspectRatio`** | <code>'4:3' \| '16:9'
|
|
684
|
-
| **`gridMode`** | <code><a href="#gridmode">GridMode</a></code>
|
|
685
|
-
| **`includeSafeAreaInsets`** | <code>boolean</code>
|
|
686
|
-
| **`toBack`** | <code>boolean</code>
|
|
687
|
-
| **`paddingBottom`** | <code>number</code>
|
|
688
|
-
| **`rotateWhenOrientationChanged`** | <code>boolean</code>
|
|
689
|
-
| **`position`** | <code>string</code>
|
|
690
|
-
| **`storeToFile`** | <code>boolean</code>
|
|
691
|
-
| **`disableExifHeaderStripping`** | <code>boolean</code>
|
|
692
|
-
| **`
|
|
693
|
-
| **`
|
|
694
|
-
| **`
|
|
695
|
-
| **`
|
|
696
|
-
| **`
|
|
697
|
-
| **`
|
|
698
|
-
| **`
|
|
838
|
+
| Prop | Type | Description | Default | Since |
|
|
839
|
+
| ---------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ----- |
|
|
840
|
+
| **`parent`** | <code>string</code> | The parent element to attach the video preview to. | | |
|
|
841
|
+
| **`className`** | <code>string</code> | A CSS class name to add to the preview element. | | |
|
|
842
|
+
| **`width`** | <code>number</code> | The width of the preview in pixels. Defaults to the screen width. | | |
|
|
843
|
+
| **`height`** | <code>number</code> | The height of the preview in pixels. Defaults to the screen height. | | |
|
|
844
|
+
| **`x`** | <code>number</code> | The horizontal origin of the preview, in pixels. | | |
|
|
845
|
+
| **`y`** | <code>number</code> | The vertical origin of the preview, in pixels. | | |
|
|
846
|
+
| **`aspectRatio`** | <code>'4:3' \| '16:9'</code> | The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'. Cannot be set if width or height is provided, otherwise the call will be rejected. Use setPreviewSize to adjust size after starting. | | 2.0.0 |
|
|
847
|
+
| **`gridMode`** | <code><a href="#gridmode">GridMode</a></code> | The grid overlay to display on the camera preview. | <code>"none"</code> | 2.1.0 |
|
|
848
|
+
| **`includeSafeAreaInsets`** | <code>boolean</code> | Adjusts the y-position to account for safe areas (e.g., notches). | <code>false</code> | |
|
|
849
|
+
| **`toBack`** | <code>boolean</code> | If true, places the preview behind the webview. | <code>true</code> | |
|
|
850
|
+
| **`paddingBottom`** | <code>number</code> | Bottom padding for the preview, in pixels. | | |
|
|
851
|
+
| **`rotateWhenOrientationChanged`** | <code>boolean</code> | Whether to rotate the preview when the device orientation changes. | <code>true</code> | |
|
|
852
|
+
| **`position`** | <code>string</code> | The camera to use. | <code>"rear"</code> | |
|
|
853
|
+
| **`storeToFile`** | <code>boolean</code> | If true, saves the captured image to a file and returns the file path. If false, returns a base64 encoded string. | <code>false</code> | |
|
|
854
|
+
| **`disableExifHeaderStripping`** | <code>boolean</code> | If true, prevents the plugin from rotating the image based on EXIF data. | <code>false</code> | |
|
|
855
|
+
| **`disableAudio`** | <code>boolean</code> | If true, disables the audio stream, preventing audio permission requests. | <code>true</code> | |
|
|
856
|
+
| **`lockAndroidOrientation`** | <code>boolean</code> | If true, locks the device orientation while the camera is active. | <code>false</code> | |
|
|
857
|
+
| **`enableOpacity`** | <code>boolean</code> | If true, allows the camera preview's opacity to be changed. | <code>false</code> | |
|
|
858
|
+
| **`enableZoom`** | <code>boolean</code> | If true, enables pinch-to-zoom functionality on the preview. | <code>false</code> | |
|
|
859
|
+
| **`enableVideoMode`** | <code>boolean</code> | If true, uses the video-optimized preset for the camera session. | <code>false</code> | |
|
|
860
|
+
| **`deviceId`** | <code>string</code> | The `deviceId` of the camera to use. If provided, `position` is ignored. | | |
|
|
861
|
+
| **`initialZoomLevel`** | <code>number</code> | The initial zoom level when starting the camera preview. If the requested zoom level is not available, the native plugin will reject. | <code>1.0</code> | 2.2.0 |
|
|
862
|
+
| **`positioning`** | <code><a href="#camerapositioning">CameraPositioning</a></code> | The vertical positioning of the camera preview. | <code>"center"</code> | 2.3.0 |
|
|
699
863
|
|
|
700
864
|
|
|
701
865
|
#### ExifData
|
|
@@ -709,8 +873,9 @@ Defines the options for capturing a picture.
|
|
|
709
873
|
|
|
710
874
|
| Prop | Type | Description | Default | Since |
|
|
711
875
|
| ---------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------- | ----- |
|
|
712
|
-
| **`height`** | <code>number</code> |
|
|
713
|
-
| **`width`** | <code>number</code> |
|
|
876
|
+
| **`height`** | <code>number</code> | | | |
|
|
877
|
+
| **`width`** | <code>number</code> | | | |
|
|
878
|
+
| **`aspectRatio`** | <code>string</code> | | | 7.7.0 |
|
|
714
879
|
| **`quality`** | <code>number</code> | The quality of the captured image, from 0 to 100. Does not apply to `png` format. | <code>85</code> | |
|
|
715
880
|
| **`format`** | <code><a href="#pictureformat">PictureFormat</a></code> | The format of the captured image. | <code>"jpeg"</code> | |
|
|
716
881
|
| **`saveToGallery`** | <code>boolean</code> | If true, the captured image will be saved to the user's gallery. | <code>false</code> | 7.5.0 |
|
|
@@ -796,6 +961,25 @@ Represents the detailed information of the currently active lens.
|
|
|
796
961
|
| **`digitalZoom`** | <code>number</code> | The current digital zoom factor applied on top of the base zoom. |
|
|
797
962
|
|
|
798
963
|
|
|
964
|
+
#### PluginListenerHandle
|
|
965
|
+
|
|
966
|
+
| Prop | Type |
|
|
967
|
+
| ------------ | ----------------------------------------- |
|
|
968
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
#### SafeAreaInsets
|
|
972
|
+
|
|
973
|
+
Represents safe area insets for devices.
|
|
974
|
+
Android: Values are expressed in logical pixels (dp) to match JS layout units.
|
|
975
|
+
iOS: Values are expressed in physical pixels and exclude status bar.
|
|
976
|
+
|
|
977
|
+
| Prop | Type | Description |
|
|
978
|
+
| ----------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
979
|
+
| **`orientation`** | <code>number</code> | Current device orientation (1 = portrait, 2 = landscape, 0 = unknown). |
|
|
980
|
+
| **`top`** | <code>number</code> | Orientation-aware notch/camera cutout inset (excluding status bar). In portrait mode: returns top inset (notch at top). In landscape mode: returns left inset (notch at side). Android: Value in dp, iOS: Value in pixels (status bar excluded). |
|
|
981
|
+
|
|
982
|
+
|
|
799
983
|
### Type Aliases
|
|
800
984
|
|
|
801
985
|
|
|
@@ -809,6 +993,11 @@ Represents the detailed information of the currently active lens.
|
|
|
809
993
|
<code>"rear" | "front"</code>
|
|
810
994
|
|
|
811
995
|
|
|
996
|
+
#### CameraPositioning
|
|
997
|
+
|
|
998
|
+
<code>"center" | "top" | "bottom"</code>
|
|
999
|
+
|
|
1000
|
+
|
|
812
1001
|
#### PictureFormat
|
|
813
1002
|
|
|
814
1003
|
<code>"jpeg" | "png"</code>
|
|
@@ -827,6 +1016,13 @@ The available flash modes for the camera.
|
|
|
827
1016
|
<code><a href="#camerapreviewflashmode">CameraPreviewFlashMode</a></code>
|
|
828
1017
|
|
|
829
1018
|
|
|
1019
|
+
#### DeviceOrientation
|
|
1020
|
+
|
|
1021
|
+
Canonical device orientation values across platforms.
|
|
1022
|
+
|
|
1023
|
+
<code>"portrait" | "landscape" | "landscape-left" | "landscape-right" | "portrait-upside-down" | "unknown"</code>
|
|
1024
|
+
|
|
1025
|
+
|
|
830
1026
|
### Enums
|
|
831
1027
|
|
|
832
1028
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
|
|
4
4
|
networkTimeout=10000
|
|
5
5
|
validateDistributionUrl=true
|
|
6
6
|
zipStoreBase=GRADLE_USER_HOME
|