@capgo/camera-preview 7.3.9 → 7.4.0-beta.2

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.
Files changed (56) hide show
  1. package/CapgoCameraPreview.podspec +16 -13
  2. package/README.md +306 -70
  3. package/android/.gradle/8.14.2/checksums/checksums.lock +0 -0
  4. package/android/.gradle/8.14.2/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/8.14.2/executionHistory/executionHistory.bin +0 -0
  6. package/android/.gradle/8.14.2/executionHistory/executionHistory.lock +0 -0
  7. package/android/.gradle/8.14.2/fileChanges/last-build.bin +0 -0
  8. package/android/.gradle/8.14.2/fileHashes/fileHashes.bin +0 -0
  9. package/android/.gradle/8.14.2/fileHashes/fileHashes.lock +0 -0
  10. package/android/.gradle/8.14.2/fileHashes/resourceHashesCache.bin +0 -0
  11. package/android/.gradle/8.14.2/gc.properties +0 -0
  12. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  13. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  14. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  15. package/android/.gradle/file-system.probe +0 -0
  16. package/android/.gradle/vcs-1/gc.properties +0 -0
  17. package/android/build.gradle +9 -0
  18. package/android/src/main/AndroidManifest.xml +5 -0
  19. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +260 -551
  20. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +968 -0
  21. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraDevice.java +54 -0
  22. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraLens.java +70 -0
  23. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraSessionConfiguration.java +65 -0
  24. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/LensInfo.java +34 -0
  25. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/ZoomFactors.java +34 -0
  26. package/dist/docs.json +729 -153
  27. package/dist/esm/definitions.d.ts +337 -80
  28. package/dist/esm/definitions.js +10 -1
  29. package/dist/esm/definitions.js.map +1 -1
  30. package/dist/esm/web.d.ts +27 -1
  31. package/dist/esm/web.js +248 -4
  32. package/dist/esm/web.js.map +1 -1
  33. package/dist/plugin.cjs.js +256 -4
  34. package/dist/plugin.cjs.js.map +1 -1
  35. package/dist/plugin.js +256 -4
  36. package/dist/plugin.js.map +1 -1
  37. package/ios/{Plugin → Sources/CapgoCameraPreview}/CameraController.swift +359 -34
  38. package/ios/{Plugin → Sources/CapgoCameraPreview}/Plugin.swift +348 -42
  39. package/ios/Tests/CameraPreviewPluginTests/CameraPreviewPluginTests.swift +15 -0
  40. package/package.json +1 -1
  41. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +0 -1279
  42. package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomSurfaceView.java +0 -29
  43. package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomTextureView.java +0 -39
  44. package/android/src/main/java/com/ahm/capacitor/camera/preview/Preview.java +0 -461
  45. package/android/src/main/java/com/ahm/capacitor/camera/preview/TapGestureDetector.java +0 -24
  46. package/ios/Plugin/Info.plist +0 -24
  47. package/ios/Plugin/Plugin.h +0 -10
  48. package/ios/Plugin/Plugin.m +0 -18
  49. package/ios/Plugin.xcodeproj/project.pbxproj +0 -593
  50. package/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  51. package/ios/Plugin.xcworkspace/contents.xcworkspacedata +0 -10
  52. package/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  53. package/ios/PluginTests/Info.plist +0 -22
  54. package/ios/PluginTests/PluginTests.swift +0 -83
  55. package/ios/Podfile +0 -13
  56. package/ios/Podfile.lock +0 -23
@@ -1,14 +1,17 @@
1
+ require 'json'
1
2
 
