@capgo/camera-preview 7.4.0-beta.9 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +242 -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 +441 -40
- package/dist/esm/definitions.d.ts +167 -25
- 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,24 @@ 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
|
+
// Take a picture and get a file path
|
|
87
|
+
const { value: filePath } = await CameraPreview.capture({ quality: 85, storeToFile: true })
|
|
88
|
+
|
|
89
|
+
// Convert the file to base64 entirely on the JS side (fast, no bridge)
|
|
90
|
+
const base64 = await getBase64FromFilePath(filePath)
|
|
91
|
+
|
|
92
|
+
// Optionally cleanup the temp file natively
|
|
93
|
+
await CameraPreview.deleteFile({ path: filePath })
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
|
|
79
97
|
# Installation
|
|
80
98
|
|
|
81
99
|
```
|
|
@@ -234,6 +252,7 @@ Documentation for the [uploader](https://github.com/Cap-go/capacitor-uploader)
|
|
|
234
252
|
* [`isRunning()`](#isrunning)
|
|
235
253
|
* [`getAvailableDevices()`](#getavailabledevices)
|
|
236
254
|
* [`getZoom()`](#getzoom)
|
|
255
|
+
* [`getZoomButtonValues()`](#getzoombuttonvalues)
|
|
237
256
|
* [`setZoom(...)`](#setzoom)
|
|
238
257
|
* [`getFlashMode()`](#getflashmode)
|
|
239
258
|
* [`removeAllListeners()`](#removealllisteners)
|
|
@@ -241,6 +260,12 @@ Documentation for the [uploader](https://github.com/Cap-go/capacitor-uploader)
|
|
|
241
260
|
* [`getDeviceId()`](#getdeviceid)
|
|
242
261
|
* [`getPreviewSize()`](#getpreviewsize)
|
|
243
262
|
* [`setPreviewSize(...)`](#setpreviewsize)
|
|
263
|
+
* [`setFocus(...)`](#setfocus)
|
|
264
|
+
* [`addListener('screenResize', ...)`](#addlistenerscreenresize-)
|
|
265
|
+
* [`addListener('orientationChange', ...)`](#addlistenerorientationchange-)
|
|
266
|
+
* [`deleteFile(...)`](#deletefile)
|
|
267
|
+
* [`getSafeAreaInsets()`](#getsafeareainsets)
|
|
268
|
+
* [`getOrientation()`](#getorientation)
|
|
244
269
|
* [Interfaces](#interfaces)
|
|
245
270
|
* [Type Aliases](#type-aliases)
|
|
246
271
|
* [Enums](#enums)
|
|
@@ -340,7 +365,7 @@ Gets the flash modes supported by the active camera.
|
|
|
340
365
|
### setAspectRatio(...)
|
|
341
366
|
|
|
342
367
|
```typescript
|
|
343
|
-
setAspectRatio(options: { aspectRatio:
|
|
368
|
+
setAspectRatio(options: { aspectRatio: "4:3" | "16:9"; x?: number; y?: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>
|
|
344
369
|
```
|
|
345
370
|
|
|
346
371
|
Set the aspect ratio of the camera preview.
|
|
@@ -351,7 +376,7 @@ Set the aspect ratio of the camera preview.
|
|
|
351
376
|
|
|
352
377
|
**Returns:** <code>Promise<{ width: number; height: number; x: number; y: number; }></code>
|
|
353
378
|
|
|
354
|
-
**Since:** 7.
|
|
379
|
+
**Since:** 7.5.0
|
|
355
380
|
|
|
356
381
|
--------------------
|
|
357
382
|
|
|
@@ -359,14 +384,14 @@ Set the aspect ratio of the camera preview.
|
|
|
359
384
|
### getAspectRatio()
|
|
360
385
|
|
|
361
386
|
```typescript
|
|
362
|
-
getAspectRatio() => Promise<{ aspectRatio:
|
|
387
|
+
getAspectRatio() => Promise<{ aspectRatio: "4:3" | "16:9"; }>
|
|
363
388
|
```
|
|
364
389
|
|
|
365
390
|
Gets the current aspect ratio of the camera preview.
|
|
366
391
|
|
|
367
392
|
**Returns:** <code>Promise<{ aspectRatio: '4:3' | '16:9'; }></code>
|
|
368
393
|
|
|
369
|
-
**Since:** 7.
|
|
394
|
+
**Since:** 7.5.0
|
|
370
395
|
|
|
371
396
|
--------------------
|
|
372
397
|
|
|
@@ -523,7 +548,7 @@ Checks if the camera preview is currently running.
|
|
|
523
548
|
|
|
524
549
|
**Returns:** <code>Promise<{ isRunning: boolean; }></code>
|
|
525
550
|
|
|
526
|
-
**Since:** 7.
|
|
551
|
+
**Since:** 7.5.0
|
|
527
552
|
|
|
528
553
|
--------------------
|
|
529
554
|
|
|
@@ -538,7 +563,7 @@ Gets all available camera devices.
|
|
|
538
563
|
|
|
539
564
|
**Returns:** <code>Promise<{ devices: CameraDevice[]; }></code>
|
|
540
565
|
|
|
541
|
-
**Since:** 7.
|
|
566
|
+
**Since:** 7.5.0
|
|
542
567
|
|
|
543
568
|
--------------------
|
|
544
569
|
|
|
@@ -553,7 +578,24 @@ Gets the current zoom state, including min/max and current lens info.
|
|
|
553
578
|
|
|
554
579
|
**Returns:** <code>Promise<{ min: number; max: number; current: number; lens: <a href="#lensinfo">LensInfo</a>; }></code>
|
|
555
580
|
|
|
556
|
-
**Since:** 7.
|
|
581
|
+
**Since:** 7.5.0
|
|
582
|
+
|
|
583
|
+
--------------------
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
### getZoomButtonValues()
|
|
587
|
+
|
|
588
|
+
```typescript
|
|
589
|
+
getZoomButtonValues() => Promise<{ values: number[]; }>
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
Returns zoom button values for quick switching.
|
|
593
|
+
- iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available
|
|
594
|
+
- Web: unsupported
|
|
595
|
+
|
|
596
|
+
**Returns:** <code>Promise<{ values: number[]; }></code>
|
|
597
|
+
|
|
598
|
+
**Since:** 7.5.0
|
|
557
599
|
|
|
558
600
|
--------------------
|
|
559
601
|
|
|
@@ -561,16 +603,16 @@ Gets the current zoom state, including min/max and current lens info.
|
|
|
561
603
|
### setZoom(...)
|
|
562
604
|
|
|
563
605
|
```typescript
|
|
564
|
-
setZoom(options: { level: number; ramp?: boolean; }) => Promise<void>
|
|
606
|
+
setZoom(options: { level: number; ramp?: boolean; autoFocus?: boolean; }) => Promise<void>
|
|
565
607
|
```
|
|
566
608
|
|
|
567
|
-
Sets the
|
|
609
|
+
Sets the zoom level of the camera.
|
|
568
610
|
|
|
569
|
-
| Param | Type
|
|
570
|
-
| ------------- |
|
|
571
|
-
| **`options`** | <code>{ level: number; ramp?: boolean; }</code> | - The desired zoom level. `ramp` is currently unused. |
|
|
611
|
+
| Param | Type | Description |
|
|
612
|
+
| ------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
613
|
+
| **`options`** | <code>{ level: number; ramp?: boolean; autoFocus?: boolean; }</code> | - The desired zoom level. `ramp` is currently unused. `autoFocus` defaults to true. |
|
|
572
614
|
|
|
573
|
-
**Since:** 7.
|
|
615
|
+
**Since:** 7.5.0
|
|
574
616
|
|
|
575
617
|
--------------------
|
|
576
618
|
|
|
@@ -585,7 +627,7 @@ Gets the current flash mode.
|
|
|
585
627
|
|
|
586
628
|
**Returns:** <code>Promise<{ flashMode: <a href="#camerapreviewflashmode">CameraPreviewFlashMode</a>; }></code>
|
|
587
629
|
|
|
588
|
-
**Since:** 7.
|
|
630
|
+
**Since:** 7.5.0
|
|
589
631
|
|
|
590
632
|
--------------------
|
|
591
633
|
|
|
@@ -598,7 +640,7 @@ removeAllListeners() => Promise<void>
|
|
|
598
640
|
|
|
599
641
|
Removes all registered listeners.
|
|
600
642
|
|
|
601
|
-
**Since:** 7.
|
|
643
|
+
**Since:** 7.5.0
|
|
602
644
|
|
|
603
645
|
--------------------
|
|
604
646
|
|
|
@@ -615,7 +657,7 @@ Switches the active camera to the one with the specified `deviceId`.
|
|
|
615
657
|
| ------------- | ---------------------------------- | ------------------------------------ |
|
|
616
658
|
| **`options`** | <code>{ deviceId: string; }</code> | - The ID of the device to switch to. |
|
|
617
659
|
|
|
618
|
-
**Since:** 7.
|
|
660
|
+
**Since:** 7.5.0
|
|
619
661
|
|
|
620
662
|
--------------------
|
|
621
663
|
|
|
@@ -630,7 +672,7 @@ Gets the ID of the currently active camera device.
|
|
|
630
672
|
|
|
631
673
|
**Returns:** <code>Promise<{ deviceId: string; }></code>
|
|
632
674
|
|
|
633
|
-
**Since:** 7.
|
|
675
|
+
**Since:** 7.5.0
|
|
634
676
|
|
|
635
677
|
--------------------
|
|
636
678
|
|
|
@@ -645,23 +687,140 @@ Gets the current preview size and position.
|
|
|
645
687
|
|
|
646
688
|
**Returns:** <code>Promise<{ x: number; y: number; width: number; height: number; }></code>
|
|
647
689
|
|
|
690
|
+
**Since:** 7.5.0
|
|
691
|
+
|
|
648
692
|
--------------------
|
|
649
693
|
|
|
650
694
|
|
|
651
695
|
### setPreviewSize(...)
|
|
652
696
|
|
|
653
697
|
```typescript
|
|
654
|
-
setPreviewSize(options: { x
|
|
698
|
+
setPreviewSize(options: { x?: number; y?: number; width: number; height: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>
|
|
655
699
|
```
|
|
656
700
|
|
|
657
701
|
Sets the preview size and position.
|
|
658
702
|
|
|
659
|
-
| Param | Type
|
|
660
|
-
| ------------- |
|
|
661
|
-
| **`options`** | <code>{ x
|
|
703
|
+
| Param | Type | Description |
|
|
704
|
+
| ------------- | ----------------------------------------------------------------------- | -------------------------------- |
|
|
705
|
+
| **`options`** | <code>{ x?: number; y?: number; width: number; height: number; }</code> | The new position and dimensions. |
|
|
662
706
|
|
|
663
707
|
**Returns:** <code>Promise<{ width: number; height: number; x: number; y: number; }></code>
|
|
664
708
|
|
|
709
|
+
**Since:** 7.5.0
|
|
710
|
+
|
|
711
|
+
--------------------
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
### setFocus(...)
|
|
715
|
+
|
|
716
|
+
```typescript
|
|
717
|
+
setFocus(options: { x: number; y: number; }) => Promise<void>
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
Sets the camera focus to a specific point in the preview.
|
|
721
|
+
|
|
722
|
+
| Param | Type | Description |
|
|
723
|
+
| ------------- | -------------------------------------- | -------------------- |
|
|
724
|
+
| **`options`** | <code>{ x: number; y: number; }</code> | - The focus options. |
|
|
725
|
+
|
|
726
|
+
**Since:** 7.5.0
|
|
727
|
+
|
|
728
|
+
--------------------
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
### addListener('screenResize', ...)
|
|
732
|
+
|
|
733
|
+
```typescript
|
|
734
|
+
addListener(eventName: "screenResize", listenerFunc: (data: { width: number; height: number; x: number; y: number; }) => void) => Promise<PluginListenerHandle>
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
Adds a listener for screen resize events.
|
|
738
|
+
|
|
739
|
+
| Param | Type | Description |
|
|
740
|
+
| ------------------ | ---------------------------------------------------------------------------------------- | --------------------------------------------------- |
|
|
741
|
+
| **`eventName`** | <code>'screenResize'</code> | - The event name to listen for. |
|
|
742
|
+
| **`listenerFunc`** | <code>(data: { width: number; height: number; x: number; y: number; }) => void</code> | - The function to call when the event is triggered. |
|
|
743
|
+
|
|
744
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
745
|
+
|
|
746
|
+
**Since:** 7.5.0
|
|
747
|
+
|
|
748
|
+
--------------------
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
### addListener('orientationChange', ...)
|
|
752
|
+
|
|
753
|
+
```typescript
|
|
754
|
+
addListener(eventName: "orientationChange", listenerFunc: (data: { orientation: DeviceOrientation; }) => void) => Promise<PluginListenerHandle>
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
Adds a listener for orientation change events.
|
|
758
|
+
|
|
759
|
+
| Param | Type | Description |
|
|
760
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
|
|
761
|
+
| **`eventName`** | <code>'orientationChange'</code> | - The event name to listen for. |
|
|
762
|
+
| **`listenerFunc`** | <code>(data: { orientation: <a href="#deviceorientation">DeviceOrientation</a>; }) => void</code> | - The function to call when the event is triggered. |
|
|
763
|
+
|
|
764
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
765
|
+
|
|
766
|
+
**Since:** 7.5.0
|
|
767
|
+
|
|
768
|
+
--------------------
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
### deleteFile(...)
|
|
772
|
+
|
|
773
|
+
```typescript
|
|
774
|
+
deleteFile(options: { path: string; }) => Promise<{ success: boolean; }>
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
Deletes a file at the given absolute path on the device.
|
|
778
|
+
Use this to quickly clean up temporary images created with `storeToFile`.
|
|
779
|
+
On web, this is not supported and will throw.
|
|
780
|
+
|
|
781
|
+
| Param | Type |
|
|
782
|
+
| ------------- | ------------------------------ |
|
|
783
|
+
| **`options`** | <code>{ path: string; }</code> |
|
|
784
|
+
|
|
785
|
+
**Returns:** <code>Promise<{ success: boolean; }></code>
|
|
786
|
+
|
|
787
|
+
**Since:** 7.5.0
|
|
788
|
+
|
|
789
|
+
--------------------
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
### getSafeAreaInsets()
|
|
793
|
+
|
|
794
|
+
```typescript
|
|
795
|
+
getSafeAreaInsets() => Promise<SafeAreaInsets>
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
Gets the safe area insets for devices.
|
|
799
|
+
Returns the orientation-aware notch/camera cutout inset and the current orientation.
|
|
800
|
+
In portrait mode: returns top inset (notch at top).
|
|
801
|
+
In landscape mode: returns left inset (notch moved to side).
|
|
802
|
+
This specifically targets the cutout area (notch, punch hole, etc.) that all modern phones have.
|
|
803
|
+
|
|
804
|
+
Android: Values returned in dp (logical pixels).
|
|
805
|
+
iOS: Values returned in physical pixels, excluding status bar (only pure notch/cutout size).
|
|
806
|
+
|
|
807
|
+
**Returns:** <code>Promise<<a href="#safeareainsets">SafeAreaInsets</a>></code>
|
|
808
|
+
|
|
809
|
+
--------------------
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
### getOrientation()
|
|
813
|
+
|
|
814
|
+
```typescript
|
|
815
|
+
getOrientation() => Promise<{ orientation: DeviceOrientation; }>
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
Gets the current device orientation in a cross-platform format.
|
|
819
|
+
|
|
820
|
+
**Returns:** <code>Promise<{ orientation: <a href="#deviceorientation">DeviceOrientation</a>; }></code>
|
|
821
|
+
|
|
822
|
+
**Since:** 7.5.0
|
|
823
|
+
|
|
665
824
|
--------------------
|
|
666
825
|
|
|
667
826
|
|
|
@@ -672,30 +831,31 @@ Sets the preview size and position.
|
|
|
672
831
|
|
|
673
832
|
Defines the configuration options for starting the camera preview.
|
|
674
833
|
|
|
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
|
-
| **`
|
|
834
|
+
| Prop | Type | Description | Default | Since |
|
|
835
|
+
| ---------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ----- |
|
|
836
|
+
| **`parent`** | <code>string</code> | The parent element to attach the video preview to. | | |
|
|
837
|
+
| **`className`** | <code>string</code> | A CSS class name to add to the preview element. | | |
|
|
838
|
+
| **`width`** | <code>number</code> | The width of the preview in pixels. Defaults to the screen width. | | |
|
|
839
|
+
| **`height`** | <code>number</code> | The height of the preview in pixels. Defaults to the screen height. | | |
|
|
840
|
+
| **`x`** | <code>number</code> | The horizontal origin of the preview, in pixels. | | |
|
|
841
|
+
| **`y`** | <code>number</code> | The vertical origin of the preview, in pixels. | | |
|
|
842
|
+
| **`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 |
|
|
843
|
+
| **`gridMode`** | <code><a href="#gridmode">GridMode</a></code> | The grid overlay to display on the camera preview. | <code>"none"</code> | 2.1.0 |
|
|
844
|
+
| **`includeSafeAreaInsets`** | <code>boolean</code> | Adjusts the y-position to account for safe areas (e.g., notches). | <code>false</code> | |
|
|
845
|
+
| **`toBack`** | <code>boolean</code> | If true, places the preview behind the webview. | <code>true</code> | |
|
|
846
|
+
| **`paddingBottom`** | <code>number</code> | Bottom padding for the preview, in pixels. | | |
|
|
847
|
+
| **`rotateWhenOrientationChanged`** | <code>boolean</code> | Whether to rotate the preview when the device orientation changes. | <code>true</code> | |
|
|
848
|
+
| **`position`** | <code>string</code> | The camera to use. | <code>"rear"</code> | |
|
|
849
|
+
| **`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> | |
|
|
850
|
+
| **`disableExifHeaderStripping`** | <code>boolean</code> | If true, prevents the plugin from rotating the image based on EXIF data. | <code>false</code> | |
|
|
851
|
+
| **`disableAudio`** | <code>boolean</code> | If true, disables the audio stream, preventing audio permission requests. | <code>true</code> | |
|
|
852
|
+
| **`lockAndroidOrientation`** | <code>boolean</code> | If true, locks the device orientation while the camera is active. | <code>false</code> | |
|
|
853
|
+
| **`enableOpacity`** | <code>boolean</code> | If true, allows the camera preview's opacity to be changed. | <code>false</code> | |
|
|
854
|
+
| **`enableZoom`** | <code>boolean</code> | If true, enables pinch-to-zoom functionality on the preview. | <code>false</code> | |
|
|
855
|
+
| **`enableVideoMode`** | <code>boolean</code> | If true, uses the video-optimized preset for the camera session. | <code>false</code> | |
|
|
856
|
+
| **`deviceId`** | <code>string</code> | The `deviceId` of the camera to use. If provided, `position` is ignored. | | |
|
|
857
|
+
| **`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 |
|
|
858
|
+
| **`positioning`** | <code><a href="#camerapositioning">CameraPositioning</a></code> | The vertical positioning of the camera preview. | <code>"center"</code> | 2.3.0 |
|
|
699
859
|
|
|
700
860
|
|
|
701
861
|
#### ExifData
|
|
@@ -709,8 +869,9 @@ Defines the options for capturing a picture.
|
|
|
709
869
|
|
|
710
870
|
| Prop | Type | Description | Default | Since |
|
|
711
871
|
| ---------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------- | ----- |
|
|
712
|
-
| **`height`** | <code>number</code> |
|
|
713
|
-
| **`width`** | <code>number</code> |
|
|
872
|
+
| **`height`** | <code>number</code> | | | |
|
|
873
|
+
| **`width`** | <code>number</code> | | | |
|
|
874
|
+
| **`aspectRatio`** | <code>string</code> | | | 7.7.0 |
|
|
714
875
|
| **`quality`** | <code>number</code> | The quality of the captured image, from 0 to 100. Does not apply to `png` format. | <code>85</code> | |
|
|
715
876
|
| **`format`** | <code><a href="#pictureformat">PictureFormat</a></code> | The format of the captured image. | <code>"jpeg"</code> | |
|
|
716
877
|
| **`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 +957,25 @@ Represents the detailed information of the currently active lens.
|
|
|
796
957
|
| **`digitalZoom`** | <code>number</code> | The current digital zoom factor applied on top of the base zoom. |
|
|
797
958
|
|
|
798
959
|
|
|
960
|
+
#### PluginListenerHandle
|
|
961
|
+
|
|
962
|
+
| Prop | Type |
|
|
963
|
+
| ------------ | ----------------------------------------- |
|
|
964
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
#### SafeAreaInsets
|
|
968
|
+
|
|
969
|
+
Represents safe area insets for devices.
|
|
970
|
+
Android: Values are expressed in logical pixels (dp) to match JS layout units.
|
|
971
|
+
iOS: Values are expressed in physical pixels and exclude status bar.
|
|
972
|
+
|
|
973
|
+
| Prop | Type | Description |
|
|
974
|
+
| ----------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
975
|
+
| **`orientation`** | <code>number</code> | Current device orientation (1 = portrait, 2 = landscape, 0 = unknown). |
|
|
976
|
+
| **`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). |
|
|
977
|
+
|
|
978
|
+
|
|
799
979
|
### Type Aliases
|
|
800
980
|
|
|
801
981
|
|
|
@@ -809,6 +989,11 @@ Represents the detailed information of the currently active lens.
|
|
|
809
989
|
<code>"rear" | "front"</code>
|
|
810
990
|
|
|
811
991
|
|
|
992
|
+
#### CameraPositioning
|
|
993
|
+
|
|
994
|
+
<code>"center" | "top" | "bottom"</code>
|
|
995
|
+
|
|
996
|
+
|
|
812
997
|
#### PictureFormat
|
|
813
998
|
|
|
814
999
|
<code>"jpeg" | "png"</code>
|
|
@@ -827,6 +1012,13 @@ The available flash modes for the camera.
|
|
|
827
1012
|
<code><a href="#camerapreviewflashmode">CameraPreviewFlashMode</a></code>
|
|
828
1013
|
|
|
829
1014
|
|
|
1015
|
+
#### DeviceOrientation
|
|
1016
|
+
|
|
1017
|
+
Canonical device orientation values across platforms.
|
|
1018
|
+
|
|
1019
|
+
<code>"portrait" | "landscape" | "landscape-left" | "landscape-right" | "portrait-upside-down" | "unknown"</code>
|
|
1020
|
+
|
|
1021
|
+
|
|
830
1022
|
### Enums
|
|
831
1023
|
|
|
832
1024
|
|
|
@@ -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
|