@capgo/camera-preview 7.6.1 → 7.8.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 +143 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +194 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +255 -1
- package/dist/docs.json +131 -0
- package/dist/esm/definitions.d.ts +47 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +21 -1
- package/dist/esm/web.js +19 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +19 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +19 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapgoCameraPreviewPlugin/CameraController.swift +185 -8
- package/ios/Sources/CapgoCameraPreviewPlugin/Plugin.swift +115 -5
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ import android.graphics.drawable.GradientDrawable;
|
|
|
12
12
|
import android.hardware.camera2.CameraAccessException;
|
|
13
13
|
import android.hardware.camera2.CameraCharacteristics;
|
|
14
14
|
import android.hardware.camera2.CameraManager;
|
|
15
|
+
import android.hardware.camera2.CaptureRequest;
|
|
15
16
|
import android.location.Location;
|
|
16
17
|
import android.media.MediaScannerConnection;
|
|
17
18
|
import android.os.Build;
|
|
@@ -19,6 +20,8 @@ import android.os.Environment;
|
|
|
19
20
|
import android.util.Base64;
|
|
20
21
|
import android.util.DisplayMetrics;
|
|
21
22
|
import android.util.Log;
|
|
23
|
+
import android.util.Range;
|
|
24
|
+
import android.util.Rational;
|
|
22
25
|
import android.util.Size;
|
|
23
26
|
import android.view.MotionEvent;
|
|
24
27
|
import android.view.View;
|
|
@@ -30,12 +33,15 @@ import android.widget.FrameLayout;
|
|
|
30
33
|
import androidx.annotation.NonNull;
|
|
31
34
|
import androidx.annotation.OptIn;
|
|
32
35
|
import androidx.annotation.RequiresApi;
|
|
36
|
+
import androidx.camera.camera2.interop.Camera2CameraControl;
|
|
33
37
|
import androidx.camera.camera2.interop.Camera2CameraInfo;
|
|
38
|
+
import androidx.camera.camera2.interop.CaptureRequestOptions;
|
|
34
39
|
import androidx.camera.camera2.interop.ExperimentalCamera2Interop;
|
|
35
40
|
import androidx.camera.core.AspectRatio;
|
|
36
41
|
import androidx.camera.core.Camera;
|
|
37
42
|
import androidx.camera.core.CameraInfo;
|
|
38
43
|
import androidx.camera.core.CameraSelector;
|
|
44
|
+
import androidx.camera.core.ExposureState;
|
|
39
45
|
import androidx.camera.core.FocusMeteringAction;
|
|
40
46
|
import androidx.camera.core.FocusMeteringResult;
|
|
41
47
|
import androidx.camera.core.ImageCapture;
|
|
@@ -50,6 +56,14 @@ import androidx.camera.core.resolutionselector.AspectRatioStrategy;
|
|
|
50
56
|
import androidx.camera.core.resolutionselector.ResolutionSelector;
|
|
51
57
|
import androidx.camera.core.resolutionselector.ResolutionStrategy;
|
|
52
58
|
import androidx.camera.lifecycle.ProcessCameraProvider;
|
|
59
|
+
import androidx.camera.video.FallbackStrategy;
|
|
60
|
+
import androidx.camera.video.FileOutputOptions;
|
|
61
|
+
import androidx.camera.video.Quality;
|
|
62
|
+
import androidx.camera.video.QualitySelector;
|
|
63
|
+
import androidx.camera.video.Recorder;
|
|
64
|
+
import androidx.camera.video.Recording;
|
|
65
|
+
import androidx.camera.video.VideoCapture;
|
|
66
|
+
import androidx.camera.video.VideoRecordEvent;
|
|
53
67
|
import androidx.camera.view.PreviewView;
|
|
54
68
|
import androidx.core.content.ContextCompat;
|
|
55
69
|
import androidx.exifinterface.media.ExifInterface;
|
|
@@ -69,6 +83,7 @@ import java.nio.ByteBuffer;
|
|
|
69
83
|
import java.text.SimpleDateFormat;
|
|
70
84
|
import java.util.ArrayList;
|
|
71
85
|
import java.util.Arrays;
|
|
86
|
+
import java.util.Arrays;
|
|
72
87
|
import java.util.Collections;
|
|
73
88
|
import java.util.List;
|
|
74
89
|
import java.util.Locale;
|
|
@@ -92,10 +107,19 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
92
107
|
void onCameraStartError(String message);
|
|
93
108
|
}
|
|
94
109
|
|
|
110
|
+
public interface VideoRecordingCallback {
|
|
111
|
+
void onSuccess(String filePath);
|
|
112
|
+
void onError(String message);
|
|
113
|
+
}
|
|
114
|
+
|
|
95
115
|
private ProcessCameraProvider cameraProvider;
|
|
96
116
|
private Camera camera;
|
|
97
117
|
private ImageCapture imageCapture;
|
|
98
118
|
private ImageCapture sampleImageCapture;
|
|
119
|
+
private VideoCapture<Recorder> videoCapture;
|
|
120
|
+
private Recording currentRecording;
|
|
121
|
+
private File currentVideoFile;
|
|
122
|
+
private VideoRecordingCallback currentVideoCallback;
|
|
99
123
|
private PreviewView previewView;
|
|
100
124
|
private GridOverlayView gridOverlayView;
|
|
101
125
|
private FrameLayout previewContainer;
|
|
@@ -115,6 +139,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
115
139
|
private boolean isRunning = false;
|
|
116
140
|
private Size currentPreviewResolution = null;
|
|
117
141
|
private ListenableFuture<FocusMeteringResult> currentFocusFuture = null; // Track current focus operation
|
|
142
|
+
private String currentExposureMode = "CONTINUOUS"; // Default behavior
|
|
118
143
|
|
|
119
144
|
public CameraXView(Context context, WebView webView) {
|
|
120
145
|
this.context = context;
|
|
@@ -717,6 +742,17 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
717
742
|
.setTargetRotation(rotation)
|
|
718
743
|
.build();
|
|
719
744
|
sampleImageCapture = imageCapture;
|
|
745
|
+
|
|
746
|
+
// Setup VideoCapture with rotation and quality fallback
|
|
747
|
+
QualitySelector qualitySelector = QualitySelector.fromOrderedList(
|
|
748
|
+
Arrays.asList(Quality.FHD, Quality.HD, Quality.SD),
|
|
749
|
+
FallbackStrategy.higherQualityOrLowerThan(Quality.FHD)
|
|
750
|
+
);
|
|
751
|
+
Recorder recorder = new Recorder.Builder()
|
|
752
|
+
.setQualitySelector(qualitySelector)
|
|
753
|
+
.build();
|
|
754
|
+
videoCapture = VideoCapture.withOutput(recorder);
|
|
755
|
+
|
|
720
756
|
preview.setSurfaceProvider(previewView.getSurfaceProvider());
|
|
721
757
|
// Unbind any existing use cases and bind new ones
|
|
722
758
|
cameraProvider.unbindAll();
|
|
@@ -724,7 +760,8 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
724
760
|
this,
|
|
725
761
|
currentCameraSelector,
|
|
726
762
|
preview,
|
|
727
|
-
imageCapture
|
|
763
|
+
imageCapture,
|
|
764
|
+
videoCapture
|
|
728
765
|
);
|
|
729
766
|
|
|
730
767
|
// Log details about the active camera
|
|
@@ -1807,6 +1844,22 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1807
1844
|
currentFocusFuture.cancel(true);
|
|
1808
1845
|
}
|
|
1809
1846
|
|
|
1847
|
+
// Reset exposure compensation to 0 on tap-to-focus
|
|
1848
|
+
try {
|
|
1849
|
+
ExposureState state = camera.getCameraInfo().getExposureState();
|
|
1850
|
+
Range<Integer> range = state.getExposureCompensationRange();
|
|
1851
|
+
int zeroIdx = 0;
|
|
1852
|
+
if (range != null && !range.contains(0)) {
|
|
1853
|
+
// Choose the closest index to 0 if 0 is not available
|
|
1854
|
+
zeroIdx = Math.abs(range.getLower()) < Math.abs(range.getUpper())
|
|
1855
|
+
? range.getLower()
|
|
1856
|
+
: range.getUpper();
|
|
1857
|
+
}
|
|
1858
|
+
camera.getCameraControl().setExposureCompensationIndex(zeroIdx);
|
|
1859
|
+
} catch (Exception e) {
|
|
1860
|
+
Log.w(TAG, "setFocus: Failed to reset exposure compensation to 0", e);
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1810
1863
|
int viewWidth = previewView.getWidth();
|
|
1811
1864
|
int viewHeight = previewView.getHeight();
|
|
1812
1865
|
|
|
@@ -1878,6 +1931,108 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
1878
1931
|
}
|
|
1879
1932
|
}
|
|
1880
1933
|
|
|
1934
|
+
// ===================== Exposure APIs =====================
|
|
1935
|
+
public java.util.List<String> getExposureModes() {
|
|
1936
|
+
return Arrays.asList("LOCK", "CONTINUOUS");
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
public String getExposureMode() {
|
|
1940
|
+
return currentExposureMode;
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
@OptIn(markerClass = ExperimentalCamera2Interop.class)
|
|
1944
|
+
public void setExposureMode(String mode) throws Exception {
|
|
1945
|
+
if (camera == null) {
|
|
1946
|
+
throw new Exception("Camera not initialized");
|
|
1947
|
+
}
|
|
1948
|
+
if (mode == null) {
|
|
1949
|
+
throw new Exception("mode is required");
|
|
1950
|
+
}
|
|
1951
|
+
String normalized = mode.toUpperCase(Locale.US);
|
|
1952
|
+
|
|
1953
|
+
try {
|
|
1954
|
+
Camera2CameraControl c2 = Camera2CameraControl.from(
|
|
1955
|
+
camera.getCameraControl()
|
|
1956
|
+
);
|
|
1957
|
+
switch (normalized) {
|
|
1958
|
+
case "LOCK": {
|
|
1959
|
+
CaptureRequestOptions opts = new CaptureRequestOptions.Builder()
|
|
1960
|
+
.setCaptureRequestOption(CaptureRequest.CONTROL_AE_LOCK, true)
|
|
1961
|
+
.setCaptureRequestOption(
|
|
1962
|
+
CaptureRequest.CONTROL_AE_MODE,
|
|
1963
|
+
CaptureRequest.CONTROL_AE_MODE_ON
|
|
1964
|
+
)
|
|
1965
|
+
.build();
|
|
1966
|
+
mainExecutor.execute(() -> c2.setCaptureRequestOptions(opts));
|
|
1967
|
+
currentExposureMode = "LOCK";
|
|
1968
|
+
break;
|
|
1969
|
+
}
|
|
1970
|
+
case "CONTINUOUS": {
|
|
1971
|
+
CaptureRequestOptions opts = new CaptureRequestOptions.Builder()
|
|
1972
|
+
.setCaptureRequestOption(CaptureRequest.CONTROL_AE_LOCK, false)
|
|
1973
|
+
.setCaptureRequestOption(
|
|
1974
|
+
CaptureRequest.CONTROL_AE_MODE,
|
|
1975
|
+
CaptureRequest.CONTROL_AE_MODE_ON
|
|
1976
|
+
)
|
|
1977
|
+
.build();
|
|
1978
|
+
mainExecutor.execute(() -> c2.setCaptureRequestOptions(opts));
|
|
1979
|
+
currentExposureMode = "CONTINUOUS";
|
|
1980
|
+
break;
|
|
1981
|
+
}
|
|
1982
|
+
default:
|
|
1983
|
+
throw new Exception("Unsupported exposure mode: " + mode);
|
|
1984
|
+
}
|
|
1985
|
+
} catch (Exception e) {
|
|
1986
|
+
throw e;
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
public float[] getExposureCompensationRange() throws Exception {
|
|
1991
|
+
if (camera == null) {
|
|
1992
|
+
throw new Exception("Camera not initialized");
|
|
1993
|
+
}
|
|
1994
|
+
ExposureState state = camera.getCameraInfo().getExposureState();
|
|
1995
|
+
Range<Integer> idxRange = state.getExposureCompensationRange();
|
|
1996
|
+
Rational step = state.getExposureCompensationStep();
|
|
1997
|
+
float evStep = step != null
|
|
1998
|
+
? (float) step.getNumerator() / (float) step.getDenominator()
|
|
1999
|
+
: 1.0f;
|
|
2000
|
+
float min = idxRange.getLower() * evStep;
|
|
2001
|
+
float max = idxRange.getUpper() * evStep;
|
|
2002
|
+
return new float[] { min, max, evStep };
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
public float getExposureCompensation() throws Exception {
|
|
2006
|
+
if (camera == null) {
|
|
2007
|
+
throw new Exception("Camera not initialized");
|
|
2008
|
+
}
|
|
2009
|
+
ExposureState state = camera.getCameraInfo().getExposureState();
|
|
2010
|
+
int idx = state.getExposureCompensationIndex();
|
|
2011
|
+
Rational step = state.getExposureCompensationStep();
|
|
2012
|
+
float evStep = step != null
|
|
2013
|
+
? (float) step.getNumerator() / (float) step.getDenominator()
|
|
2014
|
+
: 1.0f;
|
|
2015
|
+
return idx * evStep;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
public void setExposureCompensation(float ev) throws Exception {
|
|
2019
|
+
if (camera == null) {
|
|
2020
|
+
throw new Exception("Camera not initialized");
|
|
2021
|
+
}
|
|
2022
|
+
ExposureState state = camera.getCameraInfo().getExposureState();
|
|
2023
|
+
Range<Integer> idxRange = state.getExposureCompensationRange();
|
|
2024
|
+
Rational step = state.getExposureCompensationStep();
|
|
2025
|
+
float evStep = step != null
|
|
2026
|
+
? (float) step.getNumerator() / (float) step.getDenominator()
|
|
2027
|
+
: 1.0f;
|
|
2028
|
+
if (evStep <= 0f) evStep = 1.0f;
|
|
2029
|
+
int idx = Math.round(ev / evStep);
|
|
2030
|
+
// clamp
|
|
2031
|
+
if (idx < idxRange.getLower()) idx = idxRange.getLower();
|
|
2032
|
+
if (idx > idxRange.getUpper()) idx = idxRange.getUpper();
|
|
2033
|
+
camera.getCameraControl().setExposureCompensationIndex(idx);
|
|
2034
|
+
}
|
|
2035
|
+
|
|
1881
2036
|
private void showFocusIndicator(float x, float y) {
|
|
1882
2037
|
if (disableFocusIndicator || sessionConfig.getDisableFocusIndicator()) {
|
|
1883
2038
|
return;
|
|
@@ -3576,4 +3731,103 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
3576
3731
|
Log.e(TAG, "triggerAutoFocus: Failed to trigger autofocus", e);
|
|
3577
3732
|
}
|
|
3578
3733
|
}
|
|
3734
|
+
|
|
3735
|
+
public void startRecordVideo() throws Exception {
|
|
3736
|
+
if (videoCapture == null) {
|
|
3737
|
+
throw new Exception("VideoCapture is not initialized");
|
|
3738
|
+
}
|
|
3739
|
+
|
|
3740
|
+
if (currentRecording != null) {
|
|
3741
|
+
throw new Exception("Video recording is already in progress");
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
// Create output file
|
|
3745
|
+
String fileName = "video_" + System.currentTimeMillis() + ".mp4";
|
|
3746
|
+
File outputDir = new File(
|
|
3747
|
+
context.getExternalFilesDir(Environment.DIRECTORY_MOVIES),
|
|
3748
|
+
"CameraPreview"
|
|
3749
|
+
);
|
|
3750
|
+
if (!outputDir.exists()) {
|
|
3751
|
+
outputDir.mkdirs();
|
|
3752
|
+
}
|
|
3753
|
+
currentVideoFile = new File(outputDir, fileName);
|
|
3754
|
+
|
|
3755
|
+
FileOutputOptions outputOptions = new FileOutputOptions.Builder(
|
|
3756
|
+
currentVideoFile
|
|
3757
|
+
).build();
|
|
3758
|
+
|
|
3759
|
+
// Create recording event listener
|
|
3760
|
+
androidx.core.util.Consumer<VideoRecordEvent> videoRecordEventListener =
|
|
3761
|
+
videoRecordEvent -> {
|
|
3762
|
+
if (videoRecordEvent instanceof VideoRecordEvent.Start) {
|
|
3763
|
+
Log.d(TAG, "Video recording started");
|
|
3764
|
+
} else if (videoRecordEvent instanceof VideoRecordEvent.Finalize) {
|
|
3765
|
+
VideoRecordEvent.Finalize finalizeEvent =
|
|
3766
|
+
(VideoRecordEvent.Finalize) videoRecordEvent;
|
|
3767
|
+
handleRecordingFinalized(finalizeEvent);
|
|
3768
|
+
}
|
|
3769
|
+
};
|
|
3770
|
+
|
|
3771
|
+
// Start recording
|
|
3772
|
+
if (sessionConfig != null && !sessionConfig.isDisableAudio()) {
|
|
3773
|
+
currentRecording = videoCapture
|
|
3774
|
+
.getOutput()
|
|
3775
|
+
.prepareRecording(context, outputOptions)
|
|
3776
|
+
.withAudioEnabled()
|
|
3777
|
+
.start(
|
|
3778
|
+
ContextCompat.getMainExecutor(context),
|
|
3779
|
+
videoRecordEventListener
|
|
3780
|
+
);
|
|
3781
|
+
} else {
|
|
3782
|
+
currentRecording = videoCapture
|
|
3783
|
+
.getOutput()
|
|
3784
|
+
.prepareRecording(context, outputOptions)
|
|
3785
|
+
.start(
|
|
3786
|
+
ContextCompat.getMainExecutor(context),
|
|
3787
|
+
videoRecordEventListener
|
|
3788
|
+
);
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
Log.d(
|
|
3792
|
+
TAG,
|
|
3793
|
+
"Video recording started to: " + currentVideoFile.getAbsolutePath()
|
|
3794
|
+
);
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3797
|
+
public void stopRecordVideo(VideoRecordingCallback callback) {
|
|
3798
|
+
if (currentRecording == null) {
|
|
3799
|
+
callback.onError("No video recording in progress");
|
|
3800
|
+
return;
|
|
3801
|
+
}
|
|
3802
|
+
|
|
3803
|
+
// Store the callback to use when recording is finalized
|
|
3804
|
+
currentVideoCallback = callback;
|
|
3805
|
+
currentRecording.stop();
|
|
3806
|
+
|
|
3807
|
+
Log.d(TAG, "Video recording stop requested");
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3810
|
+
private void handleRecordingFinalized(
|
|
3811
|
+
VideoRecordEvent.Finalize finalizeEvent
|
|
3812
|
+
) {
|
|
3813
|
+
if (!finalizeEvent.hasError()) {
|
|
3814
|
+
Log.d(TAG, "Video recording completed successfully");
|
|
3815
|
+
if (currentVideoCallback != null) {
|
|
3816
|
+
String filePath = "file://" + currentVideoFile.getAbsolutePath();
|
|
3817
|
+
currentVideoCallback.onSuccess(filePath);
|
|
3818
|
+
}
|
|
3819
|
+
} else {
|
|
3820
|
+
Log.e(TAG, "Video recording failed: " + finalizeEvent.getError());
|
|
3821
|
+
if (currentVideoCallback != null) {
|
|
3822
|
+
currentVideoCallback.onError(
|
|
3823
|
+
"Video recording failed: " + finalizeEvent.getError()
|
|
3824
|
+
);
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
|
|
3828
|
+
// Clean up
|
|
3829
|
+
currentRecording = null;
|
|
3830
|
+
currentVideoFile = null;
|
|
3831
|
+
currentVideoCallback = null;
|
|
3832
|
+
}
|
|
3579
3833
|
}
|
package/dist/docs.json
CHANGED
|
@@ -882,6 +882,114 @@
|
|
|
882
882
|
"DeviceOrientation"
|
|
883
883
|
],
|
|
884
884
|
"slug": "getorientation"
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
"name": "getExposureModes",
|
|
888
|
+
"signature": "() => Promise<{ modes: ExposureMode[]; }>",
|
|
889
|
+
"parameters": [],
|
|
890
|
+
"returns": "Promise<{ modes: ExposureMode[]; }>",
|
|
891
|
+
"tags": [
|
|
892
|
+
{
|
|
893
|
+
"name": "platform",
|
|
894
|
+
"text": "android, ios"
|
|
895
|
+
}
|
|
896
|
+
],
|
|
897
|
+
"docs": "Returns the exposure modes supported by the active camera.\nModes can include: 'locked', 'auto', 'continuous', 'custom'.",
|
|
898
|
+
"complexTypes": [
|
|
899
|
+
"ExposureMode"
|
|
900
|
+
],
|
|
901
|
+
"slug": "getexposuremodes"
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
"name": "getExposureMode",
|
|
905
|
+
"signature": "() => Promise<{ mode: ExposureMode; }>",
|
|
906
|
+
"parameters": [],
|
|
907
|
+
"returns": "Promise<{ mode: ExposureMode; }>",
|
|
908
|
+
"tags": [
|
|
909
|
+
{
|
|
910
|
+
"name": "platform",
|
|
911
|
+
"text": "android, ios"
|
|
912
|
+
}
|
|
913
|
+
],
|
|
914
|
+
"docs": "Returns the current exposure mode.",
|
|
915
|
+
"complexTypes": [
|
|
916
|
+
"ExposureMode"
|
|
917
|
+
],
|
|
918
|
+
"slug": "getexposuremode"
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
"name": "setExposureMode",
|
|
922
|
+
"signature": "(options: { mode: ExposureMode; }) => Promise<void>",
|
|
923
|
+
"parameters": [
|
|
924
|
+
{
|
|
925
|
+
"name": "options",
|
|
926
|
+
"docs": "",
|
|
927
|
+
"type": "{ mode: ExposureMode; }"
|
|
928
|
+
}
|
|
929
|
+
],
|
|
930
|
+
"returns": "Promise<void>",
|
|
931
|
+
"tags": [
|
|
932
|
+
{
|
|
933
|
+
"name": "platform",
|
|
934
|
+
"text": "android, ios"
|
|
935
|
+
}
|
|
936
|
+
],
|
|
937
|
+
"docs": "Sets the exposure mode.",
|
|
938
|
+
"complexTypes": [
|
|
939
|
+
"ExposureMode"
|
|
940
|
+
],
|
|
941
|
+
"slug": "setexposuremode"
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
"name": "getExposureCompensationRange",
|
|
945
|
+
"signature": "() => Promise<{ min: number; max: number; step: number; }>",
|
|
946
|
+
"parameters": [],
|
|
947
|
+
"returns": "Promise<{ min: number; max: number; step: number; }>",
|
|
948
|
+
"tags": [
|
|
949
|
+
{
|
|
950
|
+
"name": "platform",
|
|
951
|
+
"text": "ios"
|
|
952
|
+
}
|
|
953
|
+
],
|
|
954
|
+
"docs": "Returns the exposure compensation (EV bias) supported range.",
|
|
955
|
+
"complexTypes": [],
|
|
956
|
+
"slug": "getexposurecompensationrange"
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
"name": "getExposureCompensation",
|
|
960
|
+
"signature": "() => Promise<{ value: number; }>",
|
|
961
|
+
"parameters": [],
|
|
962
|
+
"returns": "Promise<{ value: number; }>",
|
|
963
|
+
"tags": [
|
|
964
|
+
{
|
|
965
|
+
"name": "platform",
|
|
966
|
+
"text": "ios"
|
|
967
|
+
}
|
|
968
|
+
],
|
|
969
|
+
"docs": "Returns the current exposure compensation (EV bias).",
|
|
970
|
+
"complexTypes": [],
|
|
971
|
+
"slug": "getexposurecompensation"
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
"name": "setExposureCompensation",
|
|
975
|
+
"signature": "(options: { value: number; }) => Promise<void>",
|
|
976
|
+
"parameters": [
|
|
977
|
+
{
|
|
978
|
+
"name": "options",
|
|
979
|
+
"docs": "",
|
|
980
|
+
"type": "{ value: number; }"
|
|
981
|
+
}
|
|
982
|
+
],
|
|
983
|
+
"returns": "Promise<void>",
|
|
984
|
+
"tags": [
|
|
985
|
+
{
|
|
986
|
+
"name": "platform",
|
|
987
|
+
"text": "ios"
|
|
988
|
+
}
|
|
989
|
+
],
|
|
990
|
+
"docs": "Sets the exposure compensation (EV bias). Value will be clamped to range.",
|
|
991
|
+
"complexTypes": [],
|
|
992
|
+
"slug": "setexposurecompensation"
|
|
885
993
|
}
|
|
886
994
|
],
|
|
887
995
|
"properties": []
|
|
@@ -1804,6 +1912,29 @@
|
|
|
1804
1912
|
"complexTypes": []
|
|
1805
1913
|
}
|
|
1806
1914
|
]
|
|
1915
|
+
},
|
|
1916
|
+
{
|
|
1917
|
+
"name": "ExposureMode",
|
|
1918
|
+
"slug": "exposuremode",
|
|
1919
|
+
"docs": "Reusable exposure mode type for cross-platform support.",
|
|
1920
|
+
"types": [
|
|
1921
|
+
{
|
|
1922
|
+
"text": "\"AUTO\"",
|
|
1923
|
+
"complexTypes": []
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
"text": "\"LOCK\"",
|
|
1927
|
+
"complexTypes": []
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
"text": "\"CONTINUOUS\"",
|
|
1931
|
+
"complexTypes": []
|
|
1932
|
+
},
|
|
1933
|
+
{
|
|
1934
|
+
"text": "\"CUSTOM\"",
|
|
1935
|
+
"complexTypes": []
|
|
1936
|
+
}
|
|
1937
|
+
]
|
|
1807
1938
|
}
|
|
1808
1939
|
],
|
|
1809
1940
|
"pluginConfigs": []
|
|
@@ -278,6 +278,8 @@ export interface CameraSampleOptions {
|
|
|
278
278
|
* 'torch' is a continuous light mode.
|
|
279
279
|
*/
|
|
280
280
|
export type CameraPreviewFlashMode = "off" | "on" | "auto" | "torch";
|
|
281
|
+
/** Reusable exposure mode type for cross-platform support. */
|
|
282
|
+
export type ExposureMode = "AUTO" | "LOCK" | "CONTINUOUS" | "CUSTOM";
|
|
281
283
|
/**
|
|
282
284
|
* Defines the options for setting the camera preview's opacity.
|
|
283
285
|
*/
|
|
@@ -678,4 +680,49 @@ export interface CameraPreviewPlugin {
|
|
|
678
680
|
getOrientation(): Promise<{
|
|
679
681
|
orientation: DeviceOrientation;
|
|
680
682
|
}>;
|
|
683
|
+
/**
|
|
684
|
+
* Returns the exposure modes supported by the active camera.
|
|
685
|
+
* Modes can include: 'locked', 'auto', 'continuous', 'custom'.
|
|
686
|
+
* @platform android, ios
|
|
687
|
+
*/
|
|
688
|
+
getExposureModes(): Promise<{
|
|
689
|
+
modes: ExposureMode[];
|
|
690
|
+
}>;
|
|
691
|
+
/**
|
|
692
|
+
* Returns the current exposure mode.
|
|
693
|
+
* @platform android, ios
|
|
694
|
+
*/
|
|
695
|
+
getExposureMode(): Promise<{
|
|
696
|
+
mode: ExposureMode;
|
|
697
|
+
}>;
|
|
698
|
+
/**
|
|
699
|
+
* Sets the exposure mode.
|
|
700
|
+
* @platform android, ios
|
|
701
|
+
*/
|
|
702
|
+
setExposureMode(options: {
|
|
703
|
+
mode: ExposureMode;
|
|
704
|
+
}): Promise<void>;
|
|
705
|
+
/**
|
|
706
|
+
* Returns the exposure compensation (EV bias) supported range.
|
|
707
|
+
* @platform ios
|
|
708
|
+
*/
|
|
709
|
+
getExposureCompensationRange(): Promise<{
|
|
710
|
+
min: number;
|
|
711
|
+
max: number;
|
|
712
|
+
step: number;
|
|
713
|
+
}>;
|
|
714
|
+
/**
|
|
715
|
+
* Returns the current exposure compensation (EV bias).
|
|
716
|
+
* @platform ios
|
|
717
|
+
*/
|
|
718
|
+
getExposureCompensation(): Promise<{
|
|
719
|
+
value: number;
|
|
720
|
+
}>;
|
|
721
|
+
/**
|
|
722
|
+
* Sets the exposure compensation (EV bias). Value will be clamped to range.
|
|
723
|
+
* @platform ios
|
|
724
|
+
*/
|
|
725
|
+
setExposureCompensation(options: {
|
|
726
|
+
value: number;
|
|
727
|
+
}): Promise<void>;
|
|
681
728
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,sCAAwB,CAAA;IACxB,sCAAwB,CAAA;IACxB,qCAAuB,CAAA;IACvB,sCAAwB,CAAA;IACxB,2BAAa,CAAA;IACb,oCAAsB,CAAA;IACtB,+BAAiB,CAAA;AACnB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport type CameraPosition = \"rear\" | \"front\";\n\nexport type FlashMode = CameraPreviewFlashMode;\n\nexport type GridMode = \"none\" | \"3x3\" | \"4x4\";\n\nexport type CameraPositioning = \"center\" | \"top\" | \"bottom\";\n\nexport enum DeviceType {\n ULTRA_WIDE = \"ultraWide\",\n WIDE_ANGLE = \"wideAngle\",\n TELEPHOTO = \"telephoto\",\n TRUE_DEPTH = \"trueDepth\",\n DUAL = \"dual\",\n DUAL_WIDE = \"dualWide\",\n TRIPLE = \"triple\",\n}\n\n/**\n * Represents a single camera lens on a device. A {@link CameraDevice} can have multiple lenses.\n */\nexport interface CameraLens {\n /** A human-readable name for the lens, e.g., \"Ultra-Wide\". */\n label: string;\n /** The type of the camera lens. */\n deviceType: DeviceType;\n /** The focal length of the lens in millimeters. */\n focalLength: number;\n /** The base zoom factor for this lens (e.g., 0.5 for ultra-wide, 1.0 for wide). */\n baseZoomRatio: number;\n /** The minimum zoom factor supported by this specific lens. */\n minZoom: number;\n /** The maximum zoom factor supported by this specific lens. */\n maxZoom: number;\n}\n\n/**\n * Represents a physical camera on the device (e.g., the front-facing camera).\n */\nexport interface CameraDevice {\n /** A unique identifier for the camera device. */\n deviceId: string;\n /** A human-readable name for the camera device. */\n label: string;\n /** The physical position of the camera on the device. */\n position: CameraPosition;\n /** A list of all available lenses for this camera device. */\n lenses: CameraLens[];\n /** The overall minimum zoom factor available across all lenses on this device. */\n minZoom: number;\n /** The overall maximum zoom factor available across all lenses on this device. */\n maxZoom: number;\n /** Identifies whether the device is a logical camera (composed of multiple physical lenses). */\n isLogical: boolean;\n}\n\n/**\n * Represents the detailed information of the currently active lens.\n */\nexport interface LensInfo {\n /** The focal length of the active lens in millimeters. */\n focalLength: number;\n /** The device type of the active lens. */\n deviceType: DeviceType;\n /** The base zoom ratio of the active lens (e.g., 0.5x, 1.0x). */\n baseZoomRatio: number;\n /** The current digital zoom factor applied on top of the base zoom. */\n digitalZoom: number;\n}\n\n/**\n * Defines the configuration options for starting the camera preview.\n */\nexport interface CameraPreviewOptions {\n /**\n * The parent element to attach the video preview to.\n * @platform web\n */\n parent?: string;\n /**\n * A CSS class name to add to the preview element.\n * @platform web\n */\n className?: string;\n /**\n * The width of the preview in pixels. Defaults to the screen width.\n * @platform android, ios, web\n */\n width?: number;\n /**\n * The height of the preview in pixels. Defaults to the screen height.\n * @platform android, ios, web\n */\n height?: number;\n /**\n * The horizontal origin of the preview, in pixels.\n * @platform android, ios\n */\n x?: number;\n /**\n * The vertical origin of the preview, in pixels.\n * @platform android, ios\n */\n y?: number;\n /**\n * The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\n * Cannot be set if width or height is provided, otherwise the call will be rejected.\n * Use setPreviewSize to adjust size after starting.\n *\n * @since 2.0.0\n */\n aspectRatio?: \"4:3\" | \"16:9\";\n /**\n * The grid overlay to display on the camera preview.\n * @default \"none\"\n * @since 2.1.0\n */\n gridMode?: GridMode;\n /**\n * Adjusts the y-position to account for safe areas (e.g., notches).\n * @platform ios\n * @default false\n */\n includeSafeAreaInsets?: boolean;\n /**\n * If true, places the preview behind the webview.\n * @platform android\n * @default true\n */\n toBack?: boolean;\n /**\n * Bottom padding for the preview, in pixels.\n * @platform android, ios\n */\n paddingBottom?: number;\n /**\n * Whether to rotate the preview when the device orientation changes.\n * @platform ios\n * @default true\n */\n rotateWhenOrientationChanged?: boolean;\n /**\n * The camera to use.\n * @default \"rear\"\n */\n position?: CameraPosition | string;\n /**\n * If true, saves the captured image to a file and returns the file path.\n * If false, returns a base64 encoded string.\n * @default false\n */\n storeToFile?: boolean;\n /**\n * If true, prevents the plugin from rotating the image based on EXIF data.\n * @platform android\n * @default false\n */\n disableExifHeaderStripping?: boolean;\n /**\n * If true, disables the audio stream, preventing audio permission requests.\n * @default true\n */\n disableAudio?: boolean;\n /**\n * If true, locks the device orientation while the camera is active.\n * @platform android\n * @default false\n */\n lockAndroidOrientation?: boolean;\n /**\n * If true, allows the camera preview's opacity to be changed.\n * @platform android, web\n * @default false\n */\n enableOpacity?: boolean;\n /**\n * If true, enables pinch-to-zoom functionality on the preview.\n * @platform android\n * @default false\n */\n enableZoom?: boolean;\n\n /**\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 * If true, uses the video-optimized preset for the camera session.\n * @platform ios\n * @default false\n */\n enableVideoMode?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n /**\n * The initial zoom level when starting the camera preview.\n * If the requested zoom level is not available, the native plugin will reject.\n * @default 1.0\n * @platform android, ios\n * @since 2.2.0\n */\n initialZoomLevel?: number;\n /**\n * The vertical positioning of the camera preview.\n * @default \"center\"\n * @platform android, ios, web\n * @since 2.3.0\n */\n positioning?: CameraPositioning;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /**\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\n/** Represents EXIF data extracted from an image. */\nexport interface ExifData {\n [key: string]: any;\n}\n\nexport type PictureFormat = \"jpeg\" | \"png\";\n\n/** Defines a standard picture size with width and height. */\nexport interface PictureSize {\n /** The width of the picture in pixels. */\n width: number;\n /** The height of the picture in pixels. */\n height: number;\n}\n\n/** Represents the supported picture sizes for a camera facing a certain direction. */\nexport interface SupportedPictureSizes {\n /** The camera direction (\"front\" or \"rear\"). */\n facing: string;\n /** A list of supported picture sizes for this camera. */\n supportedPictureSizes: PictureSize[];\n}\n\n/**\n * Defines the options for capturing a sample frame from the camera preview.\n */\nexport interface CameraSampleOptions {\n /**\n * The quality of the captured sample, from 0 to 100.\n * @default 85\n */\n quality?: number;\n}\n\n/**\n * The available flash modes for the camera.\n * 'torch' is a continuous light mode.\n */\nexport type CameraPreviewFlashMode = \"off\" | \"on\" | \"auto\" | \"torch\";\n\n/**\n * Defines the options for setting the camera preview's opacity.\n */\nexport interface CameraOpacityOptions {\n /**\n * The opacity percentage, from 0.0 (fully transparent) to 1.0 (fully opaque).\n * @default 1.0\n */\n opacity?: number;\n}\n\n/**\n * 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 =\n | \"portrait\"\n | \"landscape\"\n | \"landscape-left\"\n | \"landscape-right\"\n | \"portrait-upside-down\"\n | \"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 * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * 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(\n options: CameraPreviewPictureOptions,\n ): Promise<{ value: string; exif: ExifData }>;\n\n /**\n * Captures a single frame from the camera preview stream.\n *\n * @param {CameraSampleOptions} options - The options for capturing the sample.\n * @returns {Promise<{ value: string }>} A promise that resolves with the sample image as a base64 encoded string.\n * @since 0.0.1\n */\n captureSample(options: CameraSampleOptions): Promise<{ value: string }>;\n\n /**\n * Gets the flash modes supported by the active camera.\n *\n * @returns {Promise<{ result: CameraPreviewFlashMode[] }>} A promise that resolves with an array of supported flash modes.\n * @since 0.0.1\n */\n getSupportedFlashModes(): Promise<{\n result: CameraPreviewFlashMode[];\n }>;\n\n /**\n * Set the aspect ratio of the camera preview.\n *\n * @param {{ aspectRatio: '4:3' | '16:9'; x?: number; y?: number }} options - The desired aspect ratio and optional position.\n * - aspectRatio: The desired aspect ratio ('4:3' or '16:9')\n * - x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.\n * - y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.\n * @since 7.5.0\n * @platform android, ios\n */\n setAspectRatio(options: {\n aspectRatio: \"4:3\" | \"16:9\";\n x?: number;\n y?: number;\n }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n\n /**\n * Gets the current aspect ratio of the camera preview.\n *\n * @returns {Promise<{ aspectRatio: '4:3' | '16:9' }>} A promise that resolves with the current aspect ratio.\n * @since 7.5.0\n * @platform android, ios\n */\n getAspectRatio(): Promise<{ aspectRatio: \"4:3\" | \"16:9\" }>;\n\n /**\n * Sets the grid mode of the camera preview overlay.\n *\n * @param {{ gridMode: GridMode }} options - The desired grid mode ('none', '3x3', or '4x4').\n * @returns {Promise<void>} A promise that resolves when the grid mode is set.\n * @since 8.0.0\n */\n setGridMode(options: { gridMode: GridMode }): Promise<void>;\n\n /**\n * Gets the current grid mode of the camera preview overlay.\n *\n * @returns {Promise<{ gridMode: GridMode }>} A promise that resolves with the current grid mode.\n * @since 8.0.0\n */\n getGridMode(): Promise<{ gridMode: GridMode }>;\n\n /**\n * Gets the horizontal field of view (FoV) for the active camera.\n * Note: This can be an estimate on some devices.\n *\n * @returns {Promise<{ result: number }>} A promise that resolves with the horizontal field of view in degrees.\n * @since 0.0.1\n */\n getHorizontalFov(): Promise<{\n result: number;\n }>;\n\n /**\n * Gets the supported picture sizes for all cameras.\n *\n * @returns {Promise<{ supportedPictureSizes: SupportedPictureSizes[] }>} A promise that resolves with the list of supported sizes.\n * @since 7.4.0\n */\n getSupportedPictureSizes(): Promise<{\n supportedPictureSizes: SupportedPictureSizes[];\n }>;\n\n /**\n * Sets the flash mode for the active camera.\n *\n * @param {{ flashMode: CameraPreviewFlashMode | string }} options - The desired flash mode.\n * @returns {Promise<void>} A promise that resolves when the flash mode is set.\n * @since 0.0.1\n */\n setFlashMode(options: {\n flashMode: CameraPreviewFlashMode | string;\n }): Promise<void>;\n\n /**\n * Toggles between the front and rear cameras.\n *\n * @returns {Promise<void>} A promise that resolves when the camera is flipped.\n * @since 0.0.1\n */\n flip(): Promise<void>;\n\n /**\n * Sets the opacity of the camera preview.\n *\n * @param {CameraOpacityOptions} options - The opacity options.\n * @returns {Promise<void>} A promise that resolves when the opacity is set.\n * @since 0.0.1\n */\n setOpacity(options: CameraOpacityOptions): Promise<void>;\n\n /**\n * Stops an ongoing video recording.\n *\n * @returns {Promise<{ videoFilePath: string }>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<{ videoFilePath: string }>;\n\n /**\n * Starts recording a video.\n *\n * @param {CameraPreviewOptions} options - The options for video recording. Only iOS.\n * @returns {Promise<void>} A promise that resolves when video recording starts.\n * @since 0.0.1\n */\n startRecordVideo(options: CameraPreviewOptions): Promise<void>;\n\n /**\n * Checks if the camera preview is currently running.\n *\n * @returns {Promise<{ isRunning: boolean }>} A promise that resolves with the running state.\n * @since 7.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: {\n level: number;\n ramp?: boolean;\n autoFocus?: boolean;\n }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.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 currently active camera device.\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: {\n x?: number;\n y?: number;\n width: number;\n height: number;\n }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n\n /**\n * Sets the camera focus to a specific point in the preview.\n *\n * @param {Object} options - The focus options.\n * @param {number} options.x - The x coordinate in the preview view to focus on (0-1 normalized).\n * @param {number} options.y - The y coordinate in the preview view to focus on (0-1 normalized).\n * @returns {Promise<void>} A promise that resolves when the focus is set.\n * @since 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: {\n width: number;\n height: number;\n x: number;\n y: number;\n }) => 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 * 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"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,sCAAwB,CAAA;IACxB,sCAAwB,CAAA;IACxB,qCAAuB,CAAA;IACvB,sCAAwB,CAAA;IACxB,2BAAa,CAAA;IACb,oCAAsB,CAAA;IACtB,+BAAiB,CAAA;AACnB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport type CameraPosition = \"rear\" | \"front\";\n\nexport type FlashMode = CameraPreviewFlashMode;\n\nexport type GridMode = \"none\" | \"3x3\" | \"4x4\";\n\nexport type CameraPositioning = \"center\" | \"top\" | \"bottom\";\n\nexport enum DeviceType {\n ULTRA_WIDE = \"ultraWide\",\n WIDE_ANGLE = \"wideAngle\",\n TELEPHOTO = \"telephoto\",\n TRUE_DEPTH = \"trueDepth\",\n DUAL = \"dual\",\n DUAL_WIDE = \"dualWide\",\n TRIPLE = \"triple\",\n}\n\n/**\n * Represents a single camera lens on a device. A {@link CameraDevice} can have multiple lenses.\n */\nexport interface CameraLens {\n /** A human-readable name for the lens, e.g., \"Ultra-Wide\". */\n label: string;\n /** The type of the camera lens. */\n deviceType: DeviceType;\n /** The focal length of the lens in millimeters. */\n focalLength: number;\n /** The base zoom factor for this lens (e.g., 0.5 for ultra-wide, 1.0 for wide). */\n baseZoomRatio: number;\n /** The minimum zoom factor supported by this specific lens. */\n minZoom: number;\n /** The maximum zoom factor supported by this specific lens. */\n maxZoom: number;\n}\n\n/**\n * Represents a physical camera on the device (e.g., the front-facing camera).\n */\nexport interface CameraDevice {\n /** A unique identifier for the camera device. */\n deviceId: string;\n /** A human-readable name for the camera device. */\n label: string;\n /** The physical position of the camera on the device. */\n position: CameraPosition;\n /** A list of all available lenses for this camera device. */\n lenses: CameraLens[];\n /** The overall minimum zoom factor available across all lenses on this device. */\n minZoom: number;\n /** The overall maximum zoom factor available across all lenses on this device. */\n maxZoom: number;\n /** Identifies whether the device is a logical camera (composed of multiple physical lenses). */\n isLogical: boolean;\n}\n\n/**\n * Represents the detailed information of the currently active lens.\n */\nexport interface LensInfo {\n /** The focal length of the active lens in millimeters. */\n focalLength: number;\n /** The device type of the active lens. */\n deviceType: DeviceType;\n /** The base zoom ratio of the active lens (e.g., 0.5x, 1.0x). */\n baseZoomRatio: number;\n /** The current digital zoom factor applied on top of the base zoom. */\n digitalZoom: number;\n}\n\n/**\n * Defines the configuration options for starting the camera preview.\n */\nexport interface CameraPreviewOptions {\n /**\n * The parent element to attach the video preview to.\n * @platform web\n */\n parent?: string;\n /**\n * A CSS class name to add to the preview element.\n * @platform web\n */\n className?: string;\n /**\n * The width of the preview in pixels. Defaults to the screen width.\n * @platform android, ios, web\n */\n width?: number;\n /**\n * The height of the preview in pixels. Defaults to the screen height.\n * @platform android, ios, web\n */\n height?: number;\n /**\n * The horizontal origin of the preview, in pixels.\n * @platform android, ios\n */\n x?: number;\n /**\n * The vertical origin of the preview, in pixels.\n * @platform android, ios\n */\n y?: number;\n /**\n * The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\n * Cannot be set if width or height is provided, otherwise the call will be rejected.\n * Use setPreviewSize to adjust size after starting.\n *\n * @since 2.0.0\n */\n aspectRatio?: \"4:3\" | \"16:9\";\n /**\n * The grid overlay to display on the camera preview.\n * @default \"none\"\n * @since 2.1.0\n */\n gridMode?: GridMode;\n /**\n * Adjusts the y-position to account for safe areas (e.g., notches).\n * @platform ios\n * @default false\n */\n includeSafeAreaInsets?: boolean;\n /**\n * If true, places the preview behind the webview.\n * @platform android\n * @default true\n */\n toBack?: boolean;\n /**\n * Bottom padding for the preview, in pixels.\n * @platform android, ios\n */\n paddingBottom?: number;\n /**\n * Whether to rotate the preview when the device orientation changes.\n * @platform ios\n * @default true\n */\n rotateWhenOrientationChanged?: boolean;\n /**\n * The camera to use.\n * @default \"rear\"\n */\n position?: CameraPosition | string;\n /**\n * If true, saves the captured image to a file and returns the file path.\n * If false, returns a base64 encoded string.\n * @default false\n */\n storeToFile?: boolean;\n /**\n * If true, prevents the plugin from rotating the image based on EXIF data.\n * @platform android\n * @default false\n */\n disableExifHeaderStripping?: boolean;\n /**\n * If true, disables the audio stream, preventing audio permission requests.\n * @default true\n */\n disableAudio?: boolean;\n /**\n * If true, locks the device orientation while the camera is active.\n * @platform android\n * @default false\n */\n lockAndroidOrientation?: boolean;\n /**\n * If true, allows the camera preview's opacity to be changed.\n * @platform android, web\n * @default false\n */\n enableOpacity?: boolean;\n /**\n * If true, enables pinch-to-zoom functionality on the preview.\n * @platform android\n * @default false\n */\n enableZoom?: boolean;\n\n /**\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 * If true, uses the video-optimized preset for the camera session.\n * @platform ios\n * @default false\n */\n enableVideoMode?: boolean;\n /**\n * The `deviceId` of the camera to use. If provided, `position` is ignored.\n * @platform ios\n */\n deviceId?: string;\n /**\n * The initial zoom level when starting the camera preview.\n * If the requested zoom level is not available, the native plugin will reject.\n * @default 1.0\n * @platform android, ios\n * @since 2.2.0\n */\n initialZoomLevel?: number;\n /**\n * The vertical positioning of the camera preview.\n * @default \"center\"\n * @platform android, ios, web\n * @since 2.3.0\n */\n positioning?: CameraPositioning;\n}\n\n/**\n * Defines the options for capturing a picture.\n */\nexport interface CameraPreviewPictureOptions {\n /**\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\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 =\n | \"portrait\"\n | \"landscape\"\n | \"landscape-left\"\n | \"landscape-right\"\n | \"portrait-upside-down\"\n | \"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 * @returns {Promise<void>} A promise that resolves when the camera preview is stopped.\n * @since 0.0.1\n */\n stop(): Promise<void>;\n\n /**\n * Captures a picture from the camera.\n *\n * 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(\n options: CameraPreviewPictureOptions,\n ): Promise<{ value: string; exif: ExifData }>;\n\n /**\n * Captures a single frame from the camera preview stream.\n *\n * @param {CameraSampleOptions} options - The options for capturing the sample.\n * @returns {Promise<{ value: string }>} A promise that resolves with the sample image as a base64 encoded string.\n * @since 0.0.1\n */\n captureSample(options: CameraSampleOptions): Promise<{ value: string }>;\n\n /**\n * Gets the flash modes supported by the active camera.\n *\n * @returns {Promise<{ result: CameraPreviewFlashMode[] }>} A promise that resolves with an array of supported flash modes.\n * @since 0.0.1\n */\n getSupportedFlashModes(): Promise<{\n result: CameraPreviewFlashMode[];\n }>;\n\n /**\n * Set the aspect ratio of the camera preview.\n *\n * @param {{ aspectRatio: '4:3' | '16:9'; x?: number; y?: number }} options - The desired aspect ratio and optional position.\n * - aspectRatio: The desired aspect ratio ('4:3' or '16:9')\n * - x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.\n * - y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.\n * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.\n * @since 7.5.0\n * @platform android, ios\n */\n setAspectRatio(options: {\n aspectRatio: \"4:3\" | \"16:9\";\n x?: number;\n y?: number;\n }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n\n /**\n * Gets the current aspect ratio of the camera preview.\n *\n * @returns {Promise<{ aspectRatio: '4:3' | '16:9' }>} A promise that resolves with the current aspect ratio.\n * @since 7.5.0\n * @platform android, ios\n */\n getAspectRatio(): Promise<{ aspectRatio: \"4:3\" | \"16:9\" }>;\n\n /**\n * Sets the grid mode of the camera preview overlay.\n *\n * @param {{ gridMode: GridMode }} options - The desired grid mode ('none', '3x3', or '4x4').\n * @returns {Promise<void>} A promise that resolves when the grid mode is set.\n * @since 8.0.0\n */\n setGridMode(options: { gridMode: GridMode }): Promise<void>;\n\n /**\n * Gets the current grid mode of the camera preview overlay.\n *\n * @returns {Promise<{ gridMode: GridMode }>} A promise that resolves with the current grid mode.\n * @since 8.0.0\n */\n getGridMode(): Promise<{ gridMode: GridMode }>;\n\n /**\n * Gets the horizontal field of view (FoV) for the active camera.\n * Note: This can be an estimate on some devices.\n *\n * @returns {Promise<{ result: number }>} A promise that resolves with the horizontal field of view in degrees.\n * @since 0.0.1\n */\n getHorizontalFov(): Promise<{\n result: number;\n }>;\n\n /**\n * Gets the supported picture sizes for all cameras.\n *\n * @returns {Promise<{ supportedPictureSizes: SupportedPictureSizes[] }>} A promise that resolves with the list of supported sizes.\n * @since 7.4.0\n */\n getSupportedPictureSizes(): Promise<{\n supportedPictureSizes: SupportedPictureSizes[];\n }>;\n\n /**\n * Sets the flash mode for the active camera.\n *\n * @param {{ flashMode: CameraPreviewFlashMode | string }} options - The desired flash mode.\n * @returns {Promise<void>} A promise that resolves when the flash mode is set.\n * @since 0.0.1\n */\n setFlashMode(options: {\n flashMode: CameraPreviewFlashMode | string;\n }): Promise<void>;\n\n /**\n * Toggles between the front and rear cameras.\n *\n * @returns {Promise<void>} A promise that resolves when the camera is flipped.\n * @since 0.0.1\n */\n flip(): Promise<void>;\n\n /**\n * Sets the opacity of the camera preview.\n *\n * @param {CameraOpacityOptions} options - The opacity options.\n * @returns {Promise<void>} A promise that resolves when the opacity is set.\n * @since 0.0.1\n */\n setOpacity(options: CameraOpacityOptions): Promise<void>;\n\n /**\n * Stops an ongoing video recording.\n *\n * @returns {Promise<{ videoFilePath: string }>} A promise that resolves with the path to the recorded video file.\n * @since 0.0.1\n */\n stopRecordVideo(): Promise<{ videoFilePath: string }>;\n\n /**\n * Starts recording a video.\n *\n * @param {CameraPreviewOptions} options - The options for video recording. Only iOS.\n * @returns {Promise<void>} A promise that resolves when video recording starts.\n * @since 0.0.1\n */\n startRecordVideo(options: CameraPreviewOptions): Promise<void>;\n\n /**\n * Checks if the camera preview is currently running.\n *\n * @returns {Promise<{ isRunning: boolean }>} A promise that resolves with the running state.\n * @since 7.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: {\n level: number;\n ramp?: boolean;\n autoFocus?: boolean;\n }): Promise<void>;\n\n /**\n * Gets the current flash mode.\n *\n * @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.\n * @since 7.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 currently active camera device.\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: {\n x?: number;\n y?: number;\n width: number;\n height: number;\n }): Promise<{\n width: number;\n height: number;\n x: number;\n y: number;\n }>;\n\n /**\n * Sets the camera focus to a specific point in the preview.\n *\n * @param {Object} options - The focus options.\n * @param {number} options.x - The x coordinate in the preview view to focus on (0-1 normalized).\n * @param {number} options.y - The y coordinate in the preview view to focus on (0-1 normalized).\n * @returns {Promise<void>} A promise that resolves when the focus is set.\n * @since 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: {\n width: number;\n height: number;\n x: number;\n y: number;\n }) => 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 * 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\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\n */\n getExposureCompensation(): Promise<{ value: number }>;\n\n /**\n * Sets the exposure compensation (EV bias). Value will be clamped to range.\n * @platform ios\n */\n setExposureCompensation(options: { value: number }): Promise<void>;\n}\n"]}
|