2
- Pod::Spec.new do |s|
3
- s.name = 'CapgoCameraPreview'
4
- s.version = '2.0.0'
5
- s.summary = 'Camera preview'
6
- s.license = 'MIT'
7
- s.homepage = 'https://github.com/Cap-go/camera-preview.git'
8
- s.author = 'Ariel Hernandez Musa'
9
- s.source = { :git => 'https://github.com/Cap-go/camera-preview.git', :tag => s.version.to_s }
10
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
11
- s.ios.deployment_target = '14.0'
12
- s.dependency 'Capacitor'
13
- s.swift_version = '5.1'
14
- end
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'CapgoCameraPreview'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '14.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
package/README.md CHANGED
@@ -181,25 +181,36 @@ Documentation for the [uploader](https://github.com/Cap-go/capacitor-uploader)
181
181
  * [`setOpacity(...)`](#setopacity)
182
182
  * [`stopRecordVideo()`](#stoprecordvideo)
183
183
  * [`startRecordVideo(...)`](#startrecordvideo)
184
+ * [`isRunning()`](#isrunning)
185
+ * [`getAvailableDevices()`](#getavailabledevices)
186
+ * [`getZoom()`](#getzoom)
187
+ * [`setZoom(...)`](#setzoom)
188
+ * [`getFlashMode()`](#getflashmode)
189
+ * [`removeAllListeners()`](#removealllisteners)
190
+ * [`setDeviceId(...)`](#setdeviceid)
191
+ * [`getDeviceId()`](#getdeviceid)
184
192
  * [Interfaces](#interfaces)
185
193
  * [Type Aliases](#type-aliases)
194
+ * [Enums](#enums)
186
195
 
187
196
  </docgen-index>
188
197
 
189
198
  <docgen-api>
190
199
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
191
200
 
201
+ The main interface for the CameraPreview plugin.
202
+
192
203
  ### start(...)
193
204
 
194
205
  ```typescript
195
206
  start(options: CameraPreviewOptions) => Promise<void>
196
207
  ```
197
208
 
198
- Start the camera preview instance.
209
+ Starts the camera preview.
199
210
 
200
- | Param | Type | Description |
201
- | ------------- | --------------------------------------------------------------------- | -------------------------------------------- |
202
- | **`options`** | <code><a href="#camerapreviewoptions">CameraPreviewOptions</a></code> | the options to start the camera preview with |
211
+ | Param | Type | Description |
212
+ | ------------- | --------------------------------------------------------------------- | ------------------------------------------- |
213
+ | **`options`** | <code><a href="#camerapreviewoptions">CameraPreviewOptions</a></code> | - The configuration for the camera preview. |
203
214
 
204
215
  **Since:** 0.0.1
205
216
 
@@ -212,7 +223,7 @@ Start the camera preview instance.
212
223
  stop() => Promise<void>
213
224
  ```
214
225
 
215
- Stop the camera preview instance.
226
+ Stops the camera preview.
216
227
 
217
228
  **Since:** 0.0.1
218
229
 
@@ -222,16 +233,16 @@ Stop the camera preview instance.
222
233
  ### capture(...)
223
234
 
224
235
  ```typescript
225
- capture(options: CameraPreviewPictureOptions) => Promise<{ value: string; }>
236
+ capture(options: CameraPreviewPictureOptions) => Promise<{ value: string; exif: ExifData; }>
226
237
  ```
227
238
 
228
- Switch camera.
239
+ Captures a picture from the camera.
229
240
 
230
- | Param | Type | Description |
231
- | ------------- | ----------------------------------------------------------------------------------- | ------------------------------------- |
232
- | **`options`** | <code><a href="#camerapreviewpictureoptions">CameraPreviewPictureOptions</a></code> | the options to switch the camera with |
241
+ | Param | Type | Description |
242
+ | ------------- | ----------------------------------------------------------------------------------- | ---------------------------------------- |
243
+ | **`options`** | <code><a href="#camerapreviewpictureoptions">CameraPreviewPictureOptions</a></code> | - The options for capturing the picture. |
233
244
 
234
- **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
245
+ **Returns:** <code>Promise&lt;{ value: string; exif: <a href="#exifdata">ExifData</a>; }&gt;</code>
235
246
 
236
247
  **Since:** 0.0.1
237
248
 
@@ -244,11 +255,11 @@ Switch camera.
244
255
  captureSample(options: CameraSampleOptions) => Promise<{ value: string; }>
245
256
  ```
246
257
 
247
- Capture a sample image.
258
+ Captures a single frame from the camera preview stream.
248
259
 
249
- | Param | Type | Description |
250
- | ------------- | ------------------------------------------------------------------- | -------------------------------------------- |
251
- | **`options`** | <code><a href="#camerasampleoptions">CameraSampleOptions</a></code> | the options to capture the sample image with |
260
+ | Param | Type | Description |
261
+ | ------------- | ------------------------------------------------------------------- | --------------------------------------- |
262
+ | **`options`** | <code><a href="#camerasampleoptions">CameraSampleOptions</a></code> | - The options for capturing the sample. |
252
263
 
253
264
  **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
254
265
 
@@ -263,7 +274,7 @@ Capture a sample image.
263
274
  getSupportedFlashModes() => Promise<{ result: CameraPreviewFlashMode[]; }>
264
275
  ```
265
276
 
266
- Get supported flash modes.
277
+ Gets the flash modes supported by the active camera.
267
278
 
268
279
  **Returns:** <code>Promise&lt;{ result: CameraPreviewFlashMode[]; }&gt;</code>
269
280
 
@@ -275,12 +286,13 @@ Get supported flash modes.
275
286
  ### getHorizontalFov()
276
287
 
277
288
  ```typescript
278
- getHorizontalFov() => Promise<{ result: any; }>
289
+ getHorizontalFov() => Promise<{ result: number; }>
279
290
  ```
280
291
 
281
- Get horizontal field of view.
292
+ Gets the horizontal field of view (FoV) for the active camera.
293
+ Note: This can be an estimate on some devices.
282
294
 
283
- **Returns:** <code>Promise&lt;{ result: any; }&gt;</code>
295
+ **Returns:** <code>Promise&lt;{ result: number; }&gt;</code>
284
296
 
285
297
  **Since:** 0.0.1
286
298
 
@@ -290,12 +302,14 @@ Get horizontal field of view.
290
302
  ### getSupportedPictureSizes()
291
303
 
292
304
  ```typescript
293
- getSupportedPictureSizes() => Promise<{ supportedPictureSizes: { facing: string; supportedPictureSizes: { width: number; height: number; }[]; }[]; }>
305
+ getSupportedPictureSizes() => Promise<{ supportedPictureSizes: SupportedPictureSizes[]; }>
294
306
  ```
295
307
 
296
- Gets the supported picture sizes for a given device.
308
+ Gets the supported picture sizes for all cameras.
297
309
 
298
- **Returns:** <code>Promise&lt;{ supportedPictureSizes: { facing: string; supportedPictureSizes: { width: number; height: number; }[]; }[]; }&gt;</code>
310
+ **Returns:** <code>Promise&lt;{ supportedPictureSizes: SupportedPictureSizes[]; }&gt;</code>
311
+
312
+ **Since:** 7.4.0
299
313
 
300
314
  --------------------
301
315
 
@@ -306,11 +320,11 @@ Gets the supported picture sizes for a given device.
306
320
  setFlashMode(options: { flashMode: CameraPreviewFlashMode | string; }) => Promise<void>
307
321
  ```
308
322
 
309
- Set flash mode.
323
+ Sets the flash mode for the active camera.
310
324
 
311
- | Param | Type | Description |
312
- | ------------- | ----------------------------------- | -------------------------------------- |
313
- | **`options`** | <code>{ flashMode: string; }</code> | the options to set the flash mode with |
325
+ | Param | Type | Description |
326
+ | ------------- | ----------------------------------- | ------------------------- |
327
+ | **`options`** | <code>{ flashMode: string; }</code> | - The desired flash mode. |
314
328
 
315
329
  **Since:** 0.0.1
316
330
 
@@ -323,7 +337,7 @@ Set flash mode.
323
337
  flip() => Promise<void>
324
338
  ```
325
339
 
326
- Flip camera.
340
+ Toggles between the front and rear cameras.
327
341
 
328
342
  **Since:** 0.0.1
329
343
 
@@ -336,11 +350,11 @@ Flip camera.
336
350
  setOpacity(options: CameraOpacityOptions) => Promise<void>
337
351
  ```
338
352
 
339
- Set opacity.
353
+ Sets the opacity of the camera preview.
340
354
 
341
- | Param | Type | Description |
342
- | ------------- | --------------------------------------------------------------------- | ------------------------------------------ |
343
- | **`options`** | <code><a href="#cameraopacityoptions">CameraOpacityOptions</a></code> | the options to set the camera opacity with |
355
+ | Param | Type | Description |
356
+ | ------------- | --------------------------------------------------------------------- | ---------------------- |
357
+ | **`options`** | <code><a href="#cameraopacityoptions">CameraOpacityOptions</a></code> | - The opacity options. |
344
358
 
345
359
  **Since:** 0.0.1
346
360
 
@@ -353,7 +367,7 @@ Set opacity.
353
367
  stopRecordVideo() => Promise<{ videoFilePath: string; }>
354
368
  ```
355
369
 
356
- Stop recording video.
370
+ Stops an ongoing video recording.
357
371
 
358
372
  **Returns:** <code>Promise&lt;{ videoFilePath: string; }&gt;</code>
359
373
 
@@ -368,67 +382,265 @@ Stop recording video.
368
382
  startRecordVideo(options: CameraPreviewOptions) => Promise<void>
369
383
  ```
370
384
 
371
- Start recording video.
385
+ Starts recording a video.
372
386
 
373
- | Param | Type | Description |
374
- | ------------- | --------------------------------------------------------------------- | ----------------------------------------- |
375
- | **`options`** | <code><a href="#camerapreviewoptions">CameraPreviewOptions</a></code> | the options to start recording video with |
387
+ | Param | Type | Description |
388
+ | ------------- | --------------------------------------------------------------------- | ---------------------------------- |
389
+ | **`options`** | <code><a href="#camerapreviewoptions">CameraPreviewOptions</a></code> | - The options for video recording. |
376
390
 
377
391
  **Since:** 0.0.1
378
392
 
379
393
  --------------------
380
394
 
381
395
 
396
+ ### isRunning()
397
+
398
+ ```typescript
399
+ isRunning() => Promise<{ isRunning: boolean; }>
400
+ ```
401
+
402
+ Checks if the camera preview is currently running.
403
+
404
+ **Returns:** <code>Promise&lt;{ isRunning: boolean; }&gt;</code>
405
+
406
+ **Since:** 7.4.0
407
+
408
+ --------------------
409
+
410
+
411
+ ### getAvailableDevices()
412
+
413
+ ```typescript
414
+ getAvailableDevices() => Promise<{ devices: CameraDevice[]; }>
415
+ ```
416
+
417
+ Gets all available camera devices.
418
+
419
+ **Returns:** <code>Promise&lt;{ devices: CameraDevice[]; }&gt;</code>
420
+
421
+ **Since:** 7.4.0
422
+
423
+ --------------------
424
+
425
+
426
+ ### getZoom()
427
+
428
+ ```typescript
429
+ getZoom() => Promise<{ min: number; max: number; current: number; lens: LensInfo; }>
430
+ ```
431
+
432
+ Gets the current zoom state, including min/max and current lens info.
433
+
434
+ **Returns:** <code>Promise&lt;{ min: number; max: number; current: number; lens: <a href="#lensinfo">LensInfo</a>; }&gt;</code>
435
+
436
+ **Since:** 7.4.0
437
+
438
+ --------------------
439
+
440
+
441
+ ### setZoom(...)
442
+
443
+ ```typescript
444
+ setZoom(options: { level: number; ramp?: boolean; }) => Promise<void>
445
+ ```
446
+
447
+ Sets the camera's zoom level.
448
+
449
+ | Param | Type | Description |
450
+ | ------------- | ----------------------------------------------- | ----------------------------------------------------- |
451
+ | **`options`** | <code>{ level: number; ramp?: boolean; }</code> | - The desired zoom level. `ramp` is currently unused. |
452
+
453
+ **Since:** 7.4.0
454
+
455
+ --------------------
456
+
457
+
458
+ ### getFlashMode()
459
+
460
+ ```typescript
461
+ getFlashMode() => Promise<{ flashMode: FlashMode; }>
462
+ ```
463
+
464
+ Gets the current flash mode.
465
+
466
+ **Returns:** <code>Promise&lt;{ flashMode: <a href="#camerapreviewflashmode">CameraPreviewFlashMode</a>; }&gt;</code>
467
+
468
+ **Since:** 7.4.0
469
+
470
+ --------------------
471
+
472
+
473
+ ### removeAllListeners()
474
+
475
+ ```typescript
476
+ removeAllListeners() => Promise<void>
477
+ ```
478
+
479
+ Removes all registered listeners.
480
+
481
+ **Since:** 7.4.0
482
+
483
+ --------------------
484
+
485
+
486
+ ### setDeviceId(...)
487
+
488
+ ```typescript
489
+ setDeviceId(options: { deviceId: string; }) => Promise<void>
490
+ ```
491
+
492
+ Switches the active camera to the one with the specified `deviceId`.
493
+
494
+ | Param | Type | Description |
495
+ | ------------- | ---------------------------------- | ------------------------------------ |
496
+ | **`options`** | <code>{ deviceId: string; }</code> | - The ID of the device to switch to. |
497
+
498
+ **Since:** 7.4.0
499
+
500
+ --------------------
501
+
502
+
503
+ ### getDeviceId()
504
+
505
+ ```typescript
506
+ getDeviceId() => Promise<{ deviceId: string; }>
507
+ ```
508
+
509
+ Gets the ID of the currently active camera device.
510
+
511
+ **Returns:** <code>Promise&lt;{ deviceId: string; }&gt;</code>
512
+
513
+ **Since:** 7.4.0
514
+
515
+ --------------------
516
+
517
+
382
518
  ### Interfaces
383
519
 
384
520
 
385
521
  #### CameraPreviewOptions
386
522
 
387
- | Prop | Type | Description |
388
- | ---------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
389
- | **`parent`** | <code>string</code> | Parent element to attach the video preview element to (applicable to the web platform only) |
390
- | **`className`** | <code>string</code> | Class name to add to the video preview element (applicable to the web platform only) |
391
- | **`width`** | <code>number</code> | The preview width in pixels, default window.screen.width |
392
- | **`height`** | <code>number</code> | The preview height in pixels, default window.screen.height |
393
- | **`x`** | <code>number</code> | The x origin, default 0 (applicable to the android and ios platforms only) |
394
- | **`y`** | <code>number</code> | The y origin, default 0 (applicable to the android and ios platforms only) |
395
- | **`includeSafeAreaInsets`** | <code>boolean</code> | Whether to include safe area insets in y-position calculation, default false (applicable to the ios platform only) |
396
- | **`toBack`** | <code>boolean</code> | Brings your html in front of your preview, default false (applicable to the android only) |
397
- | **`paddingBottom`** | <code>number</code> | The preview bottom padding in pixes. Useful to keep the appropriate preview sizes when orientation changes (applicable to the android and ios platforms only) |
398
- | **`rotateWhenOrientationChanged`** | <code>boolean</code> | Rotate preview when orientation changes (applicable to the ios platforms only; default value is true) |
399
- | **`position`** | <code>string</code> | Choose the camera to use 'front' or 'rear', default 'front' |
400
- | **`storeToFile`** | <code>boolean</code> | Defaults to false - Capture images to a file and return the file path instead of returning base64 encoded data |
401
- | **`disableExifHeaderStripping`** | <code>boolean</code> | Defaults to false - Android Only - Disable automatic rotation of the image, and let the browser deal with it (keep reading on how to achieve it) |
402
- | **`enableHighResolution`** | <code>boolean</code> | Defaults to false - iOS only - Activate high resolution image capture so that output images are from the highest resolution possible on the device * |
403
- | **`disableAudio`** | <code>boolean</code> | Defaults to false - Disables audio stream to prevent permission requests and output switching |
404
- | **`lockAndroidOrientation`** | <code>boolean</code> | Android Only - Locks device orientation when camera is showing. |
405
- | **`enableOpacity`** | <code>boolean</code> | Defaults to false - Android and Web only. Set if camera preview can change opacity. |
406
- | **`enableZoom`** | <code>boolean</code> | Defaults to false - Android only. Set if camera preview will support pinch to zoom. |
407
- | **`cameraMode`** | <code>boolean</code> | default to false - IOS only. Set the CameraPreview to use the video mode preset |
523
+ Defines the configuration options for starting the camera preview.
524
+
525
+ | Prop | Type | Description | Default |
526
+ | ---------------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------- |
527
+ | **`parent`** | <code>string</code> | The parent element to attach the video preview to. | |
528
+ | **`className`** | <code>string</code> | A CSS class name to add to the preview element. | |
529
+ | **`width`** | <code>number</code> | The width of the preview in pixels. Defaults to the screen width. | |
530
+ | **`height`** | <code>number</code> | The height of the preview in pixels. Defaults to the screen height. | |
531
+ | **`x`** | <code>number</code> | The horizontal origin of the preview, in pixels. | |
532
+ | **`y`** | <code>number</code> | The vertical origin of the preview, in pixels. | |
533
+ | **`includeSafeAreaInsets`** | <code>boolean</code> | Adjusts the y-position to account for safe areas (e.g., notches). | <code>false</code> |
534
+ | **`toBack`** | <code>boolean</code> | If true, places the preview behind the webview. | <code>true</code> |
535
+ | **`paddingBottom`** | <code>number</code> | Bottom padding for the preview, in pixels. | |
536
+ | **`rotateWhenOrientationChanged`** | <code>boolean</code> | Whether to rotate the preview when the device orientation changes. | <code>true</code> |
537
+ | **`position`** | <code>string</code> | The camera to use. | <code>"rear"</code> |
538
+ | **`storeToFile`** | <code>boolean</code> | If true, saves the captured image to a file and returns the file path. If false, returns a base64 encoded string. | <code>false</code> |
539
+ | **`disableExifHeaderStripping`** | <code>boolean</code> | If true, prevents the plugin from rotating the image based on EXIF data. | <code>false</code> |
540
+ | **`enableHighResolution`** | <code>boolean</code> | If true, enables high-resolution image capture. | <code>false</code> |
541
+ | **`disableAudio`** | <code>boolean</code> | If true, disables the audio stream, preventing audio permission requests. | <code>false</code> |
542
+ | **`lockAndroidOrientation`** | <code>boolean</code> | If true, locks the device orientation while the camera is active. | <code>false</code> |
543
+ | **`enableOpacity`** | <code>boolean</code> | If true, allows the camera preview's opacity to be changed. | <code>false</code> |
544
+ | **`enableZoom`** | <code>boolean</code> | If true, enables pinch-to-zoom functionality on the preview. | <code>false</code> |
545
+ | **`enableVideoMode`** | <code>boolean</code> | If true, uses the video-optimized preset for the camera session. | <code>false</code> |
546
+ | **`deviceId`** | <code>string</code> | The `deviceId` of the camera to use. If provided, `position` is ignored. | |
547
+
548
+
549
+ #### ExifData
550
+
551
+ Represents EXIF data extracted from an image.
408
552
 
409
553
 
410
554
  #### CameraPreviewPictureOptions
411
555
 
412
- | Prop | Type | Description |
413
- | ------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------ |
414
- | **`height`** | <code>number</code> | The picture height, optional, default 0 (Device default) |
415
- | **`width`** | <code>number</code> | The picture width, optional, default 0 (Device default) |
416
- | **`quality`** | <code>number</code> | The picture quality, 0 - 100, default 85 |
417
- | **`format`** | <code><a href="#pictureformat">PictureFormat</a></code> | The picture format, jpeg or png, default jpeg on `Web`. quality has no effect on png |
556
+ Defines the options for capturing a picture.
557
+
558
+ | Prop | Type | Description | Default | Since |
559
+ | ------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ------------------- | ----- |
560
+ | **`height`** | <code>number</code> | The desired height of the picture in pixels. If not provided, the device default is used. | | |
561
+ | **`width`** | <code>number</code> | The desired width of the picture in pixels. If not provided, the device default is used. | | |
562
+ | **`quality`** | <code>number</code> | The quality of the captured image, from 0 to 100. Does not apply to `png` format. | <code>85</code> | |
563
+ | **`format`** | <code><a href="#pictureformat">PictureFormat</a></code> | The format of the captured image. | <code>"jpeg"</code> | |
564
+ | **`saveToGallery`** | <code>boolean</code> | If true, the captured image will be saved to the user's gallery. | <code>false</code> | 7.5.0 |
418
565
 
419
566
 
420
567
  #### CameraSampleOptions
421
568
 
422
- | Prop | Type | Description |
423
- | ------------- | ------------------- | ---------------------------------------- |
424
- | **`quality`** | <code>number</code> | The picture quality, 0 - 100, default 85 |
569
+ Defines the options for capturing a sample frame from the camera preview.
570
+
571
+ | Prop | Type | Description | Default |
572
+ | ------------- | ------------------- | -------------------------------------------------- | --------------- |
573
+ | **`quality`** | <code>number</code> | The quality of the captured sample, from 0 to 100. | <code>85</code> |
574
+
575
+
576
+ #### SupportedPictureSizes
577
+
578
+ Represents the supported picture sizes for a camera facing a certain direction.
579
+
580
+ | Prop | Type | Description |
581
+ | --------------------------- | -------------------------- | -------------------------------------------------- |
582
+ | **`facing`** | <code>string</code> | The camera direction ("front" or "rear"). |
583
+ | **`supportedPictureSizes`** | <code>PictureSize[]</code> | A list of supported picture sizes for this camera. |
584
+
585
+
586
+ #### PictureSize
587
+
588
+ Defines a standard picture size with width and height.
589
+
590
+ | Prop | Type | Description |
591
+ | ------------ | ------------------- | ------------------------------------ |
592
+ | **`width`** | <code>number</code> | The width of the picture in pixels. |
593
+ | **`height`** | <code>number</code> | The height of the picture in pixels. |
425
594
 
426
595
 
427
596
  #### CameraOpacityOptions
428
597
 
429
- | Prop | Type | Description |
430
- | ------------- | ------------------- | ----------------------------------------------------- |
431
- | **`opacity`** | <code>number</code> | The percent opacity to set for camera view, default 1 |
598
+ Defines the options for setting the camera preview's opacity.
599
+
600
+ | Prop | Type | Description | Default |
601
+ | ------------- | ------------------- | --------------------------------------------------------------------------- | ---------------- |
602
+ | **`opacity`** | <code>number</code> | The opacity percentage, from 0.0 (fully transparent) to 1.0 (fully opaque). | <code>1.0</code> |
603
+
604
+
605
+ #### CameraDevice
606
+
607
+ Represents a physical camera on the device (e.g., the front-facing camera).
608
+
609
+ | Prop | Type | Description |
610
+ | --------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
611
+ | **`deviceId`** | <code>string</code> | A unique identifier for the camera device. |
612
+ | **`label`** | <code>string</code> | A human-readable name for the camera device. |
613
+ | **`position`** | <code><a href="#cameraposition">CameraPosition</a></code> | The physical position of the camera on the device. |
614
+ | **`lenses`** | <code>CameraLens[]</code> | A list of all available lenses for this camera device. |
615
+ | **`minZoom`** | <code>number</code> | The overall minimum zoom factor available across all lenses on this device. |
616
+ | **`maxZoom`** | <code>number</code> | The overall maximum zoom factor available across all lenses on this device. |
617
+ | **`isLogical`** | <code>boolean</code> | Identifies whether the device is a logical camera (composed of multiple physical lenses). |
618
+
619
+
620
+ #### CameraLens
621
+
622
+ Represents a single camera lens on a device. A {@link <a href="#cameradevice">CameraDevice</a>} can have multiple lenses.
623
+
624
+ | Prop | Type | Description |
625
+ | ------------------- | ------------------------------------------------- | ---------------------------------------------------------------------------- |
626
+ | **`label`** | <code>string</code> | A human-readable name for the lens, e.g., "Ultra-Wide". |
627
+ | **`deviceType`** | <code><a href="#devicetype">DeviceType</a></code> | The type of the camera lens. |
628
+ | **`focalLength`** | <code>number</code> | The focal length of the lens in millimeters. |
629
+ | **`baseZoomRatio`** | <code>number</code> | The base zoom factor for this lens (e.g., 0.5 for ultra-wide, 1.0 for wide). |
630
+ | **`minZoom`** | <code>number</code> | The minimum zoom factor supported by this specific lens. |
631
+ | **`maxZoom`** | <code>number</code> | The maximum zoom factor supported by this specific lens. |
632
+
633
+
634
+ #### LensInfo
635
+
636
+ Represents the detailed information of the currently active lens.
637
+
638
+ | Prop | Type | Description |
639
+ | ------------------- | ------------------------------------------------- | ---------------------------------------------------------------- |
640
+ | **`focalLength`** | <code>number</code> | The focal length of the active lens in millimeters. |
641
+ | **`deviceType`** | <code><a href="#devicetype">DeviceType</a></code> | The device type of the active lens. |
642
+ | **`baseZoomRatio`** | <code>number</code> | The base zoom ratio of the active lens (e.g., 0.5x, 1.0x). |
643
+ | **`digitalZoom`** | <code>number</code> | The current digital zoom factor applied on top of the base zoom. |
432
644
 
433
645
 
434
646
  ### Type Aliases
@@ -446,6 +658,30 @@ Start recording video.
446
658
 
447
659
  #### CameraPreviewFlashMode
448
660
 
449
- <code>"off" | "on" | "auto" | "red-eye" | "torch"</code>
661
+ The available flash modes for the camera.
662
+ 'torch' is a continuous light mode.
663
+
664
+ <code>"off" | "on" | "auto" | "torch"</code>
665
+
666
+
667
+ #### FlashMode
668
+
669
+ <code><a href="#camerapreviewflashmode">CameraPreviewFlashMode</a></code>
670
+
671
+
672
+ ### Enums
673
+
674
+
675
+ #### DeviceType
676
+
677
+ | Members | Value |
678
+ | ---------------- | ------------------------ |
679
+ | **`ULTRA_WIDE`** | <code>"ultraWide"</code> |
680
+ | **`WIDE_ANGLE`** | <code>"wideAngle"</code> |
681
+ | **`TELEPHOTO`** | <code>"telephoto"</code> |
682
+ | **`TRUE_DEPTH`** | <code>"trueDepth"</code> |
683
+ | **`DUAL`** | <code>"dual"</code> |
684
+ | **`DUAL_WIDE`** | <code>"dualWide"</code> |
685
+ | **`TRIPLE`** | <code>"triple"</code> |
450
686
 
451
687
  </docgen-api>
File without changes
@@ -0,0 +1,2 @@
1
+ #Mon Jun 30 22:10:14 EEST 2025
2
+ gradle.version=8.14.2
File without changes
@@ -49,6 +49,15 @@ dependencies {
49
49
  implementation project(':capacitor-android')
50
50
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
51
51
  implementation 'androidx.exifinterface:exifinterface:1.4.1'
52
+
53
+ // CameraX dependencies
54
+ def camerax_version = "1.5.0-beta01"
55
+ implementation "androidx.camera:camera-core:${camerax_version}"
56
+ implementation "androidx.camera:camera-camera2:${camerax_version}"
57
+ implementation "androidx.camera:camera-lifecycle:${camerax_version}"
58
+ implementation "androidx.camera:camera-view:${camerax_version}"
59
+ implementation "androidx.camera:camera-extensions:${camerax_version}"
60
+
52
61
  testImplementation "junit:junit:$junitVersion"
53
62
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
54
63
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -1,5 +1,10 @@
1
1
 
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  >
4
+ <uses-permission android:name="android.permission.CAMERA" />
5
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
6
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7
+ <uses-feature android:name="android.hardware.camera" />
8
+ <uses-feature android:name="android.hardware.camera.autofocus" />
4
9
  </manifest>
5
10