@capgo/camera-preview 7.4.0-alpha.0 → 7.4.0-alpha.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.
- package/README.md +59 -1
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +63 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +67 -8
- package/dist/docs.json +49 -0
- package/dist/esm/definitions.d.ts +15 -0
- 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 +8 -0
- package/dist/esm/web.js +18 -5
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +41 -5
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +41 -5
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapgoCameraPreviewPlugin/CameraController.swift +65 -30
- package/ios/Sources/CapgoCameraPreviewPlugin/Plugin.swift +280 -104
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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)
|
|
@@ -242,6 +261,7 @@ Documentation for the [uploader](https://github.com/Cap-go/capacitor-uploader)
|
|
|
242
261
|
* [`getPreviewSize()`](#getpreviewsize)
|
|
243
262
|
* [`setPreviewSize(...)`](#setpreviewsize)
|
|
244
263
|
* [`setFocus(...)`](#setfocus)
|
|
264
|
+
* [`addListener('screenResize', ...)`](#addlistenerscreenresize-)
|
|
245
265
|
* [Interfaces](#interfaces)
|
|
246
266
|
* [Type Aliases](#type-aliases)
|
|
247
267
|
* [Enums](#enums)
|
|
@@ -559,6 +579,21 @@ Gets the current zoom state, including min/max and current lens info.
|
|
|
559
579
|
--------------------
|
|
560
580
|
|
|
561
581
|
|
|
582
|
+
### getZoomButtonValues()
|
|
583
|
+
|
|
584
|
+
```typescript
|
|
585
|
+
getZoomButtonValues() => Promise<{ values: number[]; }>
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
Returns zoom button values for quick switching.
|
|
589
|
+
- iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available
|
|
590
|
+
- Web: unsupported
|
|
591
|
+
|
|
592
|
+
**Returns:** <code>Promise<{ values: number[]; }></code>
|
|
593
|
+
|
|
594
|
+
--------------------
|
|
595
|
+
|
|
596
|
+
|
|
562
597
|
### setZoom(...)
|
|
563
598
|
|
|
564
599
|
```typescript
|
|
@@ -683,6 +718,22 @@ Sets the camera focus to a specific point in the preview.
|
|
|
683
718
|
--------------------
|
|
684
719
|
|
|
685
720
|
|
|
721
|
+
### addListener('screenResize', ...)
|
|
722
|
+
|
|
723
|
+
```typescript
|
|
724
|
+
addListener(eventName: "screenResize", listenerFunc: (data: { width: number; height: number; x: number; y: number; }) => void) => Promise<PluginListenerHandle>
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
| Param | Type |
|
|
728
|
+
| ------------------ | ---------------------------------------------------------------------------------------- |
|
|
729
|
+
| **`eventName`** | <code>'screenResize'</code> |
|
|
730
|
+
| **`listenerFunc`** | <code>(data: { width: number; height: number; x: number; y: number; }) => void</code> |
|
|
731
|
+
|
|
732
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
733
|
+
|
|
734
|
+
--------------------
|
|
735
|
+
|
|
736
|
+
|
|
686
737
|
### Interfaces
|
|
687
738
|
|
|
688
739
|
|
|
@@ -816,6 +867,13 @@ Represents the detailed information of the currently active lens.
|
|
|
816
867
|
| **`digitalZoom`** | <code>number</code> | The current digital zoom factor applied on top of the base zoom. |
|
|
817
868
|
|
|
818
869
|
|
|
870
|
+
#### PluginListenerHandle
|
|
871
|
+
|
|
872
|
+
| Prop | Type |
|
|
873
|
+
| ------------ | ----------------------------------------- |
|
|
874
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
875
|
+
|
|
876
|
+
|
|
819
877
|
### Type Aliases
|
|
820
878
|
|
|
821
879
|
|
|
@@ -276,6 +276,51 @@ public class CameraPreview
|
|
|
276
276
|
call.resolve(result);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
@PluginMethod
|
|
280
|
+
public void getZoomButtonValues(PluginCall call) {
|
|
281
|
+
// Build a sorted set to dedupe and order ascending
|
|
282
|
+
java.util.Set<Double> sorted = new java.util.TreeSet<>();
|
|
283
|
+
sorted.add(1.0);
|
|
284
|
+
sorted.add(2.0);
|
|
285
|
+
|
|
286
|
+
// Try to detect ultra-wide to include its min zoom (often 0.5)
|
|
287
|
+
try {
|
|
288
|
+
List<CameraDevice> devices = CameraXView.getAvailableDevicesStatic(
|
|
289
|
+
getContext()
|
|
290
|
+
);
|
|
291
|
+
boolean hasUltraWide = false;
|
|
292
|
+
boolean hasTelephoto = false;
|
|
293
|
+
float minUltra = 0.5f;
|
|
294
|
+
for (CameraDevice device : devices) {
|
|
295
|
+
for (com.ahm.capacitor.camera.preview.model.LensInfo lens : device.getLenses()) {
|
|
296
|
+
if ("ultraWide".equals(lens.getDeviceType())) {
|
|
297
|
+
hasUltraWide = true;
|
|
298
|
+
// Use overall minZoom for that device as the button value to represent UW
|
|
299
|
+
minUltra = Math.min(minUltra, device.getMinZoom());
|
|
300
|
+
} else if ("telephoto".equals(lens.getDeviceType())) {
|
|
301
|
+
hasTelephoto = true;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (hasUltraWide) {
|
|
306
|
+
sorted.add((double) minUltra);
|
|
307
|
+
}
|
|
308
|
+
if (hasTelephoto) {
|
|
309
|
+
sorted.add(3.0);
|
|
310
|
+
}
|
|
311
|
+
} catch (Exception ignored) {
|
|
312
|
+
// Ignore and keep defaults
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
JSObject result = new JSObject();
|
|
316
|
+
JSArray values = new JSArray();
|
|
317
|
+
for (Double v : sorted) {
|
|
318
|
+
values.put(v);
|
|
319
|
+
}
|
|
320
|
+
result.put("values", values);
|
|
321
|
+
call.resolve(result);
|
|
322
|
+
}
|
|
323
|
+
|
|
279
324
|
@PluginMethod
|
|
280
325
|
public void setZoom(PluginCall call) {
|
|
281
326
|
if (cameraXView == null || !cameraXView.isRunning()) {
|
|
@@ -1191,4 +1236,22 @@ public class CameraPreview
|
|
|
1191
1236
|
call.resolve(ret);
|
|
1192
1237
|
});
|
|
1193
1238
|
}
|
|
1239
|
+
|
|
1240
|
+
@PluginMethod
|
|
1241
|
+
public void deleteFile(PluginCall call) {
|
|
1242
|
+
String path = call.getString("path");
|
|
1243
|
+
if (path == null || path.isEmpty()) {
|
|
1244
|
+
call.reject("path parameter is required");
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
try {
|
|
1248
|
+
java.io.File f = new java.io.File(android.net.Uri.parse(path).getPath());
|
|
1249
|
+
boolean deleted = f.exists() && f.delete();
|
|
1250
|
+
JSObject ret = new JSObject();
|
|
1251
|
+
ret.put("success", deleted);
|
|
1252
|
+
call.resolve(ret);
|
|
1253
|
+
} catch (Exception e) {
|
|
1254
|
+
call.reject("Failed to delete file: " + e.getMessage());
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1194
1257
|
}
|
|
@@ -102,6 +102,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
102
102
|
private GridOverlayView gridOverlayView;
|
|
103
103
|
private FrameLayout previewContainer;
|
|
104
104
|
private View focusIndicatorView;
|
|
105
|
+
private long focusIndicatorAnimationId = 0; // Incrementing token to invalidate previous animations
|
|
105
106
|
private CameraSelector currentCameraSelector;
|
|
106
107
|
private String currentDeviceId;
|
|
107
108
|
private int currentFlashMode = ImageCapture.FLASH_MODE_OFF;
|
|
@@ -1040,12 +1041,40 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1040
1041
|
saveImageToGallery(bytes);
|
|
1041
1042
|
}
|
|
1042
1043
|
|
|
1043
|
-
String
|
|
1044
|
+
String resultValue;
|
|
1045
|
+
boolean returnFileUri =
|
|
1046
|
+
sessionConfig != null && sessionConfig.isStoreToFile();
|
|
1047
|
+
if (returnFileUri) {
|
|
1048
|
+
// Persist processed image to a file and return its URI to avoid heavy base64 bridging
|
|
1049
|
+
try {
|
|
1050
|
+
String fileName =
|
|
1051
|
+
"cpcp_" +
|
|
1052
|
+
new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(
|
|
1053
|
+
new java.util.Date()
|
|
1054
|
+
) +
|
|
1055
|
+
".jpg";
|
|
1056
|
+
File outDir = context.getCacheDir();
|
|
1057
|
+
File outFile = new File(outDir, fileName);
|
|
1058
|
+
FileOutputStream outFos = new FileOutputStream(outFile);
|
|
1059
|
+
outFos.write(bytes);
|
|
1060
|
+
outFos.close();
|
|
1061
|
+
|
|
1062
|
+
// Return a file path; apps can convert via Capacitor.convertFileSrc on JS side
|
|
1063
|
+
resultValue = outFile.getAbsolutePath();
|
|
1064
|
+
} catch (IOException ioEx) {
|
|
1065
|
+
Log.e(TAG, "capturePhoto: Failed to write image file", ioEx);
|
|
1066
|
+
// Fallback to base64 if file write fails
|
|
1067
|
+
resultValue = Base64.encodeToString(bytes, Base64.NO_WRAP);
|
|
1068
|
+
}
|
|
1069
|
+
} else {
|
|
1070
|
+
// Backward-compatible behavior
|
|
1071
|
+
resultValue = Base64.encodeToString(bytes, Base64.NO_WRAP);
|
|
1072
|
+
}
|
|
1044
1073
|
|
|
1045
1074
|
tempFile.delete();
|
|
1046
1075
|
|
|
1047
1076
|
if (listener != null) {
|
|
1048
|
-
listener.onPictureTaken(
|
|
1077
|
+
listener.onPictureTaken(resultValue, exifData);
|
|
1049
1078
|
}
|
|
1050
1079
|
} catch (Exception e) {
|
|
1051
1080
|
Log.e(TAG, "capturePhoto: Error processing image", e);
|
|
@@ -1748,8 +1777,11 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1748
1777
|
return;
|
|
1749
1778
|
}
|
|
1750
1779
|
|
|
1751
|
-
// Remove any existing focus indicator
|
|
1780
|
+
// Remove any existing focus indicator and cancel its animation
|
|
1752
1781
|
if (focusIndicatorView != null) {
|
|
1782
|
+
try {
|
|
1783
|
+
focusIndicatorView.clearAnimation();
|
|
1784
|
+
} catch (Exception ignore) {}
|
|
1753
1785
|
previewContainer.removeView(focusIndicatorView);
|
|
1754
1786
|
focusIndicatorView = null;
|
|
1755
1787
|
}
|
|
@@ -1783,6 +1815,9 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1783
1815
|
container.setBackground(drawable);
|
|
1784
1816
|
|
|
1785
1817
|
focusIndicatorView = container;
|
|
1818
|
+
// Bump animation token; everything after this must validate against this token
|
|
1819
|
+
final long thisAnimationId = ++focusIndicatorAnimationId;
|
|
1820
|
+
final View thisIndicatorView = focusIndicatorView;
|
|
1786
1821
|
|
|
1787
1822
|
// Set initial state for smooth animation
|
|
1788
1823
|
focusIndicatorView.setAlpha(1f); // Start visible
|
|
@@ -1835,7 +1870,12 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1835
1870
|
new Runnable() {
|
|
1836
1871
|
@Override
|
|
1837
1872
|
public void run() {
|
|
1838
|
-
|
|
1873
|
+
// Ensure this runnable belongs to the latest indicator
|
|
1874
|
+
if (
|
|
1875
|
+
focusIndicatorView != null &&
|
|
1876
|
+
thisIndicatorView == focusIndicatorView &&
|
|
1877
|
+
thisAnimationId == focusIndicatorAnimationId
|
|
1878
|
+
) {
|
|
1839
1879
|
// Smooth fade to semi-transparent
|
|
1840
1880
|
AlphaAnimation fadeToTransparent = new AlphaAnimation(1f, 0.4f);
|
|
1841
1881
|
fadeToTransparent.setDuration(400);
|
|
@@ -1857,7 +1897,11 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1857
1897
|
"showFocusIndicator: Fade to transparent ended, starting final fade out"
|
|
1858
1898
|
);
|
|
1859
1899
|
// Final smooth fade out and scale down
|
|
1860
|
-
if (
|
|
1900
|
+
if (
|
|
1901
|
+
focusIndicatorView != null &&
|
|
1902
|
+
thisIndicatorView == focusIndicatorView &&
|
|
1903
|
+
thisAnimationId == focusIndicatorAnimationId
|
|
1904
|
+
) {
|
|
1861
1905
|
AnimationSet finalAnimation = new AnimationSet(false);
|
|
1862
1906
|
|
|
1863
1907
|
AlphaAnimation finalFadeOut = new AlphaAnimation(0.4f, 0f);
|
|
@@ -1905,8 +1949,13 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1905
1949
|
// Remove the focus indicator
|
|
1906
1950
|
if (
|
|
1907
1951
|
focusIndicatorView != null &&
|
|
1908
|
-
previewContainer != null
|
|
1952
|
+
previewContainer != null &&
|
|
1953
|
+
thisIndicatorView == focusIndicatorView &&
|
|
1954
|
+
thisAnimationId == focusIndicatorAnimationId
|
|
1909
1955
|
) {
|
|
1956
|
+
try {
|
|
1957
|
+
focusIndicatorView.clearAnimation();
|
|
1958
|
+
} catch (Exception ignore) {}
|
|
1910
1959
|
previewContainer.removeView(focusIndicatorView);
|
|
1911
1960
|
focusIndicatorView = null;
|
|
1912
1961
|
}
|
|
@@ -1917,7 +1966,12 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1917
1966
|
}
|
|
1918
1967
|
);
|
|
1919
1968
|
|
|
1920
|
-
|
|
1969
|
+
if (
|
|
1970
|
+
thisIndicatorView == focusIndicatorView &&
|
|
1971
|
+
thisAnimationId == focusIndicatorAnimationId
|
|
1972
|
+
) {
|
|
1973
|
+
focusIndicatorView.startAnimation(finalAnimation);
|
|
1974
|
+
}
|
|
1921
1975
|
}
|
|
1922
1976
|
}
|
|
1923
1977
|
|
|
@@ -1926,7 +1980,12 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1926
1980
|
}
|
|
1927
1981
|
);
|
|
1928
1982
|
|
|
1929
|
-
|
|
1983
|
+
if (
|
|
1984
|
+
thisIndicatorView == focusIndicatorView &&
|
|
1985
|
+
thisAnimationId == focusIndicatorAnimationId
|
|
1986
|
+
) {
|
|
1987
|
+
focusIndicatorView.startAnimation(fadeToTransparent);
|
|
1988
|
+
}
|
|
1930
1989
|
}
|
|
1931
1990
|
}
|
|
1932
1991
|
},
|
package/dist/docs.json
CHANGED
|
@@ -471,6 +471,16 @@
|
|
|
471
471
|
],
|
|
472
472
|
"slug": "getzoom"
|
|
473
473
|
},
|
|
474
|
+
{
|
|
475
|
+
"name": "getZoomButtonValues",
|
|
476
|
+
"signature": "() => Promise<{ values: number[]; }>",
|
|
477
|
+
"parameters": [],
|
|
478
|
+
"returns": "Promise<{ values: number[]; }>",
|
|
479
|
+
"tags": [],
|
|
480
|
+
"docs": "Returns zoom button values for quick switching.\n- iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available\n- Web: unsupported",
|
|
481
|
+
"complexTypes": [],
|
|
482
|
+
"slug": "getzoombuttonvalues"
|
|
483
|
+
},
|
|
474
484
|
{
|
|
475
485
|
"name": "setZoom",
|
|
476
486
|
"signature": "(options: { level: number; ramp?: boolean; autoFocus?: boolean; }) => Promise<void>",
|
|
@@ -651,6 +661,29 @@
|
|
|
651
661
|
"docs": "Sets the camera focus to a specific point in the preview.",
|
|
652
662
|
"complexTypes": [],
|
|
653
663
|
"slug": "setfocus"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"name": "addListener",
|
|
667
|
+
"signature": "(eventName: \"screenResize\", listenerFunc: (data: { width: number; height: number; x: number; y: number; }) => void) => Promise<PluginListenerHandle>",
|
|
668
|
+
"parameters": [
|
|
669
|
+
{
|
|
670
|
+
"name": "eventName",
|
|
671
|
+
"docs": "",
|
|
672
|
+
"type": "'screenResize'"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
"name": "listenerFunc",
|
|
676
|
+
"docs": "",
|
|
677
|
+
"type": "(data: { width: number; height: number; x: number; y: number; }) => void"
|
|
678
|
+
}
|
|
679
|
+
],
|
|
680
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
681
|
+
"tags": [],
|
|
682
|
+
"docs": "",
|
|
683
|
+
"complexTypes": [
|
|
684
|
+
"PluginListenerHandle"
|
|
685
|
+
],
|
|
686
|
+
"slug": "addlistenerscreenresize-"
|
|
654
687
|
}
|
|
655
688
|
],
|
|
656
689
|
"properties": []
|
|
@@ -1357,6 +1390,22 @@
|
|
|
1357
1390
|
"type": "number"
|
|
1358
1391
|
}
|
|
1359
1392
|
]
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
"name": "PluginListenerHandle",
|
|
1396
|
+
"slug": "pluginlistenerhandle",
|
|
1397
|
+
"docs": "",
|
|
1398
|
+
"tags": [],
|
|
1399
|
+
"methods": [],
|
|
1400
|
+
"properties": [
|
|
1401
|
+
{
|
|
1402
|
+
"name": "remove",
|
|
1403
|
+
"tags": [],
|
|
1404
|
+
"docs": "",
|
|
1405
|
+
"complexTypes": [],
|
|
1406
|
+
"type": "() => Promise<void>"
|
|
1407
|
+
}
|
|
1408
|
+
]
|
|
1360
1409
|
}
|
|
1361
1410
|
],
|
|
1362
1411
|
"enums": [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginListenerHandle } from "@capacitor/core";
|
|
1
2
|
export type CameraPosition = "rear" | "front";
|
|
2
3
|
export type FlashMode = CameraPreviewFlashMode;
|
|
3
4
|
export type GridMode = "none" | "3x3" | "4x4";
|
|
@@ -487,6 +488,14 @@ export interface CameraPreviewPlugin {
|
|
|
487
488
|
current: number;
|
|
488
489
|
lens: LensInfo;
|
|
489
490
|
}>;
|
|
491
|
+
/**
|
|
492
|
+
* Returns zoom button values for quick switching.
|
|
493
|
+
* - iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available
|
|
494
|
+
* - Web: unsupported
|
|
495
|
+
*/
|
|
496
|
+
getZoomButtonValues(): Promise<{
|
|
497
|
+
values: number[];
|
|
498
|
+
}>;
|
|
490
499
|
/**
|
|
491
500
|
* Sets the zoom level of the camera.
|
|
492
501
|
*
|
|
@@ -572,4 +581,10 @@ export interface CameraPreviewPlugin {
|
|
|
572
581
|
x: number;
|
|
573
582
|
y: number;
|
|
574
583
|
}): Promise<void>;
|
|
584
|
+
addListener(eventName: "screenResize", listenerFunc: (data: {
|
|
585
|
+
width: number;
|
|
586
|
+
height: number;
|
|
587
|
+
x: number;
|
|
588
|
+
y: number;
|
|
589
|
+
}) => void): Promise<PluginListenerHandle>;
|
|
575
590
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAQA,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 type CameraPositioning = \"center\" | \"top\" | \"bottom\";\n\nexport enum DeviceType {\n ULTRA_WIDE = \"ultraWide\",\n WIDE_ANGLE = \"wideAngle\",\n TELEPHOTO = \"telephoto\",\n TRUE_DEPTH = \"trueDepth\",\n DUAL = \"dual\",\n DUAL_WIDE = \"dualWide\",\n TRIPLE = \"triple\",\n}\n\n/**\n * Represents a single camera lens on a device. A {@link CameraDevice} can have multiple lenses.\n */\nexport interface CameraLens {\n /** A human-readable name for the lens, e.g., \"Ultra-Wide\". */\n label: string;\n /** The type of the camera lens. */\n deviceType: DeviceType;\n /** The focal length of the lens in millimeters. */\n focalLength: number;\n /** The base zoom factor for this lens (e.g., 0.5 for ultra-wide, 1.0 for wide). */\n baseZoomRatio: number;\n /** The minimum zoom factor supported by this specific lens. */\n minZoom: number;\n /** The maximum zoom factor supported by this specific lens. */\n maxZoom: number;\n}\n\n/**\n * Represents a physical camera on the device (e.g., the front-facing camera).\n */\nexport interface CameraDevice {\n /** A unique identifier for the camera device. */\n deviceId: string;\n /** A human-readable name for the camera device. */\n label: string;\n /** The physical position of the camera on the device. */\n position: CameraPosition;\n /** A list of all available lenses for this camera device. */\n lenses: CameraLens[];\n /** The overall minimum zoom factor available across all lenses on this device. */\n minZoom: number;\n /** The overall maximum zoom factor available across all lenses on this device. */\n maxZoom: number;\n /** Identifies whether the device is a logical camera (composed of multiple physical lenses). */\n isLogical: boolean;\n}\n\n/**\n * Represents the detailed information of the currently active lens.\n */\nexport interface LensInfo {\n /** The focal length of the active lens in millimeters. */\n focalLength: number;\n /** The device type of the active lens. */\n deviceType: DeviceType;\n /** The base zoom ratio of the active lens (e.g., 0.5x, 1.0x). */\n baseZoomRatio: number;\n /** The current digital zoom factor applied on top of the base zoom. */\n digitalZoom: number;\n}\n\n/**\n * Defines the configuration options for starting the camera preview.\n */\nexport interface CameraPreviewOptions {\n /**\n * The parent element to attach the video preview to.\n * @platform web\n */\n parent?: string;\n /**\n * A CSS class name to add to the preview element.\n * @platform web\n */\n className?: string;\n /**\n * The width of the preview in pixels. Defaults to the screen width.\n * @platform android, ios, web\n */\n width?: number;\n /**\n * The height of the preview in pixels. Defaults to the screen height.\n * @platform android, ios, web\n */\n height?: number;\n /**\n * The horizontal origin of the preview, in pixels.\n * @platform android, ios\n */\n x?: number;\n /**\n * The vertical origin of the preview, in pixels.\n * @platform android, ios\n */\n y?: number;\n /**\n * The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\n * Cannot be set if width or height is provided, otherwise the call will be rejected.\n * Use setPreviewSize to adjust size after starting.\n *\n * @since 2.0.0\n */\n aspectRatio?: \"4:3\" | \"16:9\";\n /**\n * The grid overlay to display on the camera preview.\n * @default \"none\"\n * @since 2.1.0\n */\n gridMode?: GridMode;\n /**\n * Adjusts the y-position to account for safe areas (e.g., notches).\n * @platform ios\n * @default false\n */\n includeSafeAreaInsets?: boolean;\n /**\n * If true, places the preview behind the webview.\n * @platform android\n * @default true\n */\n toBack?: boolean;\n /**\n * Bottom padding for the preview, in pixels.\n * @platform android, ios\n */\n paddingBottom?: number;\n /**\n * Whether to rotate the preview when the device orientation changes.\n * @platform ios\n * @default true\n */\n rotateWhenOrientationChanged?: boolean;\n /**\n * The camera to use.\n * @default \"rear\"\n */\n position?: CameraPosition | string;\n /**\n * If true, saves the captured image to a file and returns the file path.\n * If false, returns a base64 encoded string.\n * @default false\n */\n storeToFile?: boolean;\n /**\n * If true, prevents the plugin from rotating the image based on EXIF data.\n * @platform android\n * @default false\n */\n disableExifHeaderStripping?: boolean;\n /**\n * If true, disables the audio stream, preventing audio permission requests.\n * @default true\n */\n disableAudio?: boolean;\n /**\n * If true, locks the device orientation while the camera is active.\n * @platform android\n * @default false\n */\n lockAndroidOrientation?: boolean;\n /**\n * If true, allows the camera preview's opacity to be changed.\n * @platform android, web\n * @default false\n */\n enableOpacity?: boolean;\n /**\n * If true, enables pinch-to-zoom functionality on the preview.\n * @platform android\n * @default false\n */\n enableZoom?: boolean;\n /**\n * If true, uses the video-optimized preset for the camera session.\n * @platform ios\n * @default false\n */\n enableVideoMode?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n /**\n * The initial zoom level when starting the camera preview.\n * If the requested zoom level is not available, the native plugin will reject.\n * @default 1.0\n * @platform android, ios\n * @since 2.2.0\n */\n initialZoomLevel?: number;\n /**\n * The vertical positioning of the camera preview.\n * @default \"center\"\n * @platform android, ios, web\n * @since 2.3.0\n */\n positioning?: CameraPositioning;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /** @deprecated,\n * The desired height of the picture in pixels.\n * If not specified and no aspectRatio is provided, the captured image will match the preview's visible area.\n */\n height?: number;\n /** @deprecated,\n * The desired width of the picture in pixels.\n * If not specified and no aspectRatio is provided, the captured image will match the preview's visible area.\n */\n width?: number;\n /** @deprecated,\n * The desired aspect ratio of the captured image (e.g., '4:3', '16:9').\n * If not specified and no width/height is provided, the aspect ratio from the camera start will be used.\n * If no aspect ratio was set at start, defaults to '4:3'.\n * Cannot be used together with width or height - the capture will be rejected with an error.\n * @since 7.7.0\n */\n aspectRatio?: string;\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 zoom level of the camera.\n *\n * @param {{ level: number; ramp?: boolean; autoFocus?: boolean }} options - The desired zoom level. `ramp` is currently unused. `autoFocus` defaults to true.\n * @returns {Promise<void>} A promise that resolves when the zoom level is set.\n * @since 7.4.0\n */\n setZoom(options: {\n level: number;\n ramp?: boolean;\n autoFocus?: boolean;\n }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.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 /**\n * Sets the camera focus to a specific point in the preview.\n *\n * @param {Object} options - The focus options.\n * @param {number} options.x - The x coordinate in the preview view to focus on (0-1 normalized).\n * @param {number} options.y - The y coordinate in the preview view to focus on (0-1 normalized).\n * @returns {Promise<void>} A promise that resolves when the focus is set.\n * @since 8.1.0\n */\n setFocus(options: { x: number; y: number }): Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,sCAAwB,CAAA;IACxB,sCAAwB,CAAA;IACxB,qCAAuB,CAAA;IACvB,sCAAwB,CAAA;IACxB,2BAAa,CAAA;IACb,oCAAsB,CAAA;IACtB,+BAAiB,CAAA;AACnB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport type CameraPosition = \"rear\" | \"front\";\n\nexport type FlashMode = CameraPreviewFlashMode;\n\nexport type GridMode = \"none\" | \"3x3\" | \"4x4\";\n\nexport type CameraPositioning = \"center\" | \"top\" | \"bottom\";\n\nexport enum DeviceType {\n ULTRA_WIDE = \"ultraWide\",\n WIDE_ANGLE = \"wideAngle\",\n TELEPHOTO = \"telephoto\",\n TRUE_DEPTH = \"trueDepth\",\n DUAL = \"dual\",\n DUAL_WIDE = \"dualWide\",\n TRIPLE = \"triple\",\n}\n\n/**\n * Represents a single camera lens on a device. A {@link CameraDevice} can have multiple lenses.\n */\nexport interface CameraLens {\n /** A human-readable name for the lens, e.g., \"Ultra-Wide\". */\n label: string;\n /** The type of the camera lens. */\n deviceType: DeviceType;\n /** The focal length of the lens in millimeters. */\n focalLength: number;\n /** The base zoom factor for this lens (e.g., 0.5 for ultra-wide, 1.0 for wide). */\n baseZoomRatio: number;\n /** The minimum zoom factor supported by this specific lens. */\n minZoom: number;\n /** The maximum zoom factor supported by this specific lens. */\n maxZoom: number;\n}\n\n/**\n * Represents a physical camera on the device (e.g., the front-facing camera).\n */\nexport interface CameraDevice {\n /** A unique identifier for the camera device. */\n deviceId: string;\n /** A human-readable name for the camera device. */\n label: string;\n /** The physical position of the camera on the device. */\n position: CameraPosition;\n /** A list of all available lenses for this camera device. */\n lenses: CameraLens[];\n /** The overall minimum zoom factor available across all lenses on this device. */\n minZoom: number;\n /** The overall maximum zoom factor available across all lenses on this device. */\n maxZoom: number;\n /** Identifies whether the device is a logical camera (composed of multiple physical lenses). */\n isLogical: boolean;\n}\n\n/**\n * Represents the detailed information of the currently active lens.\n */\nexport interface LensInfo {\n /** The focal length of the active lens in millimeters. */\n focalLength: number;\n /** The device type of the active lens. */\n deviceType: DeviceType;\n /** The base zoom ratio of the active lens (e.g., 0.5x, 1.0x). */\n baseZoomRatio: number;\n /** The current digital zoom factor applied on top of the base zoom. */\n digitalZoom: number;\n}\n\n/**\n * Defines the configuration options for starting the camera preview.\n */\nexport interface CameraPreviewOptions {\n /**\n * The parent element to attach the video preview to.\n * @platform web\n */\n parent?: string;\n /**\n * A CSS class name to add to the preview element.\n * @platform web\n */\n className?: string;\n /**\n * The width of the preview in pixels. Defaults to the screen width.\n * @platform android, ios, web\n */\n width?: number;\n /**\n * The height of the preview in pixels. Defaults to the screen height.\n * @platform android, ios, web\n */\n height?: number;\n /**\n * The horizontal origin of the preview, in pixels.\n * @platform android, ios\n */\n x?: number;\n /**\n * The vertical origin of the preview, in pixels.\n * @platform android, ios\n */\n y?: number;\n /**\n * The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\n * Cannot be set if width or height is provided, otherwise the call will be rejected.\n * Use setPreviewSize to adjust size after starting.\n *\n * @since 2.0.0\n */\n aspectRatio?: \"4:3\" | \"16:9\";\n /**\n * The grid overlay to display on the camera preview.\n * @default \"none\"\n * @since 2.1.0\n */\n gridMode?: GridMode;\n /**\n * Adjusts the y-position to account for safe areas (e.g., notches).\n * @platform ios\n * @default false\n */\n includeSafeAreaInsets?: boolean;\n /**\n * If true, places the preview behind the webview.\n * @platform android\n * @default true\n */\n toBack?: boolean;\n /**\n * Bottom padding for the preview, in pixels.\n * @platform android, ios\n */\n paddingBottom?: number;\n /**\n * Whether to rotate the preview when the device orientation changes.\n * @platform ios\n * @default true\n */\n rotateWhenOrientationChanged?: boolean;\n /**\n * The camera to use.\n * @default \"rear\"\n */\n position?: CameraPosition | string;\n /**\n * If true, saves the captured image to a file and returns the file path.\n * If false, returns a base64 encoded string.\n * @default false\n */\n storeToFile?: boolean;\n /**\n * If true, prevents the plugin from rotating the image based on EXIF data.\n * @platform android\n * @default false\n */\n disableExifHeaderStripping?: boolean;\n /**\n * If true, disables the audio stream, preventing audio permission requests.\n * @default true\n */\n disableAudio?: boolean;\n /**\n * If true, locks the device orientation while the camera is active.\n * @platform android\n * @default false\n */\n lockAndroidOrientation?: boolean;\n /**\n * If true, allows the camera preview's opacity to be changed.\n * @platform android, web\n * @default false\n */\n enableOpacity?: boolean;\n /**\n * If true, enables pinch-to-zoom functionality on the preview.\n * @platform android\n * @default false\n */\n enableZoom?: boolean;\n /**\n * If true, uses the video-optimized preset for the camera session.\n * @platform ios\n * @default false\n */\n enableVideoMode?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n /**\n * The initial zoom level when starting the camera preview.\n * If the requested zoom level is not available, the native plugin will reject.\n * @default 1.0\n * @platform android, ios\n * @since 2.2.0\n */\n initialZoomLevel?: number;\n /**\n * The vertical positioning of the camera preview.\n * @default \"center\"\n * @platform android, ios, web\n * @since 2.3.0\n */\n positioning?: CameraPositioning;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /** @deprecated,\n * The desired height of the picture in pixels.\n * If not specified and no aspectRatio is provided, the captured image will match the preview's visible area.\n */\n height?: number;\n /** @deprecated,\n * The desired width of the picture in pixels.\n * If not specified and no aspectRatio is provided, the captured image will match the preview's visible area.\n */\n width?: number;\n /** @deprecated,\n * The desired aspect ratio of the captured image (e.g., '4:3', '16:9').\n * If not specified and no width/height is provided, the aspect ratio from the camera start will be used.\n * If no aspect ratio was set at start, defaults to '4:3'.\n * Cannot be used together with width or height - the capture will be rejected with an error.\n * @since 7.7.0\n */\n aspectRatio?: string;\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 * Returns zoom button values for quick switching.\n * - iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available\n * - Web: unsupported\n */\n getZoomButtonValues(): Promise<{ values: number[] }>;\n\n /**\n * Sets the zoom level of the camera.\n *\n * @param {{ level: number; ramp?: boolean; autoFocus?: boolean }} options - The desired zoom level. `ramp` is currently unused. `autoFocus` defaults to true.\n * @returns {Promise<void>} A promise that resolves when the zoom level is set.\n * @since 7.4.0\n */\n setZoom(options: {\n level: number;\n ramp?: boolean;\n autoFocus?: boolean;\n }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.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 /**\n * Sets the camera focus to a specific point in the preview.\n *\n * @param {Object} options - The focus options.\n * @param {number} options.x - The x coordinate in the preview view to focus on (0-1 normalized).\n * @param {number} options.y - The y coordinate in the preview view to focus on (0-1 normalized).\n * @returns {Promise<void>} A promise that resolves when the focus is set.\n * @since 8.1.0\n */\n setFocus(options: { x: number; y: number }): Promise<void>;\n\n addListener(\n eventName: \"screenResize\",\n listenerFunc: (data: {\n width: number;\n height: number;\n x: number;\n y: number;\n }) => void,\n ): Promise<PluginListenerHandle>;\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ import type { CameraPreviewPlugin } from "./definitions";
|
|
|
2
2
|
declare const CameraPreview: CameraPreviewPlugin;
|
|
3
3
|
export * from "./definitions";
|
|
4
4
|
export { CameraPreview };
|
|
5
|
+
export declare function getBase64FromFilePath(filePath: string): Promise<string>;
|
|
6
|
+
export declare function deleteFile(path: string): Promise<boolean>;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
|
-
import { registerPlugin } from "@capacitor/core";
|
|
1
|
+
import { Capacitor, registerPlugin } from "@capacitor/core";
|
|
2
2
|
const CameraPreview = registerPlugin("CameraPreview", {
|
|
3
3
|
web: () => import("./web").then((m) => new m.CameraPreviewWeb()),
|
|
4
4
|
});
|
|
5
5
|
export * from "./definitions";
|
|
6
6
|
export { CameraPreview };
|
|
7
|
+
export async function getBase64FromFilePath(filePath) {
|
|
8
|
+
const url = Capacitor.convertFileSrc(filePath);
|
|
9
|
+
const response = await fetch(url);
|
|
10
|
+
if (!response.ok) {
|
|
11
|
+
throw new Error(`Failed to read file at path: ${filePath} (status ${response.status})`);
|
|
12
|
+
}
|
|
13
|
+
const blob = await response.blob();
|
|
14
|
+
return await new Promise((resolve, reject) => {
|
|
15
|
+
const reader = new FileReader();
|
|
16
|
+
reader.onloadend = () => {
|
|
17
|
+
const dataUrl = reader.result;
|
|
18
|
+
const commaIndex = dataUrl.indexOf(",");
|
|
19
|
+
resolve(commaIndex >= 0 ? dataUrl.substring(commaIndex + 1) : dataUrl);
|
|
20
|
+
};
|
|
21
|
+
reader.onerror = () => reject(reader.error);
|
|
22
|
+
reader.readAsDataURL(blob);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export async function deleteFile(path) {
|
|
26
|
+
// Use native bridge to delete file to handle platform-specific permissions/URIs
|
|
27
|
+
const { success } = await CameraPreview.deleteFile({ path });
|
|
28
|
+
return !!success;
|
|
29
|
+
}
|
|
7
30
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAI5D,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;AAEzB,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,QAAgB;IAC1D,MAAM,GAAG,GAAG,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,gCAAgC,QAAQ,YAAY,QAAQ,CAAC,MAAM,GAAG,CACvE,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,OAAO,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnD,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,CAAC,SAAS,GAAG,GAAG,EAAE;YACtB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAgB,CAAC;YACxC,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACxC,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACzE,CAAC,CAAC;QACF,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,gFAAgF;IAChF,MAAM,EAAE,OAAO,EAAE,GAAG,MAAO,aAAqB,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,OAAO,CAAC,CAAC,OAAO,CAAC;AACnB,CAAC","sourcesContent":["import { Capacitor, 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\nexport async function getBase64FromFilePath(filePath: string): Promise<string> {\n const url = Capacitor.convertFileSrc(filePath);\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to read file at path: ${filePath} (status ${response.status})`,\n );\n }\n const blob = await response.blob();\n return await new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => {\n const dataUrl = reader.result as string;\n const commaIndex = dataUrl.indexOf(\",\");\n resolve(commaIndex >= 0 ? dataUrl.substring(commaIndex + 1) : dataUrl);\n };\n reader.onerror = () => reject(reader.error);\n reader.readAsDataURL(blob);\n });\n}\n\nexport async function deleteFile(path: string): Promise<boolean> {\n // Use native bridge to delete file to handle platform-specific permissions/URIs\n const { success } = await (CameraPreview as any).deleteFile({ path });\n return !!success;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export declare class CameraPreviewWeb extends WebPlugin implements CameraPreview
|
|
|
10
10
|
private videoElement;
|
|
11
11
|
private isStarted;
|
|
12
12
|
constructor();
|
|
13
|
+
getZoomButtonValues(): Promise<{
|
|
14
|
+
values: number[];
|
|
15
|
+
}>;
|
|
13
16
|
getSupportedPictureSizes(): Promise<any>;
|
|
14
17
|
start(options: CameraPreviewOptions): Promise<{
|
|
15
18
|
width: number;
|
|
@@ -101,4 +104,9 @@ export declare class CameraPreviewWeb extends WebPlugin implements CameraPreview
|
|
|
101
104
|
x: number;
|
|
102
105
|
y: number;
|
|
103
106
|
}): Promise<void>;
|
|
107
|
+
deleteFile(_options: {
|
|
108
|
+
path: string;
|
|
109
|
+
}): Promise<{
|
|
110
|
+
success: boolean;
|
|
111
|
+
}>;
|
|
104
112
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -13,6 +13,9 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
13
13
|
this.videoElement = null;
|
|
14
14
|
this.isStarted = false;
|
|
15
15
|
}
|
|
16
|
+
async getZoomButtonValues() {
|
|
17
|
+
throw new Error("getZoomButtonValues not supported under the web platform");
|
|
18
|
+
}
|
|
16
19
|
async getSupportedPictureSizes() {
|
|
17
20
|
throw new Error("getSupportedPictureSizes not supported under the web platform");
|
|
18
21
|
}
|
|
@@ -56,9 +59,9 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
56
59
|
if (options.toBack) {
|
|
57
60
|
this.videoElement.style.zIndex = "-1";
|
|
58
61
|
}
|
|
59
|
-
// Default to
|
|
62
|
+
// Default to 4:3 if no aspect ratio or size specified
|
|
60
63
|
const useDefaultAspectRatio = !options.aspectRatio && !options.width && !options.height;
|
|
61
|
-
const effectiveAspectRatio = options.aspectRatio || (useDefaultAspectRatio ? "
|
|
64
|
+
const effectiveAspectRatio = options.aspectRatio || (useDefaultAspectRatio ? "4:3" : null);
|
|
62
65
|
if (options.width) {
|
|
63
66
|
this.videoElement.width = options.width;
|
|
64
67
|
this.videoElement.style.width = `${options.width}px`;
|
|
@@ -230,7 +233,8 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
230
233
|
this.videoElement.style.transform = "scaleX(-1)";
|
|
231
234
|
}
|
|
232
235
|
// Set initial zoom level if specified and supported
|
|
233
|
-
if (options.initialZoomLevel
|
|
236
|
+
if (options.initialZoomLevel !== undefined &&
|
|
237
|
+
options.initialZoomLevel !== 1.0) {
|
|
234
238
|
// videoTrack already declared above
|
|
235
239
|
if (videoTrack) {
|
|
236
240
|
const capabilities = videoTrack.getCapabilities();
|
|
@@ -257,11 +261,15 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
257
261
|
this.isStarted = true;
|
|
258
262
|
// Wait for video to be ready and get actual dimensions
|
|
259
263
|
await new Promise((resolve) => {
|
|
260
|
-
|
|
264
|
+
const videoEl = this.videoElement;
|
|
265
|
+
if (!videoEl) {
|
|
266
|
+
throw new Error("video element not found");
|
|
267
|
+
}
|
|
268
|
+
if (videoEl.readyState >= 2) {
|
|
261
269
|
resolve();
|
|
262
270
|
}
|
|
263
271
|
else {
|
|
264
|
-
|
|
272
|
+
videoEl.addEventListener("loadeddata", () => resolve(), {
|
|
265
273
|
once: true,
|
|
266
274
|
});
|
|
267
275
|
}
|
|
@@ -905,5 +913,10 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
905
913
|
console.warn("Focus control is not supported on this device. Focus coordinates were provided but cannot be applied.");
|
|
906
914
|
}
|
|
907
915
|
}
|
|
916
|
+
async deleteFile(_options) {
|
|
917
|
+
// Mark parameter as intentionally unused to satisfy linter
|
|
918
|
+
void _options;
|
|
919
|
+
throw new Error("deleteFile not supported under the web platform");
|
|
920
|
+
}
|
|
908
921
|
}
|
|
909
922
|
//# sourceMappingURL=web.js.map
|