@capgo/camera-preview 7.3.12 → 7.4.0-beta.10
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/CapgoCameraPreview.podspec +16 -13
- package/README.md +467 -73
- package/android/.gradle/8.14.2/checksums/checksums.lock +0 -0
- package/android/.gradle/8.14.2/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.14.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.14.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/8.14.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.14.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.14.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.14.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.14.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/8.14.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +11 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/AndroidManifest.xml +5 -3
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +472 -541
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +1648 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/GridOverlayView.java +82 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraDevice.java +54 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraLens.java +70 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraSessionConfiguration.java +79 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/LensInfo.java +34 -0
- package/android/src/main/java/com/ahm/capacitor/camera/preview/model/ZoomFactors.java +34 -0
- package/dist/docs.json +934 -154
- package/dist/esm/definitions.d.ts +445 -83
- package/dist/esm/definitions.js +10 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +73 -3
- package/dist/esm/web.js +492 -68
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +498 -68
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +498 -68
- package/dist/plugin.js.map +1 -1
- package/ios/{Plugin → Sources/CapgoCameraPreview}/CameraController.swift +601 -59
- package/ios/Sources/CapgoCameraPreview/GridOverlayView.swift +65 -0
- package/ios/Sources/CapgoCameraPreview/Plugin.swift +1369 -0
- package/ios/Tests/CameraPreviewPluginTests/CameraPreviewPluginTests.swift +15 -0
- package/package.json +1 -1
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +0 -1279
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomSurfaceView.java +0 -29
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomTextureView.java +0 -39
- package/android/src/main/java/com/ahm/capacitor/camera/preview/Preview.java +0 -461
- package/android/src/main/java/com/ahm/capacitor/camera/preview/TapGestureDetector.java +0 -24
- package/ios/Plugin/Info.plist +0 -24
- package/ios/Plugin/Plugin.h +0 -10
- package/ios/Plugin/Plugin.m +0 -18
- package/ios/Plugin/Plugin.swift +0 -511
- package/ios/Plugin.xcodeproj/project.pbxproj +0 -593
- package/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/Plugin.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/PluginTests/Info.plist +0 -22
- package/ios/PluginTests/PluginTests.swift +0 -83
- package/ios/Podfile +0 -13
- package/ios/Podfile.lock +0 -23
|
@@ -1,175 +1,537 @@
|
|
|
1
1
|
export type CameraPosition = "rear" | "front";
|
|
2
|
+
export type FlashMode = CameraPreviewFlashMode;
|
|
3
|
+
export type GridMode = "none" | "3x3" | "4x4";
|
|
4
|
+
export declare enum DeviceType {
|
|
5
|
+
ULTRA_WIDE = "ultraWide",
|
|
6
|
+
WIDE_ANGLE = "wideAngle",
|
|
7
|
+
TELEPHOTO = "telephoto",
|
|
8
|
+
TRUE_DEPTH = "trueDepth",
|
|
9
|
+
DUAL = "dual",
|
|
10
|
+
DUAL_WIDE = "dualWide",
|
|
11
|
+
TRIPLE = "triple"
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Represents a single camera lens on a device. A {@link CameraDevice} can have multiple lenses.
|
|
15
|
+
*/
|
|
16
|
+
export interface CameraLens {
|
|
17
|
+
/** A human-readable name for the lens, e.g., "Ultra-Wide". */
|
|
18
|
+
label: string;
|
|
19
|
+
/** The type of the camera lens. */
|
|
20
|
+
deviceType: DeviceType;
|
|
21
|
+
/** The focal length of the lens in millimeters. */
|
|
22
|
+
focalLength: number;
|
|
23
|
+
/** The base zoom factor for this lens (e.g., 0.5 for ultra-wide, 1.0 for wide). */
|
|
24
|
+
baseZoomRatio: number;
|
|
25
|
+
/** The minimum zoom factor supported by this specific lens. */
|
|
26
|
+
minZoom: number;
|
|
27
|
+
/** The maximum zoom factor supported by this specific lens. */
|
|
28
|
+
maxZoom: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents a physical camera on the device (e.g., the front-facing camera).
|
|
32
|
+
*/
|
|
33
|
+
export interface CameraDevice {
|
|
34
|
+
/** A unique identifier for the camera device. */
|
|
35
|
+
deviceId: string;
|
|
36
|
+
/** A human-readable name for the camera device. */
|
|
37
|
+
label: string;
|
|
38
|
+
/** The physical position of the camera on the device. */
|
|
39
|
+
position: CameraPosition;
|
|
40
|
+
/** A list of all available lenses for this camera device. */
|
|
41
|
+
lenses: CameraLens[];
|
|
42
|
+
/** The overall minimum zoom factor available across all lenses on this device. */
|
|
43
|
+
minZoom: number;
|
|
44
|
+
/** The overall maximum zoom factor available across all lenses on this device. */
|
|
45
|
+
maxZoom: number;
|
|
46
|
+
/** Identifies whether the device is a logical camera (composed of multiple physical lenses). */
|
|
47
|
+
isLogical: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Represents the detailed information of the currently active lens.
|
|
51
|
+
*/
|
|
52
|
+
export interface LensInfo {
|
|
53
|
+
/** The focal length of the active lens in millimeters. */
|
|
54
|
+
focalLength: number;
|
|
55
|
+
/** The device type of the active lens. */
|
|
56
|
+
deviceType: DeviceType;
|
|
57
|
+
/** The base zoom ratio of the active lens (e.g., 0.5x, 1.0x). */
|
|
58
|
+
baseZoomRatio: number;
|
|
59
|
+
/** The current digital zoom factor applied on top of the base zoom. */
|
|
60
|
+
digitalZoom: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Defines the configuration options for starting the camera preview.
|
|
64
|
+
*/
|
|
2
65
|
export interface CameraPreviewOptions {
|
|
3
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The parent element to attach the video preview to.
|
|
68
|
+
* @platform web
|
|
69
|
+
*/
|
|
4
70
|
parent?: string;
|
|
5
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* A CSS class name to add to the preview element.
|
|
73
|
+
* @platform web
|
|
74
|
+
*/
|
|
6
75
|
className?: string;
|
|
7
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* The width of the preview in pixels. Defaults to the screen width.
|
|
78
|
+
* @platform android, ios, web
|
|
79
|
+
*/
|
|
8
80
|
width?: number;
|
|
9
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* The height of the preview in pixels. Defaults to the screen height.
|
|
83
|
+
* @platform android, ios, web
|
|
84
|
+
*/
|
|
10
85
|
height?: number;
|
|
11
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* The horizontal origin of the preview, in pixels.
|
|
88
|
+
* @platform android, ios
|
|
89
|
+
*/
|
|
12
90
|
x?: number;
|
|
13
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* The vertical origin of the preview, in pixels.
|
|
93
|
+
* @platform android, ios
|
|
94
|
+
*/
|
|
14
95
|
y?: number;
|
|
15
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.
|
|
98
|
+
* Cannot be set if width or height is provided, otherwise the call will be rejected.
|
|
99
|
+
* Use setPreviewSize to adjust size after starting.
|
|
100
|
+
*
|
|
101
|
+
* @since 2.0.0
|
|
102
|
+
*/
|
|
103
|
+
aspectRatio?: '4:3' | '16:9' | 'fill';
|
|
104
|
+
/**
|
|
105
|
+
* The grid overlay to display on the camera preview.
|
|
106
|
+
* @default "none"
|
|
107
|
+
* @since 2.1.0
|
|
108
|
+
*/
|
|
109
|
+
gridMode?: GridMode;
|
|
110
|
+
/**
|
|
111
|
+
* Adjusts the y-position to account for safe areas (e.g., notches).
|
|
112
|
+
* @platform ios
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
16
115
|
includeSafeAreaInsets?: boolean;
|
|
17
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* If true, places the preview behind the webview.
|
|
118
|
+
* @platform android
|
|
119
|
+
* @default true
|
|
120
|
+
*/
|
|
18
121
|
toBack?: boolean;
|
|
19
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Bottom padding for the preview, in pixels.
|
|
124
|
+
* @platform android, ios
|
|
125
|
+
*/
|
|
20
126
|
paddingBottom?: number;
|
|
21
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Whether to rotate the preview when the device orientation changes.
|
|
129
|
+
* @platform ios
|
|
130
|
+
* @default true
|
|
131
|
+
*/
|
|
22
132
|
rotateWhenOrientationChanged?: boolean;
|
|
23
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* The camera to use.
|
|
135
|
+
* @default "rear"
|
|
136
|
+
*/
|
|
24
137
|
position?: CameraPosition | string;
|
|
25
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* If true, saves the captured image to a file and returns the file path.
|
|
140
|
+
* If false, returns a base64 encoded string.
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
26
143
|
storeToFile?: boolean;
|
|
27
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* If true, prevents the plugin from rotating the image based on EXIF data.
|
|
146
|
+
* @platform android
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
28
149
|
disableExifHeaderStripping?: boolean;
|
|
29
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* If true, enables high-resolution image capture.
|
|
152
|
+
* @platform ios
|
|
153
|
+
* @default false
|
|
154
|
+
*/
|
|
30
155
|
enableHighResolution?: boolean;
|
|
31
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* If true, disables the audio stream, preventing audio permission requests.
|
|
158
|
+
* @default true
|
|
159
|
+
*/
|
|
32
160
|
disableAudio?: boolean;
|
|
33
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* If true, locks the device orientation while the camera is active.
|
|
163
|
+
* @platform android
|
|
164
|
+
* @default false
|
|
165
|
+
*/
|
|
34
166
|
lockAndroidOrientation?: boolean;
|
|
35
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* If true, allows the camera preview's opacity to be changed.
|
|
169
|
+
* @platform android, web
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
36
172
|
enableOpacity?: boolean;
|
|
37
|
-
/**
|
|
173
|
+
/**
|
|
174
|
+
* If true, enables pinch-to-zoom functionality on the preview.
|
|
175
|
+
* @platform android
|
|
176
|
+
* @default false
|
|
177
|
+
*/
|
|
38
178
|
enableZoom?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
|
|
179
|
+
/**
|
|
180
|
+
* If true, uses the video-optimized preset for the camera session.
|
|
181
|
+
* @platform ios
|
|
182
|
+
* @default false
|
|
183
|
+
*/
|
|
184
|
+
enableVideoMode?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* The `deviceId` of the camera to use. If provided, `position` is ignored.
|
|
187
|
+
* @platform ios
|
|
188
|
+
*/
|
|
189
|
+
deviceId?: string;
|
|
41
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Defines the options for capturing a picture.
|
|
193
|
+
*/
|
|
42
194
|
export interface CameraPreviewPictureOptions {
|
|
43
|
-
/** The
|
|
195
|
+
/** The desired height of the picture in pixels. If not provided, the device default is used. */
|
|
44
196
|
height?: number;
|
|
45
|
-
/** The
|
|
197
|
+
/** The desired width of the picture in pixels. If not provided, the device default is used. */
|
|
46
198
|
width?: number;
|
|
47
|
-
/**
|
|
199
|
+
/**
|
|
200
|
+
* The quality of the captured image, from 0 to 100.
|
|
201
|
+
* Does not apply to `png` format.
|
|
202
|
+
* @default 85
|
|
203
|
+
*/
|
|
48
204
|
quality?: number;
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
205
|
+
/**
|
|
206
|
+
* The format of the captured image.
|
|
207
|
+
* @default "jpeg"
|
|
208
|
+
*/
|
|
52
209
|
format?: PictureFormat;
|
|
210
|
+
/**
|
|
211
|
+
* If true, the captured image will be saved to the user's gallery.
|
|
212
|
+
* @default false
|
|
213
|
+
* @since 7.5.0
|
|
214
|
+
*/
|
|
215
|
+
saveToGallery?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.
|
|
218
|
+
* This may prompt the user for location permissions.
|
|
219
|
+
* @default false
|
|
220
|
+
* @since 7.6.0
|
|
221
|
+
*/
|
|
222
|
+
withExifLocation?: boolean;
|
|
223
|
+
}
|
|
224
|
+
/** Represents EXIF data extracted from an image. */
|
|
225
|
+
export interface ExifData {
|
|
226
|
+
[key: string]: any;
|
|
53
227
|
}
|
|
54
228
|
export type PictureFormat = "jpeg" | "png";
|
|
229
|
+
/** Defines a standard picture size with width and height. */
|
|
230
|
+
export interface PictureSize {
|
|
231
|
+
/** The width of the picture in pixels. */
|
|
232
|
+
width: number;
|
|
233
|
+
/** The height of the picture in pixels. */
|
|
234
|
+
height: number;
|
|
235
|
+
}
|
|
236
|
+
/** Represents the supported picture sizes for a camera facing a certain direction. */
|
|
237
|
+
export interface SupportedPictureSizes {
|
|
238
|
+
/** The camera direction ("front" or "rear"). */
|
|
239
|
+
facing: string;
|
|
240
|
+
/** A list of supported picture sizes for this camera. */
|
|
241
|
+
supportedPictureSizes: PictureSize[];
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Defines the options for capturing a sample frame from the camera preview.
|
|
245
|
+
*/
|
|
55
246
|
export interface CameraSampleOptions {
|
|
56
|
-
/**
|
|
247
|
+
/**
|
|
248
|
+
* The quality of the captured sample, from 0 to 100.
|
|
249
|
+
* @default 85
|
|
250
|
+
*/
|
|
57
251
|
quality?: number;
|
|
58
252
|
}
|
|
59
|
-
|
|
253
|
+
/**
|
|
254
|
+
* The available flash modes for the camera.
|
|
255
|
+
* 'torch' is a continuous light mode.
|
|
256
|
+
*/
|
|
257
|
+
export type CameraPreviewFlashMode = "off" | "on" | "auto" | "torch";
|
|
258
|
+
/**
|
|
259
|
+
* Defines the options for setting the camera preview's opacity.
|
|
260
|
+
*/
|
|
60
261
|
export interface CameraOpacityOptions {
|
|
61
|
-
/**
|
|
262
|
+
/**
|
|
263
|
+
* The opacity percentage, from 0.0 (fully transparent) to 1.0 (fully opaque).
|
|
264
|
+
* @default 1.0
|
|
265
|
+
*/
|
|
62
266
|
opacity?: number;
|
|
63
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* The main interface for the CameraPreview plugin.
|
|
270
|
+
*/
|
|
64
271
|
export interface CameraPreviewPlugin {
|
|
65
272
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
69
|
-
* @
|
|
273
|
+
* Starts the camera preview.
|
|
274
|
+
*
|
|
275
|
+
* @param {CameraPreviewOptions} options - The configuration for the camera preview.
|
|
276
|
+
* @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the preview dimensions.
|
|
70
277
|
* @since 0.0.1
|
|
71
278
|
*/
|
|
72
|
-
start(options: CameraPreviewOptions): Promise<
|
|
279
|
+
start(options: CameraPreviewOptions): Promise<{
|
|
280
|
+
/** The width of the preview in pixels. */
|
|
281
|
+
width: number;
|
|
282
|
+
/** The height of the preview in pixels. */
|
|
283
|
+
height: number;
|
|
284
|
+
/** The horizontal origin of the preview, in pixels. */
|
|
285
|
+
x: number;
|
|
286
|
+
/** The vertical origin of the preview, in pixels. */
|
|
287
|
+
y: number;
|
|
288
|
+
}>;
|
|
73
289
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* @
|
|
290
|
+
* Stops the camera preview.
|
|
291
|
+
*
|
|
292
|
+
* @returns {Promise<void>} A promise that resolves when the camera preview is stopped.
|
|
77
293
|
* @since 0.0.1
|
|
78
294
|
*/
|
|
79
295
|
stop(): Promise<void>;
|
|
80
296
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* @
|
|
84
|
-
* @
|
|
297
|
+
* Captures a picture from the camera.
|
|
298
|
+
*
|
|
299
|
+
* @param {CameraPreviewPictureOptions} options - The options for capturing the picture.
|
|
300
|
+
* @returns {Promise<{ value: string }>} A promise that resolves with the captured image data.
|
|
301
|
+
* The `value` is a base64 encoded string unless `storeToFile` is true, in which case it's a file path.
|
|
85
302
|
* @since 0.0.1
|
|
86
303
|
*/
|
|
87
304
|
capture(options: CameraPreviewPictureOptions): Promise<{
|
|
88
305
|
value: string;
|
|
306
|
+
exif: ExifData;
|
|
89
307
|
}>;
|
|
90
308
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* @
|
|
94
|
-
* @
|
|
309
|
+
* Captures a single frame from the camera preview stream.
|
|
310
|
+
*
|
|
311
|
+
* @param {CameraSampleOptions} options - The options for capturing the sample.
|
|
312
|
+
* @returns {Promise<{ value: string }>} A promise that resolves with the sample image as a base64 encoded string.
|
|
95
313
|
* @since 0.0.1
|
|
96
314
|
*/
|
|
97
315
|
captureSample(options: CameraSampleOptions): Promise<{
|
|
98
316
|
value: string;
|
|
99
317
|
}>;
|
|
100
318
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* @
|
|
319
|
+
* Gets the flash modes supported by the active camera.
|
|
320
|
+
*
|
|
321
|
+
* @returns {Promise<{ result: CameraPreviewFlashMode[] }>} A promise that resolves with an array of supported flash modes.
|
|
104
322
|
* @since 0.0.1
|
|
105
323
|
*/
|
|
106
324
|
getSupportedFlashModes(): Promise<{
|
|
107
325
|
result: CameraPreviewFlashMode[];
|
|
108
326
|
}>;
|
|
109
327
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* @
|
|
328
|
+
* Set the aspect ratio of the camera preview.
|
|
329
|
+
*
|
|
330
|
+
* @param {{ aspectRatio: '4:3' | '16:9'; x?: number; y?: number }} options - The desired aspect ratio and optional position.
|
|
331
|
+
* - aspectRatio: The desired aspect ratio ('4:3' or '16:9')
|
|
332
|
+
* - x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.
|
|
333
|
+
* - y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.
|
|
334
|
+
* @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.
|
|
335
|
+
* @since 7.4.0
|
|
336
|
+
*/
|
|
337
|
+
setAspectRatio(options: {
|
|
338
|
+
aspectRatio: '4:3' | '16:9';
|
|
339
|
+
x?: number;
|
|
340
|
+
y?: number;
|
|
341
|
+
}): Promise<{
|
|
342
|
+
width: number;
|
|
343
|
+
height: number;
|
|
344
|
+
x: number;
|
|
345
|
+
y: number;
|
|
346
|
+
}>;
|
|
347
|
+
/**
|
|
348
|
+
* Gets the current aspect ratio of the camera preview.
|
|
349
|
+
*
|
|
350
|
+
* @returns {Promise<{ aspectRatio: '4:3' | '16:9' }>} A promise that resolves with the current aspect ratio.
|
|
351
|
+
* @since 7.4.0
|
|
352
|
+
*/
|
|
353
|
+
getAspectRatio(): Promise<{
|
|
354
|
+
aspectRatio: '4:3' | '16:9';
|
|
355
|
+
}>;
|
|
356
|
+
/**
|
|
357
|
+
* Sets the grid mode of the camera preview overlay.
|
|
358
|
+
*
|
|
359
|
+
* @param {{ gridMode: GridMode }} options - The desired grid mode ('none', '3x3', or '4x4').
|
|
360
|
+
* @returns {Promise<void>} A promise that resolves when the grid mode is set.
|
|
361
|
+
* @since 8.0.0
|
|
362
|
+
*/
|
|
363
|
+
setGridMode(options: {
|
|
364
|
+
gridMode: GridMode;
|
|
365
|
+
}): Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* Gets the current grid mode of the camera preview overlay.
|
|
368
|
+
*
|
|
369
|
+
* @returns {Promise<{ gridMode: GridMode }>} A promise that resolves with the current grid mode.
|
|
370
|
+
* @since 8.0.0
|
|
371
|
+
*/
|
|
372
|
+
getGridMode(): Promise<{
|
|
373
|
+
gridMode: GridMode;
|
|
374
|
+
}>;
|
|
375
|
+
/**
|
|
376
|
+
* Gets the horizontal field of view (FoV) for the active camera.
|
|
377
|
+
* Note: This can be an estimate on some devices.
|
|
378
|
+
*
|
|
379
|
+
* @returns {Promise<{ result: number }>} A promise that resolves with the horizontal field of view in degrees.
|
|
113
380
|
* @since 0.0.1
|
|
114
381
|
*/
|
|
115
382
|
getHorizontalFov(): Promise<{
|
|
116
|
-
result:
|
|
383
|
+
result: number;
|
|
117
384
|
}>;
|
|
118
385
|
/**
|
|
119
|
-
* Gets the supported picture sizes for
|
|
120
|
-
*
|
|
121
|
-
* @
|
|
386
|
+
* Gets the supported picture sizes for all cameras.
|
|
387
|
+
*
|
|
388
|
+
* @returns {Promise<{ supportedPictureSizes: SupportedPictureSizes[] }>} A promise that resolves with the list of supported sizes.
|
|
389
|
+
* @since 7.4.0
|
|
122
390
|
*/
|
|
123
391
|
getSupportedPictureSizes(): Promise<{
|
|
124
|
-
supportedPictureSizes:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}>;
|
|
132
|
-
/**
|
|
133
|
-
* Set flash mode.
|
|
134
|
-
* @param options the options to set the flash mode with
|
|
135
|
-
* @returns {Promise<void>} an Promise that resolves when the flash mode is set
|
|
136
|
-
* @throws An error if the something went wrong
|
|
392
|
+
supportedPictureSizes: SupportedPictureSizes[];
|
|
393
|
+
}>;
|
|
394
|
+
/**
|
|
395
|
+
* Sets the flash mode for the active camera.
|
|
396
|
+
*
|
|
397
|
+
* @param {{ flashMode: CameraPreviewFlashMode | string }} options - The desired flash mode.
|
|
398
|
+
* @returns {Promise<void>} A promise that resolves when the flash mode is set.
|
|
137
399
|
* @since 0.0.1
|
|
138
400
|
*/
|
|
139
401
|
setFlashMode(options: {
|
|
140
402
|
flashMode: CameraPreviewFlashMode | string;
|
|
141
403
|
}): Promise<void>;
|
|
142
404
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* @
|
|
405
|
+
* Toggles between the front and rear cameras.
|
|
406
|
+
*
|
|
407
|
+
* @returns {Promise<void>} A promise that resolves when the camera is flipped.
|
|
146
408
|
* @since 0.0.1
|
|
147
409
|
*/
|
|
148
410
|
flip(): Promise<void>;
|
|
149
411
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* @
|
|
153
|
-
* @
|
|
412
|
+
* Sets the opacity of the camera preview.
|
|
413
|
+
*
|
|
414
|
+
* @param {CameraOpacityOptions} options - The opacity options.
|
|
415
|
+
* @returns {Promise<void>} A promise that resolves when the opacity is set.
|
|
154
416
|
* @since 0.0.1
|
|
155
417
|
*/
|
|
156
418
|
setOpacity(options: CameraOpacityOptions): Promise<void>;
|
|
157
419
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* @returns {Promise<{videoFilePath: string}>}
|
|
161
|
-
* @throws An error if the something went wrong
|
|
420
|
+
* Stops an ongoing video recording.
|
|
421
|
+
*
|
|
422
|
+
* @returns {Promise<{ videoFilePath: string }>} A promise that resolves with the path to the recorded video file.
|
|
162
423
|
* @since 0.0.1
|
|
163
424
|
*/
|
|
164
425
|
stopRecordVideo(): Promise<{
|
|
165
426
|
videoFilePath: string;
|
|
166
427
|
}>;
|
|
167
428
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* @
|
|
171
|
-
* @
|
|
429
|
+
* Starts recording a video.
|
|
430
|
+
*
|
|
431
|
+
* @param {CameraPreviewOptions} options - The options for video recording.
|
|
432
|
+
* @returns {Promise<void>} A promise that resolves when video recording starts.
|
|
172
433
|
* @since 0.0.1
|
|
173
434
|
*/
|
|
174
435
|
startRecordVideo(options: CameraPreviewOptions): Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* Checks if the camera preview is currently running.
|
|
438
|
+
*
|
|
439
|
+
* @returns {Promise<{ isRunning: boolean }>} A promise that resolves with the running state.
|
|
440
|
+
* @since 7.4.0
|
|
441
|
+
*/
|
|
442
|
+
isRunning(): Promise<{
|
|
443
|
+
isRunning: boolean;
|
|
444
|
+
}>;
|
|
445
|
+
/**
|
|
446
|
+
* Gets all available camera devices.
|
|
447
|
+
*
|
|
448
|
+
* @returns {Promise<{ devices: CameraDevice[] }>} A promise that resolves with the list of available camera devices.
|
|
449
|
+
* @since 7.4.0
|
|
450
|
+
*/
|
|
451
|
+
getAvailableDevices(): Promise<{
|
|
452
|
+
devices: CameraDevice[];
|
|
453
|
+
}>;
|
|
454
|
+
/**
|
|
455
|
+
* Gets the current zoom state, including min/max and current lens info.
|
|
456
|
+
*
|
|
457
|
+
* @returns {Promise<{ min: number; max: number; current: number; lens: LensInfo }>} A promise that resolves with the zoom state.
|
|
458
|
+
* @since 7.4.0
|
|
459
|
+
*/
|
|
460
|
+
getZoom(): Promise<{
|
|
461
|
+
min: number;
|
|
462
|
+
max: number;
|
|
463
|
+
current: number;
|
|
464
|
+
lens: LensInfo;
|
|
465
|
+
}>;
|
|
466
|
+
/**
|
|
467
|
+
* Sets the camera's zoom level.
|
|
468
|
+
*
|
|
469
|
+
* @param {{ level: number; ramp?: boolean }} options - The desired zoom level. `ramp` is currently unused.
|
|
470
|
+
* @returns {Promise<void>} A promise that resolves when the zoom level is set.
|
|
471
|
+
* @since 7.4.0
|
|
472
|
+
*/
|
|
473
|
+
setZoom(options: {
|
|
474
|
+
level: number;
|
|
475
|
+
ramp?: boolean;
|
|
476
|
+
}): Promise<void>;
|
|
477
|
+
/**
|
|
478
|
+
* Gets the current flash mode.
|
|
479
|
+
*
|
|
480
|
+
* @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.
|
|
481
|
+
* @since 7.4.0
|
|
482
|
+
*/
|
|
483
|
+
getFlashMode(): Promise<{
|
|
484
|
+
flashMode: FlashMode;
|
|
485
|
+
}>;
|
|
486
|
+
/**
|
|
487
|
+
* Removes all registered listeners.
|
|
488
|
+
*
|
|
489
|
+
* @since 7.4.0
|
|
490
|
+
*/
|
|
491
|
+
removeAllListeners(): Promise<void>;
|
|
492
|
+
/**
|
|
493
|
+
* Switches the active camera to the one with the specified `deviceId`.
|
|
494
|
+
*
|
|
495
|
+
* @param {{ deviceId: string }} options - The ID of the device to switch to.
|
|
496
|
+
* @returns {Promise<void>} A promise that resolves when the camera is switched.
|
|
497
|
+
* @since 7.4.0
|
|
498
|
+
*/
|
|
499
|
+
setDeviceId(options: {
|
|
500
|
+
deviceId: string;
|
|
501
|
+
}): Promise<void>;
|
|
502
|
+
/**
|
|
503
|
+
* Gets the ID of the currently active camera device.
|
|
504
|
+
*
|
|
505
|
+
* @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.
|
|
506
|
+
* @since 7.4.0
|
|
507
|
+
*/
|
|
508
|
+
getDeviceId(): Promise<{
|
|
509
|
+
deviceId: string;
|
|
510
|
+
}>;
|
|
511
|
+
/**
|
|
512
|
+
* Gets the current preview size and position.
|
|
513
|
+
* @returns {Promise<{x: number, y: number, width: number, height: number}>}
|
|
514
|
+
*/
|
|
515
|
+
getPreviewSize(): Promise<{
|
|
516
|
+
x: number;
|
|
517
|
+
y: number;
|
|
518
|
+
width: number;
|
|
519
|
+
height: number;
|
|
520
|
+
}>;
|
|
521
|
+
/**
|
|
522
|
+
* Sets the preview size and position.
|
|
523
|
+
* @param options The new position and dimensions.
|
|
524
|
+
* @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.
|
|
525
|
+
*/
|
|
526
|
+
setPreviewSize(options: {
|
|
527
|
+
x: number;
|
|
528
|
+
y: number;
|
|
529
|
+
width: number;
|
|
530
|
+
height: number;
|
|
531
|
+
}): Promise<{
|
|
532
|
+
width: number;
|
|
533
|
+
height: number;
|
|
534
|
+
x: number;
|
|
535
|
+
y: number;
|
|
536
|
+
}>;
|
|
175
537
|
}
|
package/dist/esm/definitions.js
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var DeviceType;
|
|
2
|
+
(function (DeviceType) {
|
|
3
|
+
DeviceType["ULTRA_WIDE"] = "ultraWide";
|
|
4
|
+
DeviceType["WIDE_ANGLE"] = "wideAngle";
|
|
5
|
+
DeviceType["TELEPHOTO"] = "telephoto";
|
|
6
|
+
DeviceType["TRUE_DEPTH"] = "trueDepth";
|
|
7
|
+
DeviceType["DUAL"] = "dual";
|
|
8
|
+
DeviceType["DUAL_WIDE"] = "dualWide";
|
|
9
|
+
DeviceType["TRIPLE"] = "triple";
|
|
10
|
+
})(DeviceType || (DeviceType = {}));
|
|
2
11
|
//# sourceMappingURL=definitions.js.map
|