@capgo/camera-preview 8.8.0 → 8.9.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 +58 -0
- package/android/src/main/java/app/capgo/capacitor/camera/preview/CameraPreview.java +43 -0
- package/android/src/main/java/app/capgo/capacitor/camera/preview/CameraXView.java +130 -8
- package/dist/docs.json +80 -0
- package/dist/esm/definitions.d.ts +32 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +10 -1
- package/dist/esm/web.js +50 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +49 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +49 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapgoCameraPreviewPlugin/CameraController.swift +211 -80
- package/ios/Sources/CapgoCameraPreviewPlugin/Plugin.swift +56 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -427,6 +427,9 @@ Documentation for the [uploader](https://github.com/Cap-go/capacitor-uploader)
|
|
|
427
427
|
* [`getExposureCompensationRange()`](#getexposurecompensationrange)
|
|
428
428
|
* [`getExposureCompensation()`](#getexposurecompensation)
|
|
429
429
|
* [`setExposureCompensation(...)`](#setexposurecompensation)
|
|
430
|
+
* [`getWhiteBalanceModes()`](#getwhitebalancemodes)
|
|
431
|
+
* [`getWhiteBalanceMode()`](#getwhitebalancemode)
|
|
432
|
+
* [`setWhiteBalanceMode(...)`](#setwhitebalancemode)
|
|
430
433
|
* [`getSupportedVideoFrameRates()`](#getsupportedvideoframerates)
|
|
431
434
|
* [`getVideoFrameRate()`](#getvideoframerate)
|
|
432
435
|
* [`setVideoFrameRate(...)`](#setvideoframerate)
|
|
@@ -1379,6 +1382,52 @@ Sets the exposure compensation (EV bias). Value will be clamped to range.
|
|
|
1379
1382
|
--------------------
|
|
1380
1383
|
|
|
1381
1384
|
|
|
1385
|
+
### getWhiteBalanceModes()
|
|
1386
|
+
|
|
1387
|
+
```typescript
|
|
1388
|
+
getWhiteBalanceModes() => Promise<{ modes: WhiteBalanceMode[]; }>
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
Returns the white-balance modes supported by the active camera.
|
|
1392
|
+
Modes can include: 'AUTO', 'LOCK', 'CONTINUOUS'. `CUSTOM` is not listed
|
|
1393
|
+
until manual gains support is implemented.
|
|
1394
|
+
|
|
1395
|
+
**Returns:** <code>Promise<{ modes: WhiteBalanceMode[]; }></code>
|
|
1396
|
+
|
|
1397
|
+
--------------------
|
|
1398
|
+
|
|
1399
|
+
|
|
1400
|
+
### getWhiteBalanceMode()
|
|
1401
|
+
|
|
1402
|
+
```typescript
|
|
1403
|
+
getWhiteBalanceMode() => Promise<{ mode: WhiteBalanceMode; }>
|
|
1404
|
+
```
|
|
1405
|
+
|
|
1406
|
+
Returns the current white-balance mode.
|
|
1407
|
+
|
|
1408
|
+
**Returns:** <code>Promise<{ mode: <a href="#whitebalancemode">WhiteBalanceMode</a>; }></code>
|
|
1409
|
+
|
|
1410
|
+
--------------------
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
### setWhiteBalanceMode(...)
|
|
1414
|
+
|
|
1415
|
+
```typescript
|
|
1416
|
+
setWhiteBalanceMode(options: { mode: WhiteBalanceMode; }) => Promise<void>
|
|
1417
|
+
```
|
|
1418
|
+
|
|
1419
|
+
Sets the white-balance mode. `CONTINUOUS` keeps auto white balance running
|
|
1420
|
+
(recommended; avoids a warm/yellow cast), `LOCK` freezes the current gains,
|
|
1421
|
+
`AUTO` performs a one-time adjustment. `CUSTOM` is reserved and rejected
|
|
1422
|
+
until manual gains support is implemented.
|
|
1423
|
+
|
|
1424
|
+
| Param | Type |
|
|
1425
|
+
| ------------- | ------------------------------------------------------------------------ |
|
|
1426
|
+
| **`options`** | <code>{ mode: <a href="#whitebalancemode">WhiteBalanceMode</a>; }</code> |
|
|
1427
|
+
|
|
1428
|
+
--------------------
|
|
1429
|
+
|
|
1430
|
+
|
|
1382
1431
|
### getSupportedVideoFrameRates()
|
|
1383
1432
|
|
|
1384
1433
|
```typescript
|
|
@@ -1774,6 +1823,15 @@ Reusable exposure mode type for cross-platform support.
|
|
|
1774
1823
|
<code>'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM'</code>
|
|
1775
1824
|
|
|
1776
1825
|
|
|
1826
|
+
#### WhiteBalanceMode
|
|
1827
|
+
|
|
1828
|
+
Reusable white-balance mode type for cross-platform support.
|
|
1829
|
+
`CUSTOM` is reserved for a future manual white-balance gains API and is not
|
|
1830
|
+
returned by `getWhiteBalanceModes()` until implemented.
|
|
1831
|
+
|
|
1832
|
+
<code>'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM'</code>
|
|
1833
|
+
|
|
1834
|
+
|
|
1777
1835
|
### Enums
|
|
1778
1836
|
|
|
1779
1837
|
|
|
@@ -195,6 +195,49 @@ public class CameraPreview extends Plugin implements CameraXView.CameraXViewList
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
@PluginMethod
|
|
199
|
+
public void getWhiteBalanceModes(PluginCall call) {
|
|
200
|
+
if (cameraXView == null || !cameraXView.isRunning()) {
|
|
201
|
+
call.reject("Camera is not running");
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
JSArray arr = new JSArray();
|
|
205
|
+
for (String m : cameraXView.getWhiteBalanceModes()) arr.put(m);
|
|
206
|
+
JSObject ret = new JSObject();
|
|
207
|
+
ret.put("modes", arr);
|
|
208
|
+
call.resolve(ret);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@PluginMethod
|
|
212
|
+
public void getWhiteBalanceMode(PluginCall call) {
|
|
213
|
+
if (cameraXView == null || !cameraXView.isRunning()) {
|
|
214
|
+
call.reject("Camera is not running");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
JSObject ret = new JSObject();
|
|
218
|
+
ret.put("mode", cameraXView.getWhiteBalanceMode());
|
|
219
|
+
call.resolve(ret);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@PluginMethod
|
|
223
|
+
public void setWhiteBalanceMode(PluginCall call) {
|
|
224
|
+
if (cameraXView == null || !cameraXView.isRunning()) {
|
|
225
|
+
call.reject("Camera is not running");
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
String mode = call.getString("mode");
|
|
229
|
+
if (mode == null || mode.isEmpty()) {
|
|
230
|
+
call.reject("mode parameter is required");
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
cameraXView.setWhiteBalanceMode(mode);
|
|
235
|
+
call.resolve();
|
|
236
|
+
} catch (Exception e) {
|
|
237
|
+
call.reject("Failed to set white balance mode: " + e.getMessage());
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
198
241
|
@PluginMethod
|
|
199
242
|
public void getExposureModes(PluginCall call) {
|
|
200
243
|
if (cameraXView == null || !cameraXView.isRunning()) {
|
|
@@ -191,6 +191,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
191
191
|
private Runnable pendingFrameRateBindSuccess;
|
|
192
192
|
private java.util.function.Consumer<String> pendingFrameRateBindError;
|
|
193
193
|
private String currentExposureMode = "CONTINUOUS"; // Default behavior
|
|
194
|
+
private String currentWhiteBalanceMode = "CONTINUOUS"; // Default behavior
|
|
194
195
|
// Capture/stop coordination
|
|
195
196
|
private final Object captureLock = new Object();
|
|
196
197
|
private volatile boolean isCapturingPhoto = false;
|
|
@@ -1183,6 +1184,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1183
1184
|
}
|
|
1184
1185
|
|
|
1185
1186
|
resetExposureCompensationToDefault();
|
|
1187
|
+
reapplyCameraControlModes();
|
|
1186
1188
|
|
|
1187
1189
|
// Log details about the active camera
|
|
1188
1190
|
Log.d(TAG, "Use cases bound. Inspecting active camera and use cases.");
|
|
@@ -3278,13 +3280,29 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
3278
3280
|
|
|
3279
3281
|
@OptIn(markerClass = ExperimentalCamera2Interop.class)
|
|
3280
3282
|
public void setExposureMode(String mode) throws Exception {
|
|
3281
|
-
if (camera == null) {
|
|
3282
|
-
throw new Exception("Camera not initialized");
|
|
3283
|
-
}
|
|
3284
3283
|
if (mode == null) {
|
|
3285
3284
|
throw new Exception("mode is required");
|
|
3286
3285
|
}
|
|
3287
3286
|
String normalized = mode.toUpperCase(Locale.US);
|
|
3287
|
+
if (!"LOCK".equals(normalized) && !"CONTINUOUS".equals(normalized)) {
|
|
3288
|
+
throw new Exception("Unsupported exposure mode: " + mode);
|
|
3289
|
+
}
|
|
3290
|
+
final String modeToApply = normalized;
|
|
3291
|
+
mainExecutor.execute(() -> {
|
|
3292
|
+
try {
|
|
3293
|
+
applyExposureMode(modeToApply);
|
|
3294
|
+
currentExposureMode = modeToApply;
|
|
3295
|
+
} catch (Exception e) {
|
|
3296
|
+
Log.e(TAG, "setExposureMode: Failed to apply mode", e);
|
|
3297
|
+
}
|
|
3298
|
+
});
|
|
3299
|
+
}
|
|
3300
|
+
|
|
3301
|
+
@OptIn(markerClass = ExperimentalCamera2Interop.class)
|
|
3302
|
+
private void applyExposureMode(String normalized) throws Exception {
|
|
3303
|
+
if (camera == null) {
|
|
3304
|
+
throw new Exception("Camera not initialized");
|
|
3305
|
+
}
|
|
3288
3306
|
|
|
3289
3307
|
Camera2CameraControl c2 = Camera2CameraControl.from(camera.getCameraControl());
|
|
3290
3308
|
switch (normalized) {
|
|
@@ -3293,8 +3311,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
3293
3311
|
.setCaptureRequestOption(CaptureRequest.CONTROL_AE_LOCK, true)
|
|
3294
3312
|
.setCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON)
|
|
3295
3313
|
.build();
|
|
3296
|
-
|
|
3297
|
-
currentExposureMode = "LOCK";
|
|
3314
|
+
c2.setCaptureRequestOptions(opts);
|
|
3298
3315
|
break;
|
|
3299
3316
|
}
|
|
3300
3317
|
case "CONTINUOUS": {
|
|
@@ -3302,12 +3319,117 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
3302
3319
|
.setCaptureRequestOption(CaptureRequest.CONTROL_AE_LOCK, false)
|
|
3303
3320
|
.setCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON)
|
|
3304
3321
|
.build();
|
|
3305
|
-
|
|
3306
|
-
|
|
3322
|
+
c2.setCaptureRequestOptions(opts);
|
|
3323
|
+
break;
|
|
3324
|
+
}
|
|
3325
|
+
default:
|
|
3326
|
+
throw new Exception("Unsupported exposure mode: " + normalized);
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3330
|
+
// ===================== White Balance APIs =====================
|
|
3331
|
+
public java.util.List<String> getWhiteBalanceModes() {
|
|
3332
|
+
if (camera == null) {
|
|
3333
|
+
return Arrays.asList("LOCK", "CONTINUOUS");
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
java.util.List<String> modes = new java.util.ArrayList<>();
|
|
3337
|
+
try {
|
|
3338
|
+
Camera2CameraInfo c2Info = Camera2CameraInfo.from(camera.getCameraInfo());
|
|
3339
|
+
int[] available = c2Info.getCameraCharacteristic(CameraCharacteristics.CONTROL_AWB_AVAILABLE_MODES);
|
|
3340
|
+
Boolean lockAvailable = c2Info.getCameraCharacteristic(CameraCharacteristics.CONTROL_AWB_LOCK_AVAILABLE);
|
|
3341
|
+
|
|
3342
|
+
if (available != null) {
|
|
3343
|
+
for (int awbMode : available) {
|
|
3344
|
+
if (awbMode == CaptureRequest.CONTROL_AWB_MODE_AUTO && !modes.contains("CONTINUOUS")) {
|
|
3345
|
+
modes.add("CONTINUOUS");
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
if (Boolean.TRUE.equals(lockAvailable) && !modes.contains("LOCK")) {
|
|
3350
|
+
modes.add("LOCK");
|
|
3351
|
+
}
|
|
3352
|
+
} catch (Exception e) {
|
|
3353
|
+
Log.w(TAG, "getWhiteBalanceModes: Failed to query capabilities, using defaults", e);
|
|
3354
|
+
return Arrays.asList("LOCK", "CONTINUOUS");
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
if (modes.isEmpty()) {
|
|
3358
|
+
return Arrays.asList("LOCK", "CONTINUOUS");
|
|
3359
|
+
}
|
|
3360
|
+
return modes;
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
public String getWhiteBalanceMode() {
|
|
3364
|
+
return currentWhiteBalanceMode;
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3367
|
+
@OptIn(markerClass = ExperimentalCamera2Interop.class)
|
|
3368
|
+
public void setWhiteBalanceMode(String mode) throws Exception {
|
|
3369
|
+
if (mode == null) {
|
|
3370
|
+
throw new Exception("mode is required");
|
|
3371
|
+
}
|
|
3372
|
+
String normalized = mode.toUpperCase(Locale.US);
|
|
3373
|
+
if ("CUSTOM".equals(normalized)) {
|
|
3374
|
+
throw new Exception("CUSTOM white balance is not supported; manual gains are not yet exposed");
|
|
3375
|
+
}
|
|
3376
|
+
if (!"LOCK".equals(normalized) && !"AUTO".equals(normalized) && !"CONTINUOUS".equals(normalized)) {
|
|
3377
|
+
throw new Exception("Unsupported white balance mode: " + mode);
|
|
3378
|
+
}
|
|
3379
|
+
final String modeToApply = normalized;
|
|
3380
|
+
mainExecutor.execute(() -> {
|
|
3381
|
+
try {
|
|
3382
|
+
applyWhiteBalanceMode(modeToApply);
|
|
3383
|
+
currentWhiteBalanceMode = modeToApply;
|
|
3384
|
+
} catch (Exception e) {
|
|
3385
|
+
Log.e(TAG, "setWhiteBalanceMode: Failed to apply mode", e);
|
|
3386
|
+
}
|
|
3387
|
+
});
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
@OptIn(markerClass = ExperimentalCamera2Interop.class)
|
|
3391
|
+
private void applyWhiteBalanceMode(String normalized) throws Exception {
|
|
3392
|
+
if (camera == null) {
|
|
3393
|
+
throw new Exception("Camera not initialized");
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
Camera2CameraControl c2 = Camera2CameraControl.from(camera.getCameraControl());
|
|
3397
|
+
switch (normalized) {
|
|
3398
|
+
case "LOCK": {
|
|
3399
|
+
CaptureRequestOptions opts = new CaptureRequestOptions.Builder()
|
|
3400
|
+
.setCaptureRequestOption(CaptureRequest.CONTROL_AWB_LOCK, true)
|
|
3401
|
+
.setCaptureRequestOption(CaptureRequest.CONTROL_AWB_MODE, CaptureRequest.CONTROL_AWB_MODE_AUTO)
|
|
3402
|
+
.build();
|
|
3403
|
+
c2.setCaptureRequestOptions(opts);
|
|
3404
|
+
break;
|
|
3405
|
+
}
|
|
3406
|
+
case "AUTO":
|
|
3407
|
+
case "CONTINUOUS": {
|
|
3408
|
+
CaptureRequestOptions opts = new CaptureRequestOptions.Builder()
|
|
3409
|
+
.setCaptureRequestOption(CaptureRequest.CONTROL_AWB_LOCK, false)
|
|
3410
|
+
.setCaptureRequestOption(CaptureRequest.CONTROL_AWB_MODE, CaptureRequest.CONTROL_AWB_MODE_AUTO)
|
|
3411
|
+
.build();
|
|
3412
|
+
c2.setCaptureRequestOptions(opts);
|
|
3307
3413
|
break;
|
|
3308
3414
|
}
|
|
3309
3415
|
default:
|
|
3310
|
-
throw new Exception("Unsupported
|
|
3416
|
+
throw new Exception("Unsupported white balance mode: " + normalized);
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
|
|
3420
|
+
private void reapplyCameraControlModes() {
|
|
3421
|
+
if (camera == null) {
|
|
3422
|
+
return;
|
|
3423
|
+
}
|
|
3424
|
+
try {
|
|
3425
|
+
applyExposureMode(currentExposureMode);
|
|
3426
|
+
} catch (Exception e) {
|
|
3427
|
+
Log.w(TAG, "reapplyCameraControlModes: Failed to reapply exposure mode", e);
|
|
3428
|
+
}
|
|
3429
|
+
try {
|
|
3430
|
+
applyWhiteBalanceMode(currentWhiteBalanceMode);
|
|
3431
|
+
} catch (Exception e) {
|
|
3432
|
+
Log.w(TAG, "reapplyCameraControlModes: Failed to reapply white balance mode", e);
|
|
3311
3433
|
}
|
|
3312
3434
|
}
|
|
3313
3435
|
|
package/dist/docs.json
CHANGED
|
@@ -1495,6 +1495,63 @@
|
|
|
1495
1495
|
"complexTypes": [],
|
|
1496
1496
|
"slug": "setexposurecompensation"
|
|
1497
1497
|
},
|
|
1498
|
+
{
|
|
1499
|
+
"name": "getWhiteBalanceModes",
|
|
1500
|
+
"signature": "() => Promise<{ modes: WhiteBalanceMode[]; }>",
|
|
1501
|
+
"parameters": [],
|
|
1502
|
+
"returns": "Promise<{ modes: WhiteBalanceMode[]; }>",
|
|
1503
|
+
"tags": [
|
|
1504
|
+
{
|
|
1505
|
+
"name": "platform",
|
|
1506
|
+
"text": "android, ios"
|
|
1507
|
+
}
|
|
1508
|
+
],
|
|
1509
|
+
"docs": "Returns the white-balance modes supported by the active camera.\nModes can include: 'AUTO', 'LOCK', 'CONTINUOUS'. `CUSTOM` is not listed\nuntil manual gains support is implemented.",
|
|
1510
|
+
"complexTypes": [
|
|
1511
|
+
"WhiteBalanceMode"
|
|
1512
|
+
],
|
|
1513
|
+
"slug": "getwhitebalancemodes"
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
"name": "getWhiteBalanceMode",
|
|
1517
|
+
"signature": "() => Promise<{ mode: WhiteBalanceMode; }>",
|
|
1518
|
+
"parameters": [],
|
|
1519
|
+
"returns": "Promise<{ mode: WhiteBalanceMode; }>",
|
|
1520
|
+
"tags": [
|
|
1521
|
+
{
|
|
1522
|
+
"name": "platform",
|
|
1523
|
+
"text": "android, ios"
|
|
1524
|
+
}
|
|
1525
|
+
],
|
|
1526
|
+
"docs": "Returns the current white-balance mode.",
|
|
1527
|
+
"complexTypes": [
|
|
1528
|
+
"WhiteBalanceMode"
|
|
1529
|
+
],
|
|
1530
|
+
"slug": "getwhitebalancemode"
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
"name": "setWhiteBalanceMode",
|
|
1534
|
+
"signature": "(options: { mode: WhiteBalanceMode; }) => Promise<void>",
|
|
1535
|
+
"parameters": [
|
|
1536
|
+
{
|
|
1537
|
+
"name": "options",
|
|
1538
|
+
"docs": "",
|
|
1539
|
+
"type": "{ mode: WhiteBalanceMode; }"
|
|
1540
|
+
}
|
|
1541
|
+
],
|
|
1542
|
+
"returns": "Promise<void>",
|
|
1543
|
+
"tags": [
|
|
1544
|
+
{
|
|
1545
|
+
"name": "platform",
|
|
1546
|
+
"text": "android, ios"
|
|
1547
|
+
}
|
|
1548
|
+
],
|
|
1549
|
+
"docs": "Sets the white-balance mode. `CONTINUOUS` keeps auto white balance running\n(recommended; avoids a warm/yellow cast), `LOCK` freezes the current gains,\n`AUTO` performs a one-time adjustment. `CUSTOM` is reserved and rejected\nuntil manual gains support is implemented.",
|
|
1550
|
+
"complexTypes": [
|
|
1551
|
+
"WhiteBalanceMode"
|
|
1552
|
+
],
|
|
1553
|
+
"slug": "setwhitebalancemode"
|
|
1554
|
+
},
|
|
1498
1555
|
{
|
|
1499
1556
|
"name": "getSupportedVideoFrameRates",
|
|
1500
1557
|
"signature": "() => Promise<{ frameRates: number[]; }>",
|
|
@@ -3210,6 +3267,29 @@
|
|
|
3210
3267
|
"complexTypes": []
|
|
3211
3268
|
}
|
|
3212
3269
|
]
|
|
3270
|
+
},
|
|
3271
|
+
{
|
|
3272
|
+
"name": "WhiteBalanceMode",
|
|
3273
|
+
"slug": "whitebalancemode",
|
|
3274
|
+
"docs": "Reusable white-balance mode type for cross-platform support.\n`CUSTOM` is reserved for a future manual white-balance gains API and is not\nreturned by `getWhiteBalanceModes()` until implemented.",
|
|
3275
|
+
"types": [
|
|
3276
|
+
{
|
|
3277
|
+
"text": "'AUTO'",
|
|
3278
|
+
"complexTypes": []
|
|
3279
|
+
},
|
|
3280
|
+
{
|
|
3281
|
+
"text": "'LOCK'",
|
|
3282
|
+
"complexTypes": []
|
|
3283
|
+
},
|
|
3284
|
+
{
|
|
3285
|
+
"text": "'CONTINUOUS'",
|
|
3286
|
+
"complexTypes": []
|
|
3287
|
+
},
|
|
3288
|
+
{
|
|
3289
|
+
"text": "'CUSTOM'",
|
|
3290
|
+
"complexTypes": []
|
|
3291
|
+
}
|
|
3292
|
+
]
|
|
3213
3293
|
}
|
|
3214
3294
|
],
|
|
3215
3295
|
"pluginConfigs": []
|
|
@@ -448,6 +448,12 @@ export interface CameraSampleOptions {
|
|
|
448
448
|
export type CameraPreviewFlashMode = 'off' | 'on' | 'auto' | 'torch';
|
|
449
449
|
/** Reusable exposure mode type for cross-platform support. */
|
|
450
450
|
export type ExposureMode = 'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM';
|
|
451
|
+
/**
|
|
452
|
+
* Reusable white-balance mode type for cross-platform support.
|
|
453
|
+
* `CUSTOM` is reserved for a future manual white-balance gains API and is not
|
|
454
|
+
* returned by `getWhiteBalanceModes()` until implemented.
|
|
455
|
+
*/
|
|
456
|
+
export type WhiteBalanceMode = 'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM';
|
|
451
457
|
/**
|
|
452
458
|
* Defines the options for setting the camera preview's opacity.
|
|
453
459
|
*/
|
|
@@ -1065,6 +1071,32 @@ export interface CameraPreviewPlugin {
|
|
|
1065
1071
|
setExposureCompensation(options: {
|
|
1066
1072
|
value: number;
|
|
1067
1073
|
}): Promise<void>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Returns the white-balance modes supported by the active camera.
|
|
1076
|
+
* Modes can include: 'AUTO', 'LOCK', 'CONTINUOUS'. `CUSTOM` is not listed
|
|
1077
|
+
* until manual gains support is implemented.
|
|
1078
|
+
* @platform android, ios
|
|
1079
|
+
*/
|
|
1080
|
+
getWhiteBalanceModes(): Promise<{
|
|
1081
|
+
modes: WhiteBalanceMode[];
|
|
1082
|
+
}>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Returns the current white-balance mode.
|
|
1085
|
+
* @platform android, ios
|
|
1086
|
+
*/
|
|
1087
|
+
getWhiteBalanceMode(): Promise<{
|
|
1088
|
+
mode: WhiteBalanceMode;
|
|
1089
|
+
}>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Sets the white-balance mode. `CONTINUOUS` keeps auto white balance running
|
|
1092
|
+
* (recommended; avoids a warm/yellow cast), `LOCK` freezes the current gains,
|
|
1093
|
+
* `AUTO` performs a one-time adjustment. `CUSTOM` is reserved and rejected
|
|
1094
|
+
* until manual gains support is implemented.
|
|
1095
|
+
* @platform android, ios
|
|
1096
|
+
*/
|
|
1097
|
+
setWhiteBalanceMode(options: {
|
|
1098
|
+
mode: WhiteBalanceMode;
|
|
1099
|
+
}): Promise<void>;
|
|
1068
1100
|
/**
|
|
1069
1101
|
* Lists the video frame rates supported by the active camera for the current format.
|
|
1070
1102
|
* Supported values depend on the selected camera, lens, and video quality.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA8EA,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 { PermissionState, 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 type CameraPreviewAspectRatio = '4:3' | '16:9' | 'fill';\n\nexport type BarcodeScannerFormat =\n | 'aztec'\n | 'codabar'\n | 'code_39'\n | 'code_93'\n | 'code_128'\n | 'data_matrix'\n | 'ean_8'\n | 'ean_13'\n | 'itf'\n | 'pdf417'\n | 'qr_code'\n | 'upc_a'\n | 'upc_e';\n\nexport type BarcodeFormat = BarcodeScannerFormat | 'unknown';\n\nexport interface BarcodeScannerOptions {\n /**\n * Restricts detection to the given formats. Leaving this empty scans all supported formats.\n * Restricting formats can improve scanning speed.\n */\n formats?: BarcodeScannerFormat[];\n /**\n * Minimum delay between native scan attempts in milliseconds.\n * Lower values scan more often but use more CPU.\n * @default 500\n */\n detectionInterval?: number;\n}\n\nexport interface BarcodeScanResult {\n /** Decoded barcode value. */\n value: string;\n /** Barcode format. */\n format: BarcodeFormat;\n /** Human-readable value when the platform exposes one. */\n displayValue?: string;\n /** Base64-encoded raw bytes when the platform exposes them. */\n rawBytes?: string;\n}\n\nexport interface BarcodeScannedEvent {\n /** Barcodes decoded from the current frame. */\n barcodes: BarcodeScanResult[];\n}\n\nexport interface BarcodeScanErrorEvent {\n /** Native scanner error message. */\n message: string;\n}\n\nexport interface CameraPermissionStatus {\n camera: PermissionState;\n microphone?: PermissionState;\n}\n\nexport interface PermissionRequestOptions {\n disableAudio?: boolean;\n showSettingsAlert?: boolean;\n title?: string;\n message?: string;\n openSettingsButtonTitle?: string;\n cancelButtonTitle?: string;\n}\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\nexport type VideoQuality = 'low' | 'medium' | 'high' | '2160p' | '1080p' | '720p' | '480p' | '4:3';\n\n/**\n * Video codec identifiers used when recording.\n * - `avc1`: H.264\n * - `hvc1`: HEVC / H.265\n */\nexport type VideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';\n\n/**\n * Video stabilization modes used when recording.\n *\n * On Android only `off` and `standard` are supported.\n * On iOS all listed modes may be available when the device supports video stabilization.\n */\nexport type VideoStabilizationMode =\n | 'off'\n | 'standard'\n | 'cinematic'\n | 'cinematicExtended'\n | 'previewOptimized'\n | 'cinematicExtendedEnhanced'\n | 'auto'\n | 'lowLatency';\n\nexport type RecordingFinishedReason = 'manual' | 'maxDuration' | 'maxFileSize';\n\nexport interface RecordingFinishedEvent {\n /**\n * The path to the recorded video file.\n */\n videoFilePath: string;\n /**\n * Why the recording stopped.\n */\n reason: RecordingFinishedReason;\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?: CameraPreviewAspectRatio;\n /**\n * Controls how the camera preview fills the available space.\n * - 'contain': Fits the entire preview within the space, may show letterboxing (default).\n * - 'cover': Fills the entire space, may crop edges of the preview.\n * @default \"contain\"\n * @platform android, ios, web\n */\n aspectMode?: 'cover' | 'contain';\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 android, 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 /**\n * If true, disables the visual focus indicator when tapping to focus.\n * @platform android, ios\n * @default false\n */\n disableFocusIndicator?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n /**\n * On Android, attempts to bind a physical camera directly when `deviceId` refers to a physical lens.\n * Disabled by default because OEM support is inconsistent; when false, Android keeps the current logical-camera fallback behavior.\n * @default false\n * @platform android\n */\n enablePhysicalDeviceSelection?: boolean;\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 * If true, enables video capture capabilities when the camera starts.\n * @default false\n * @platform android, ios\n * @since 7.11.0\n */\n enableVideoMode?: boolean;\n /**\n * If true, forces the camera to start/restart even if it's already running or busy.\n * This will kill the current camera session and start a new one, ignoring all state checks.\n * @default false\n * @platform android, ios, web\n */\n force?: boolean;\n /**\n * Sets the quality of video for recording.\n * Options: 'low', 'medium', 'high', '2160p', '1080p', '720p', '480p', '4:3'\n * @note On Android requires 'enableVideoMode' to be true\n * @note Will affect the entire preview stream for iOS\n * @platform ios, android\n * @default \"high\"\n */\n videoQuality?: VideoQuality;\n /**\n * Maximum recording duration in seconds. Recording stops automatically when reached.\n * @platform ios, android\n */\n maxDuration?: number;\n /**\n * Maximum recording file size in bytes. Recording stops automatically when reached.\n * @platform ios, android\n */\n maxFileSize?: number;\n /**\n * Preferred video codec for recording.\n * @platform ios, android\n * @default \"avc1\"\n */\n videoCodec?: VideoCodec;\n /**\n * Target video frame rate in frames per second.\n * Applied when recording starts. Use `getSupportedVideoFrameRates()` to list supported values.\n * @platform ios, android\n * @since 8.6.0\n */\n frameRate?: number;\n /**\n * Preferred video stabilization mode for recording.\n * @platform ios, android\n * @default \"off\"\n */\n videoStabilizationMode?: VideoStabilizationMode;\n /**\n * When `true`, allows haptic feedback and system sounds while recording video with audio.\n * iOS suppresses haptics during audio input recording unless this is enabled.\n * Requires `disableAudio: false`.\n * @platform ios\n * @default false\n * @since 8.8.0\n */\n allowHapticsAndSystemSoundsDuringRecording?: boolean;\n /**\n * Starts barcode scanning together with the camera preview.\n * Set to `true` or pass options to scan all supported formats.\n * Omit this option to keep barcode scanning disabled at startup.\n * @platform android, ios, web\n * @since 8.8.0\n */\n barcodeScanner?: boolean | BarcodeScannerOptions;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /**\n * The maximum height of the picture in pixels. The image will be resized to fit within this height while maintaining aspect ratio.\n * If not specified the captured image will match the preview's visible area.\n */\n height?: number;\n /**\n * The maximum width of the picture in pixels. The image will be resized to fit within this width while maintaining aspect ratio.\n * If not specified the captured image will match the preview's visible area.\n */\n width?: number;\n /**\n * The quality of the captured image, from 0 to 100.\n * Does not apply to `png` format.\n * @default 85\n */\n quality?: number;\n /**\n * The format of the captured image.\n * @default \"jpeg\"\n */\n format?: PictureFormat;\n /**\n * If true, the captured image will be saved to the user's gallery.\n * @default false\n * @since 7.5.0\n */\n saveToGallery?: boolean;\n /**\n * If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.\n * This may prompt the user for location permissions.\n * @default false\n * @since 7.6.0\n */\n withExifLocation?: boolean;\n /**\n * If true, the plugin will embed a timestamp in the top-right corner of the image.\n * @default false\n * @since 7.17.0\n */\n embedTimestamp?: boolean;\n /**\n * If true, the plugin will embed the current location in the top-right corner of the image.\n * Requires `withExifLocation` to be enabled.\n * @default false\n * @since 7.18.0\n */\n embedLocation?: boolean;\n /**\n * Sets the priority for photo quality vs. capture speed.\n * - \"speed\": Prioritizes faster capture times, may reduce image quality.\n * - \"balanced\": Aims for a balance between quality and speed.\n * - \"quality\": Prioritizes image quality, may reduce capture speed.\n * See https://developer.apple.com/documentation/avfoundation/avcapturephotosettings/photoqualityprioritization for details.\n *\n * @since 7.21.0\n * @platform ios\n * @default \"speed\"\n */\n photoQualityPrioritization?: 'speed' | 'balanced' | 'quality';\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/** Reusable exposure mode type for cross-platform support. */\nexport type ExposureMode = 'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM';\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 * Represents safe area insets for devices.\n * Android: Values are expressed in logical pixels (dp) to match JS layout units.\n * iOS: Values are expressed in physical pixels and exclude status bar.\n */\nexport interface SafeAreaInsets {\n /** Current device orientation (1 = portrait, 2 = landscape, 0 = unknown). */\n orientation: number;\n /**\n * Orientation-aware notch/camera cutout inset (excluding status bar).\n * In portrait mode: returns top inset (notch at top).\n * In landscape mode: returns left inset (notch at side).\n * Android: Value in dp, iOS: Value in pixels (status bar excluded).\n */\n top: number;\n}\n\n/**\n * Canonical device orientation values across platforms.\n */\nexport type DeviceOrientation = 'portrait' | 'landscape-left' | 'landscape-right' | 'portrait-upside-down' | 'unknown';\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 * @param {object} options - Optional configuration for stopping the camera.\n * @param {boolean} options.force - If true, forces the camera to stop even if busy or capturing. Default: false.\n * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(options?: { force?: boolean }): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * If `storeToFile` was set to `true` when starting the preview, the returned\n * `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.\n *\n * @param {CameraPreviewPictureOptions} options - The options for capturing the picture.\n * @returns {Promise<{ value: string; exif: ExifData }>} Resolves with:\n * - `value`: base64 string, or file path if `storeToFile` is true\n * - `exif`: extracted EXIF metadata when available\n * @since 0.0.1\n */\n capture(options: CameraPreviewPictureOptions): 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 * Starts barcode scanning on the active camera preview.\n *\n * The scanner reuses the current camera session and emits `barcodeScanned` events.\n * Call `stopBarcodeScanner()` when scanning is no longer needed.\n *\n * Android uses the lightweight Google Play Services ML Kit model. If the model is not installed yet,\n * first scans may return no result until Google Play Services finishes downloading it.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n startBarcodeScanner(options?: BarcodeScannerOptions): Promise<void>;\n\n /**\n * Stops barcode scanning while keeping the camera preview running.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n stopBarcodeScanner(): Promise<void>;\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: CameraPreviewAspectRatio; x?: number; y?: number }} options - The desired aspect ratio and optional position.\n * - aspectRatio: The desired aspect ratio ('4:3', '16:9', or 'fill')\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.5.0\n * @platform android, ios\n */\n setAspectRatio(options: { aspectRatio: CameraPreviewAspectRatio; x?: number; y?: number }): 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: CameraPreviewAspectRatio }>} A promise that resolves with the current aspect ratio.\n * @since 7.5.0\n * @platform android, ios\n */\n getAspectRatio(): Promise<{ aspectRatio: CameraPreviewAspectRatio }>;\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 * Checks the current camera (and optionally microphone) permission status without prompting the system dialog.\n *\n * @param options Set `disableAudio` to `false` to also include microphone status (defaults to `true`).\n * @returns {Promise<CameraPermissionStatus>} A promise resolving to the current authorization states.\n * @since 8.7.0\n */\n checkPermissions(options?: Pick<PermissionRequestOptions, 'disableAudio'>): Promise<CameraPermissionStatus>;\n\n /**\n * Requests camera (and optional microphone) permissions. If permissions are already granted or denied,\n * the current status is returned without prompting. When `showSettingsAlert` is true and permissions are denied,\n * a platform specific alert guiding the user to the app settings will be presented.\n *\n * @param {PermissionRequestOptions} options - Configuration for the permission request behaviour.\n * @returns {Promise<CameraPermissionStatus>} A promise resolving to the final authorization states.\n * @since 8.7.0\n */\n requestPermissions(options?: PermissionRequestOptions): Promise<CameraPermissionStatus>;\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: { flashMode: CameraPreviewFlashMode | string }): 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<RecordingFinishedEvent>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<RecordingFinishedEvent>;\n\n /**\n * Starts recording a video.\n *\n * Supports `frameRate`, `videoCodec`, `videoStabilizationMode`, `maxDuration`, `maxFileSize`, `disableAudio`, and `allowHapticsAndSystemSoundsDuringRecording` on each call.\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 * Sets the video recording quality for the active camera session.\n *\n * @param {{ quality: VideoQuality }} options - The desired video quality.\n * @returns {Promise<void>} A promise that resolves when the quality is set.\n * @since 8.5.0\n * @platform android, ios\n */\n setVideoQuality(options: { quality: VideoQuality }): Promise<void>;\n\n /**\n * Gets the current video recording quality.\n *\n * @returns {Promise<{ quality: VideoQuality }>} A promise that resolves with the current quality.\n * @since 8.5.0\n * @platform android, ios\n */\n getVideoQuality(): Promise<{ quality: VideoQuality }>;\n\n /**\n * Returns the video qualities supported by the active camera.\n *\n * @returns {Promise<{ qualities: VideoQuality[] }>} A promise that resolves with supported qualities.\n * @since 8.5.0\n * @platform android, ios\n */\n getSupportedVideoQualities(): Promise<{ qualities: VideoQuality[] }>;\n\n /**\n * Sets the video codec used when recording.\n *\n * @param {{ codec: VideoCodec }} options - The desired codec.\n * @returns {Promise<void>} A promise that resolves when the codec is set.\n * @since 8.5.0\n * @platform android, ios\n */\n setVideoCodec(options: { codec: VideoCodec }): Promise<void>;\n\n /**\n * Gets the current video codec used for recording.\n *\n * @returns {Promise<{ codec: VideoCodec }>} A promise that resolves with the current codec.\n * @since 8.5.0\n * @platform android, ios\n */\n getVideoCodec(): Promise<{ codec: VideoCodec }>;\n\n /**\n * Returns the video codecs supported by the active camera.\n *\n * @returns {Promise<{ codecs: VideoCodec[] }>} A promise that resolves with supported codecs.\n * @since 8.5.0\n * @platform android, ios\n */\n getSupportedVideoCodecs(): Promise<{ codecs: VideoCodec[] }>;\n\n /**\n * Checks whether video stabilization is supported by the active camera.\n *\n * @returns {Promise<{ supported: boolean }>} A promise that resolves with the support state.\n * @since 8.5.2\n * @platform android, ios\n */\n isVideoStabilizationSupported(): Promise<{ supported: boolean }>;\n\n /**\n * Returns the video stabilization modes supported by the active camera.\n *\n * @returns {Promise<{ modes: VideoStabilizationMode[] }>} A promise that resolves with supported modes.\n * @since 8.5.2\n * @platform android, ios\n */\n getSupportedVideoStabilizationModes(): Promise<{ modes: VideoStabilizationMode[] }>;\n\n /**\n * Gets the current video stabilization mode.\n *\n * @returns {Promise<{ mode: VideoStabilizationMode }>} A promise that resolves with the current mode.\n * @since 8.5.2\n * @platform android, ios\n */\n getVideoStabilizationMode(): Promise<{ mode: VideoStabilizationMode }>;\n\n /**\n * Sets the video stabilization mode for recording.\n * Cannot be changed while a recording is in progress.\n * You can also pass `videoStabilizationMode` in `startRecordVideo()` options.\n *\n * @param {{ mode: VideoStabilizationMode }} options - The desired stabilization mode.\n * @returns {Promise<void>} A promise that resolves when the mode is set.\n * @since 8.5.2\n * @platform android, ios\n */\n setVideoStabilizationMode(options: { mode: VideoStabilizationMode }): 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.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\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 * @since 7.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\n */\n setZoom(options: { level: number; ramp?: boolean; autoFocus?: boolean }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.5.0\n * @platform android, ios\n */\n getFlashMode(): Promise<{ flashMode: FlashMode }>;\n\n /**\n * Removes all registered listeners.\n *\n * @since 7.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\n */\n setDeviceId(options: { deviceId: string }): Promise<void>;\n\n /**\n * Gets the ID of the camera device that is currently bound.\n * On Android, if a physical-lens request falls back to a logical camera, this returns the bound logical camera ID.\n *\n * @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.\n * @since 7.5.0\n * @platform android, ios\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 * @since 7.5.0\n * @platform android, ios\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 * @since 7.5.0\n * @platform android, ios\n */\n setPreviewSize(options: { x?: number; y?: number; width: number; height: number }): 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 * Note: The plugin does not attach any native tap-to-focus gesture handlers. Handle taps in\n * your HTML/JS (e.g., on the overlaying UI), then pass normalized coordinates here.\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 7.5.0\n * @platform android, ios\n */\n setFocus(options: { x: number; y: number }): Promise<void>;\n\n /**\n * Adds a listener for screen resize events.\n * @param {string} eventName - The event name to listen for.\n * @param {Function} listenerFunc - The function to call when the event is triggered.\n * @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.\n * @since 7.5.0\n * @platform android, ios\n */\n addListener(\n eventName: 'screenResize',\n listenerFunc: (data: { width: number; height: number; x: number; y: number }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for orientation change events.\n * @param {string} eventName - The event name to listen for.\n * @param {Function} listenerFunc - The function to call when the event is triggered.\n * @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.\n * @since 7.5.0\n * @platform android, ios\n */\n addListener(\n eventName: 'orientationChange',\n listenerFunc: (data: { orientation: DeviceOrientation }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for barcode scan results.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n addListener(\n eventName: 'barcodeScanned',\n listenerFunc: (data: BarcodeScannedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for non-fatal barcode scanner errors.\n *\n * @since 8.8.0\n * @platform android, web\n */\n addListener(\n eventName: 'barcodeScanError',\n listenerFunc: (data: BarcodeScanErrorEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener fired when a video recording finishes natively, including automatic stops.\n *\n * @since 8.4.7\n * @platform android, ios\n */\n addListener(\n eventName: 'recordingFinished',\n listenerFunc: (data: RecordingFinishedEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Deletes a file at the given absolute path on the device.\n * Use this to quickly clean up temporary images created with `storeToFile`.\n * On web, this is not supported and will throw.\n * @since 7.5.0\n * @platform android, ios\n */\n deleteFile(options: { path: string }): Promise<{ success: boolean }>;\n\n /**\n * Gets the safe area insets for devices.\n * Returns the orientation-aware notch/camera cutout inset and the current orientation.\n * In portrait mode: returns top inset (notch at top).\n * In landscape mode: returns left inset (notch moved to side).\n * This specifically targets the cutout area (notch, punch hole, etc.) that all modern phones have.\n *\n * Android: Values returned in dp (logical pixels).\n * iOS: Values returned in physical pixels, excluding status bar (only pure notch/cutout size).\n *\n * @platform android, ios\n */\n getSafeAreaInsets(): Promise<SafeAreaInsets>;\n\n /**\n * Gets the current device orientation in a cross-platform format.\n * @since 7.5.0\n * @platform android, ios\n */\n getOrientation(): Promise<{ orientation: DeviceOrientation }>;\n\n /**\n * Returns the exposure modes supported by the active camera.\n * Modes can include: 'locked', 'auto', 'continuous', 'custom'.\n * @platform android, ios\n */\n getExposureModes(): Promise<{ modes: ExposureMode[] }>;\n\n /**\n * Returns the current exposure mode.\n * @platform android, ios\n */\n getExposureMode(): Promise<{ mode: ExposureMode }>;\n\n /**\n * Sets the exposure mode.\n * @platform android, ios\n */\n setExposureMode(options: { mode: ExposureMode }): Promise<void>;\n\n /**\n * Returns the exposure compensation (EV bias) supported range.\n * @platform ios, android\n */\n getExposureCompensationRange(): Promise<{\n min: number;\n max: number;\n step: number;\n }>;\n\n /**\n * Returns the current exposure compensation (EV bias).\n * @platform ios, android\n */\n getExposureCompensation(): Promise<{ value: number }>;\n\n /**\n * Sets the exposure compensation (EV bias). Value will be clamped to range.\n * @platform ios, android\n */\n setExposureCompensation(options: { value: number }): Promise<void>;\n\n /**\n * Lists the video frame rates supported by the active camera for the current format.\n * Supported values depend on the selected camera, lens, and video quality.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n getSupportedVideoFrameRates(): Promise<{\n frameRates: number[];\n }>;\n\n /**\n * Returns the configured video frame rate for the active camera.\n * On Android the actual recording frame rate can still vary in low light or under thermal pressure.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n getVideoFrameRate(): Promise<{\n frameRate: number;\n }>;\n\n /**\n * Sets the target video frame rate for the active camera session.\n * Prefer passing `frameRate` to `startRecordVideo()` when starting a recording.\n * Rejects unsupported values with a clear error.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n setVideoFrameRate(options: { frameRate: number }): Promise<void>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA8EA,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 { PermissionState, 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 type CameraPreviewAspectRatio = '4:3' | '16:9' | 'fill';\n\nexport type BarcodeScannerFormat =\n | 'aztec'\n | 'codabar'\n | 'code_39'\n | 'code_93'\n | 'code_128'\n | 'data_matrix'\n | 'ean_8'\n | 'ean_13'\n | 'itf'\n | 'pdf417'\n | 'qr_code'\n | 'upc_a'\n | 'upc_e';\n\nexport type BarcodeFormat = BarcodeScannerFormat | 'unknown';\n\nexport interface BarcodeScannerOptions {\n /**\n * Restricts detection to the given formats. Leaving this empty scans all supported formats.\n * Restricting formats can improve scanning speed.\n */\n formats?: BarcodeScannerFormat[];\n /**\n * Minimum delay between native scan attempts in milliseconds.\n * Lower values scan more often but use more CPU.\n * @default 500\n */\n detectionInterval?: number;\n}\n\nexport interface BarcodeScanResult {\n /** Decoded barcode value. */\n value: string;\n /** Barcode format. */\n format: BarcodeFormat;\n /** Human-readable value when the platform exposes one. */\n displayValue?: string;\n /** Base64-encoded raw bytes when the platform exposes them. */\n rawBytes?: string;\n}\n\nexport interface BarcodeScannedEvent {\n /** Barcodes decoded from the current frame. */\n barcodes: BarcodeScanResult[];\n}\n\nexport interface BarcodeScanErrorEvent {\n /** Native scanner error message. */\n message: string;\n}\n\nexport interface CameraPermissionStatus {\n camera: PermissionState;\n microphone?: PermissionState;\n}\n\nexport interface PermissionRequestOptions {\n disableAudio?: boolean;\n showSettingsAlert?: boolean;\n title?: string;\n message?: string;\n openSettingsButtonTitle?: string;\n cancelButtonTitle?: string;\n}\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\nexport type VideoQuality = 'low' | 'medium' | 'high' | '2160p' | '1080p' | '720p' | '480p' | '4:3';\n\n/**\n * Video codec identifiers used when recording.\n * - `avc1`: H.264\n * - `hvc1`: HEVC / H.265\n */\nexport type VideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';\n\n/**\n * Video stabilization modes used when recording.\n *\n * On Android only `off` and `standard` are supported.\n * On iOS all listed modes may be available when the device supports video stabilization.\n */\nexport type VideoStabilizationMode =\n | 'off'\n | 'standard'\n | 'cinematic'\n | 'cinematicExtended'\n | 'previewOptimized'\n | 'cinematicExtendedEnhanced'\n | 'auto'\n | 'lowLatency';\n\nexport type RecordingFinishedReason = 'manual' | 'maxDuration' | 'maxFileSize';\n\nexport interface RecordingFinishedEvent {\n /**\n * The path to the recorded video file.\n */\n videoFilePath: string;\n /**\n * Why the recording stopped.\n */\n reason: RecordingFinishedReason;\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?: CameraPreviewAspectRatio;\n /**\n * Controls how the camera preview fills the available space.\n * - 'contain': Fits the entire preview within the space, may show letterboxing (default).\n * - 'cover': Fills the entire space, may crop edges of the preview.\n * @default \"contain\"\n * @platform android, ios, web\n */\n aspectMode?: 'cover' | 'contain';\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 android, 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 /**\n * If true, disables the visual focus indicator when tapping to focus.\n * @platform android, ios\n * @default false\n */\n disableFocusIndicator?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n /**\n * On Android, attempts to bind a physical camera directly when `deviceId` refers to a physical lens.\n * Disabled by default because OEM support is inconsistent; when false, Android keeps the current logical-camera fallback behavior.\n * @default false\n * @platform android\n */\n enablePhysicalDeviceSelection?: boolean;\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 * If true, enables video capture capabilities when the camera starts.\n * @default false\n * @platform android, ios\n * @since 7.11.0\n */\n enableVideoMode?: boolean;\n /**\n * If true, forces the camera to start/restart even if it's already running or busy.\n * This will kill the current camera session and start a new one, ignoring all state checks.\n * @default false\n * @platform android, ios, web\n */\n force?: boolean;\n /**\n * Sets the quality of video for recording.\n * Options: 'low', 'medium', 'high', '2160p', '1080p', '720p', '480p', '4:3'\n * @note On Android requires 'enableVideoMode' to be true\n * @note Will affect the entire preview stream for iOS\n * @platform ios, android\n * @default \"high\"\n */\n videoQuality?: VideoQuality;\n /**\n * Maximum recording duration in seconds. Recording stops automatically when reached.\n * @platform ios, android\n */\n maxDuration?: number;\n /**\n * Maximum recording file size in bytes. Recording stops automatically when reached.\n * @platform ios, android\n */\n maxFileSize?: number;\n /**\n * Preferred video codec for recording.\n * @platform ios, android\n * @default \"avc1\"\n */\n videoCodec?: VideoCodec;\n /**\n * Target video frame rate in frames per second.\n * Applied when recording starts. Use `getSupportedVideoFrameRates()` to list supported values.\n * @platform ios, android\n * @since 8.6.0\n */\n frameRate?: number;\n /**\n * Preferred video stabilization mode for recording.\n * @platform ios, android\n * @default \"off\"\n */\n videoStabilizationMode?: VideoStabilizationMode;\n /**\n * When `true`, allows haptic feedback and system sounds while recording video with audio.\n * iOS suppresses haptics during audio input recording unless this is enabled.\n * Requires `disableAudio: false`.\n * @platform ios\n * @default false\n * @since 8.8.0\n */\n allowHapticsAndSystemSoundsDuringRecording?: boolean;\n /**\n * Starts barcode scanning together with the camera preview.\n * Set to `true` or pass options to scan all supported formats.\n * Omit this option to keep barcode scanning disabled at startup.\n * @platform android, ios, web\n * @since 8.8.0\n */\n barcodeScanner?: boolean | BarcodeScannerOptions;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /**\n * The maximum height of the picture in pixels. The image will be resized to fit within this height while maintaining aspect ratio.\n * If not specified the captured image will match the preview's visible area.\n */\n height?: number;\n /**\n * The maximum width of the picture in pixels. The image will be resized to fit within this width while maintaining aspect ratio.\n * If not specified the captured image will match the preview's visible area.\n */\n width?: number;\n /**\n * The quality of the captured image, from 0 to 100.\n * Does not apply to `png` format.\n * @default 85\n */\n quality?: number;\n /**\n * The format of the captured image.\n * @default \"jpeg\"\n */\n format?: PictureFormat;\n /**\n * If true, the captured image will be saved to the user's gallery.\n * @default false\n * @since 7.5.0\n */\n saveToGallery?: boolean;\n /**\n * If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.\n * This may prompt the user for location permissions.\n * @default false\n * @since 7.6.0\n */\n withExifLocation?: boolean;\n /**\n * If true, the plugin will embed a timestamp in the top-right corner of the image.\n * @default false\n * @since 7.17.0\n */\n embedTimestamp?: boolean;\n /**\n * If true, the plugin will embed the current location in the top-right corner of the image.\n * Requires `withExifLocation` to be enabled.\n * @default false\n * @since 7.18.0\n */\n embedLocation?: boolean;\n /**\n * Sets the priority for photo quality vs. capture speed.\n * - \"speed\": Prioritizes faster capture times, may reduce image quality.\n * - \"balanced\": Aims for a balance between quality and speed.\n * - \"quality\": Prioritizes image quality, may reduce capture speed.\n * See https://developer.apple.com/documentation/avfoundation/avcapturephotosettings/photoqualityprioritization for details.\n *\n * @since 7.21.0\n * @platform ios\n * @default \"speed\"\n */\n photoQualityPrioritization?: 'speed' | 'balanced' | 'quality';\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/** Reusable exposure mode type for cross-platform support. */\nexport type ExposureMode = 'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM';\n\n/**\n * Reusable white-balance mode type for cross-platform support.\n * `CUSTOM` is reserved for a future manual white-balance gains API and is not\n * returned by `getWhiteBalanceModes()` until implemented.\n */\nexport type WhiteBalanceMode = 'AUTO' | 'LOCK' | 'CONTINUOUS' | 'CUSTOM';\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 * Represents safe area insets for devices.\n * Android: Values are expressed in logical pixels (dp) to match JS layout units.\n * iOS: Values are expressed in physical pixels and exclude status bar.\n */\nexport interface SafeAreaInsets {\n /** Current device orientation (1 = portrait, 2 = landscape, 0 = unknown). */\n orientation: number;\n /**\n * Orientation-aware notch/camera cutout inset (excluding status bar).\n * In portrait mode: returns top inset (notch at top).\n * In landscape mode: returns left inset (notch at side).\n * Android: Value in dp, iOS: Value in pixels (status bar excluded).\n */\n top: number;\n}\n\n/**\n * Canonical device orientation values across platforms.\n */\nexport type DeviceOrientation = 'portrait' | 'landscape-left' | 'landscape-right' | 'portrait-upside-down' | 'unknown';\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 * @param {object} options - Optional configuration for stopping the camera.\n * @param {boolean} options.force - If true, forces the camera to stop even if busy or capturing. Default: false.\n * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(options?: { force?: boolean }): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * If `storeToFile` was set to `true` when starting the preview, the returned\n * `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.\n *\n * @param {CameraPreviewPictureOptions} options - The options for capturing the picture.\n * @returns {Promise<{ value: string; exif: ExifData }>} Resolves with:\n * - `value`: base64 string, or file path if `storeToFile` is true\n * - `exif`: extracted EXIF metadata when available\n * @since 0.0.1\n */\n capture(options: CameraPreviewPictureOptions): 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 * Starts barcode scanning on the active camera preview.\n *\n * The scanner reuses the current camera session and emits `barcodeScanned` events.\n * Call `stopBarcodeScanner()` when scanning is no longer needed.\n *\n * Android uses the lightweight Google Play Services ML Kit model. If the model is not installed yet,\n * first scans may return no result until Google Play Services finishes downloading it.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n startBarcodeScanner(options?: BarcodeScannerOptions): Promise<void>;\n\n /**\n * Stops barcode scanning while keeping the camera preview running.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n stopBarcodeScanner(): Promise<void>;\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: CameraPreviewAspectRatio; x?: number; y?: number }} options - The desired aspect ratio and optional position.\n * - aspectRatio: The desired aspect ratio ('4:3', '16:9', or 'fill')\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.5.0\n * @platform android, ios\n */\n setAspectRatio(options: { aspectRatio: CameraPreviewAspectRatio; x?: number; y?: number }): 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: CameraPreviewAspectRatio }>} A promise that resolves with the current aspect ratio.\n * @since 7.5.0\n * @platform android, ios\n */\n getAspectRatio(): Promise<{ aspectRatio: CameraPreviewAspectRatio }>;\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 * Checks the current camera (and optionally microphone) permission status without prompting the system dialog.\n *\n * @param options Set `disableAudio` to `false` to also include microphone status (defaults to `true`).\n * @returns {Promise<CameraPermissionStatus>} A promise resolving to the current authorization states.\n * @since 8.7.0\n */\n checkPermissions(options?: Pick<PermissionRequestOptions, 'disableAudio'>): Promise<CameraPermissionStatus>;\n\n /**\n * Requests camera (and optional microphone) permissions. If permissions are already granted or denied,\n * the current status is returned without prompting. When `showSettingsAlert` is true and permissions are denied,\n * a platform specific alert guiding the user to the app settings will be presented.\n *\n * @param {PermissionRequestOptions} options - Configuration for the permission request behaviour.\n * @returns {Promise<CameraPermissionStatus>} A promise resolving to the final authorization states.\n * @since 8.7.0\n */\n requestPermissions(options?: PermissionRequestOptions): Promise<CameraPermissionStatus>;\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: { flashMode: CameraPreviewFlashMode | string }): 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<RecordingFinishedEvent>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<RecordingFinishedEvent>;\n\n /**\n * Starts recording a video.\n *\n * Supports `frameRate`, `videoCodec`, `videoStabilizationMode`, `maxDuration`, `maxFileSize`, `disableAudio`, and `allowHapticsAndSystemSoundsDuringRecording` on each call.\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 * Sets the video recording quality for the active camera session.\n *\n * @param {{ quality: VideoQuality }} options - The desired video quality.\n * @returns {Promise<void>} A promise that resolves when the quality is set.\n * @since 8.5.0\n * @platform android, ios\n */\n setVideoQuality(options: { quality: VideoQuality }): Promise<void>;\n\n /**\n * Gets the current video recording quality.\n *\n * @returns {Promise<{ quality: VideoQuality }>} A promise that resolves with the current quality.\n * @since 8.5.0\n * @platform android, ios\n */\n getVideoQuality(): Promise<{ quality: VideoQuality }>;\n\n /**\n * Returns the video qualities supported by the active camera.\n *\n * @returns {Promise<{ qualities: VideoQuality[] }>} A promise that resolves with supported qualities.\n * @since 8.5.0\n * @platform android, ios\n */\n getSupportedVideoQualities(): Promise<{ qualities: VideoQuality[] }>;\n\n /**\n * Sets the video codec used when recording.\n *\n * @param {{ codec: VideoCodec }} options - The desired codec.\n * @returns {Promise<void>} A promise that resolves when the codec is set.\n * @since 8.5.0\n * @platform android, ios\n */\n setVideoCodec(options: { codec: VideoCodec }): Promise<void>;\n\n /**\n * Gets the current video codec used for recording.\n *\n * @returns {Promise<{ codec: VideoCodec }>} A promise that resolves with the current codec.\n * @since 8.5.0\n * @platform android, ios\n */\n getVideoCodec(): Promise<{ codec: VideoCodec }>;\n\n /**\n * Returns the video codecs supported by the active camera.\n *\n * @returns {Promise<{ codecs: VideoCodec[] }>} A promise that resolves with supported codecs.\n * @since 8.5.0\n * @platform android, ios\n */\n getSupportedVideoCodecs(): Promise<{ codecs: VideoCodec[] }>;\n\n /**\n * Checks whether video stabilization is supported by the active camera.\n *\n * @returns {Promise<{ supported: boolean }>} A promise that resolves with the support state.\n * @since 8.5.2\n * @platform android, ios\n */\n isVideoStabilizationSupported(): Promise<{ supported: boolean }>;\n\n /**\n * Returns the video stabilization modes supported by the active camera.\n *\n * @returns {Promise<{ modes: VideoStabilizationMode[] }>} A promise that resolves with supported modes.\n * @since 8.5.2\n * @platform android, ios\n */\n getSupportedVideoStabilizationModes(): Promise<{ modes: VideoStabilizationMode[] }>;\n\n /**\n * Gets the current video stabilization mode.\n *\n * @returns {Promise<{ mode: VideoStabilizationMode }>} A promise that resolves with the current mode.\n * @since 8.5.2\n * @platform android, ios\n */\n getVideoStabilizationMode(): Promise<{ mode: VideoStabilizationMode }>;\n\n /**\n * Sets the video stabilization mode for recording.\n * Cannot be changed while a recording is in progress.\n * You can also pass `videoStabilizationMode` in `startRecordVideo()` options.\n *\n * @param {{ mode: VideoStabilizationMode }} options - The desired stabilization mode.\n * @returns {Promise<void>} A promise that resolves when the mode is set.\n * @since 8.5.2\n * @platform android, ios\n */\n setVideoStabilizationMode(options: { mode: VideoStabilizationMode }): 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.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\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 * @since 7.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\n */\n setZoom(options: { level: number; ramp?: boolean; autoFocus?: boolean }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.5.0\n * @platform android, ios\n */\n getFlashMode(): Promise<{ flashMode: FlashMode }>;\n\n /**\n * Removes all registered listeners.\n *\n * @since 7.5.0\n * @platform android, ios\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.5.0\n * @platform android, ios\n */\n setDeviceId(options: { deviceId: string }): Promise<void>;\n\n /**\n * Gets the ID of the camera device that is currently bound.\n * On Android, if a physical-lens request falls back to a logical camera, this returns the bound logical camera ID.\n *\n * @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.\n * @since 7.5.0\n * @platform android, ios\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 * @since 7.5.0\n * @platform android, ios\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 * @since 7.5.0\n * @platform android, ios\n */\n setPreviewSize(options: { x?: number; y?: number; width: number; height: number }): 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 * Note: The plugin does not attach any native tap-to-focus gesture handlers. Handle taps in\n * your HTML/JS (e.g., on the overlaying UI), then pass normalized coordinates here.\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 7.5.0\n * @platform android, ios\n */\n setFocus(options: { x: number; y: number }): Promise<void>;\n\n /**\n * Adds a listener for screen resize events.\n * @param {string} eventName - The event name to listen for.\n * @param {Function} listenerFunc - The function to call when the event is triggered.\n * @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.\n * @since 7.5.0\n * @platform android, ios\n */\n addListener(\n eventName: 'screenResize',\n listenerFunc: (data: { width: number; height: number; x: number; y: number }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for orientation change events.\n * @param {string} eventName - The event name to listen for.\n * @param {Function} listenerFunc - The function to call when the event is triggered.\n * @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.\n * @since 7.5.0\n * @platform android, ios\n */\n addListener(\n eventName: 'orientationChange',\n listenerFunc: (data: { orientation: DeviceOrientation }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for barcode scan results.\n *\n * @since 8.8.0\n * @platform android, ios, web\n */\n addListener(\n eventName: 'barcodeScanned',\n listenerFunc: (data: BarcodeScannedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener for non-fatal barcode scanner errors.\n *\n * @since 8.8.0\n * @platform android, web\n */\n addListener(\n eventName: 'barcodeScanError',\n listenerFunc: (data: BarcodeScanErrorEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Adds a listener fired when a video recording finishes natively, including automatic stops.\n *\n * @since 8.4.7\n * @platform android, ios\n */\n addListener(\n eventName: 'recordingFinished',\n listenerFunc: (data: RecordingFinishedEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Deletes a file at the given absolute path on the device.\n * Use this to quickly clean up temporary images created with `storeToFile`.\n * On web, this is not supported and will throw.\n * @since 7.5.0\n * @platform android, ios\n */\n deleteFile(options: { path: string }): Promise<{ success: boolean }>;\n\n /**\n * Gets the safe area insets for devices.\n * Returns the orientation-aware notch/camera cutout inset and the current orientation.\n * In portrait mode: returns top inset (notch at top).\n * In landscape mode: returns left inset (notch moved to side).\n * This specifically targets the cutout area (notch, punch hole, etc.) that all modern phones have.\n *\n * Android: Values returned in dp (logical pixels).\n * iOS: Values returned in physical pixels, excluding status bar (only pure notch/cutout size).\n *\n * @platform android, ios\n */\n getSafeAreaInsets(): Promise<SafeAreaInsets>;\n\n /**\n * Gets the current device orientation in a cross-platform format.\n * @since 7.5.0\n * @platform android, ios\n */\n getOrientation(): Promise<{ orientation: DeviceOrientation }>;\n\n /**\n * Returns the exposure modes supported by the active camera.\n * Modes can include: 'locked', 'auto', 'continuous', 'custom'.\n * @platform android, ios\n */\n getExposureModes(): Promise<{ modes: ExposureMode[] }>;\n\n /**\n * Returns the current exposure mode.\n * @platform android, ios\n */\n getExposureMode(): Promise<{ mode: ExposureMode }>;\n\n /**\n * Sets the exposure mode.\n * @platform android, ios\n */\n setExposureMode(options: { mode: ExposureMode }): Promise<void>;\n\n /**\n * Returns the exposure compensation (EV bias) supported range.\n * @platform ios, android\n */\n getExposureCompensationRange(): Promise<{\n min: number;\n max: number;\n step: number;\n }>;\n\n /**\n * Returns the current exposure compensation (EV bias).\n * @platform ios, android\n */\n getExposureCompensation(): Promise<{ value: number }>;\n\n /**\n * Sets the exposure compensation (EV bias). Value will be clamped to range.\n * @platform ios, android\n */\n setExposureCompensation(options: { value: number }): Promise<void>;\n\n /**\n * Returns the white-balance modes supported by the active camera.\n * Modes can include: 'AUTO', 'LOCK', 'CONTINUOUS'. `CUSTOM` is not listed\n * until manual gains support is implemented.\n * @platform android, ios\n */\n getWhiteBalanceModes(): Promise<{ modes: WhiteBalanceMode[] }>;\n\n /**\n * Returns the current white-balance mode.\n * @platform android, ios\n */\n getWhiteBalanceMode(): Promise<{ mode: WhiteBalanceMode }>;\n\n /**\n * Sets the white-balance mode. `CONTINUOUS` keeps auto white balance running\n * (recommended; avoids a warm/yellow cast), `LOCK` freezes the current gains,\n * `AUTO` performs a one-time adjustment. `CUSTOM` is reserved and rejected\n * until manual gains support is implemented.\n * @platform android, ios\n */\n setWhiteBalanceMode(options: { mode: WhiteBalanceMode }): Promise<void>;\n\n /**\n * Lists the video frame rates supported by the active camera for the current format.\n * Supported values depend on the selected camera, lens, and video quality.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n getSupportedVideoFrameRates(): Promise<{\n frameRates: number[];\n }>;\n\n /**\n * Returns the configured video frame rate for the active camera.\n * On Android the actual recording frame rate can still vary in low light or under thermal pressure.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n getVideoFrameRate(): Promise<{\n frameRate: number;\n }>;\n\n /**\n * Sets the target video frame rate for the active camera session.\n * Prefer passing `frameRate` to `startRecordVideo()` when starting a recording.\n * Rejects unsupported values with a clear error.\n *\n * @platform android, ios\n * @since 8.6.0\n */\n setVideoFrameRate(options: { frameRate: number }): Promise<void>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|