capacitor-camera-view 1.1.1 → 1.2.1

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/Package.swift CHANGED
@@ -10,7 +10,7 @@ let package = Package(
10
10
  targets: ["CameraViewPlugin"])
11
11
  ],
12
12
  dependencies: [
13
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.2.0")
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.4.2")
14
14
  ],
15
15
  targets: [
16
16
  .target(
package/README.md CHANGED
@@ -31,7 +31,7 @@
31
31
  - 📸 Capture photos or frames from the camera preview.
32
32
  - 🔍 **Barcode detection** support.
33
33
  - 📱 **Virtual device support** for automatic lens selection based on zoom level and focus (iOS only).
34
- - 🔎 Control **zoom** and **flash** modes programmatically.
34
+ - 🔦 Control **zoom**, **flash** and **torch** modes programmatically.
35
35
  - ⚡ **High performance** with optimized native implementations.
36
36
  - 🎯 **Simple to use** with a clean and intuitive API.
37
37
  - 🌐 Works seamlessly on **iOS**, **Android**, and **Web**.
@@ -210,6 +210,9 @@ chore: update dependencies
210
210
  * [`getFlashMode()`](#getflashmode)
211
211
  * [`getSupportedFlashModes()`](#getsupportedflashmodes)
212
212
  * [`setFlashMode(...)`](#setflashmode)
213
+ * [`isTorchAvailable()`](#istorchavailable)
214
+ * [`getTorchMode()`](#gettorchmode)
215
+ * [`setTorchMode(...)`](#settorchmode)
213
216
  * [`checkPermissions()`](#checkpermissions)
214
217
  * [`requestPermissions()`](#requestpermissions)
215
218
  * [`addListener('barcodeDetected', ...)`](#addlistenerbarcodedetected-)
@@ -422,6 +425,53 @@ Set the camera flash mode.
422
425
  --------------------
423
426
 
424
427
 
428
+ ### isTorchAvailable()
429
+
430
+ ```typescript
431
+ isTorchAvailable() => Promise<IsTorchAvailableResponse>
432
+ ```
433
+
434
+ Check if the device supports torch (flashlight) functionality.
435
+
436
+ **Returns:** <code>Promise&lt;<a href="#istorchavailableresponse">IsTorchAvailableResponse</a>&gt;</code>
437
+
438
+ **Since:** 1.2.0
439
+
440
+ --------------------
441
+
442
+
443
+ ### getTorchMode()
444
+
445
+ ```typescript
446
+ getTorchMode() => Promise<GetTorchModeResponse>
447
+ ```
448
+
449
+ Get the current torch (flashlight) state.
450
+
451
+ **Returns:** <code>Promise&lt;<a href="#gettorchmoderesponse">GetTorchModeResponse</a>&gt;</code>
452
+
453
+ **Since:** 1.2.0
454
+
455
+ --------------------
456
+
457
+
458
+ ### setTorchMode(...)
459
+
460
+ ```typescript
461
+ setTorchMode(options: { enabled: boolean; level?: number; }) => Promise<void>
462
+ ```
463
+
464
+ Set the torch (flashlight) mode and intensity.
465
+
466
+ | Param | Type | Description |
467
+ | ------------- | -------------------------------------------------- | ----------------------------- |
468
+ | **`options`** | <code>{ enabled: boolean; level?: number; }</code> | - Torch configuration options |
469
+
470
+ **Since:** 1.2.0
471
+
472
+ --------------------
473
+
474
+
425
475
  ### checkPermissions()
426
476
 
427
477
  ```typescript
@@ -577,6 +627,25 @@ Response for getting supported flash modes.
577
627
  | **`flashModes`** | <code>FlashMode[]</code> | An array of flash modes supported by the current camera |
578
628
 
579
629
 
630
+ #### IsTorchAvailableResponse
631
+
632
+ Response for checking torch availability.
633
+
634
+ | Prop | Type | Description |
635
+ | --------------- | -------------------- | ----------------------------------------------------------------- |
636
+ | **`available`** | <code>boolean</code> | Indicates if the device supports torch (flashlight) functionality |
637
+
638
+
639
+ #### GetTorchModeResponse
640
+
641
+ Response for getting the current torch mode.
642
+
643
+ | Prop | Type | Description |
644
+ | ------------- | -------------------- | -------------------------------------------------------------------------------------------- |
645
+ | **`enabled`** | <code>boolean</code> | Indicates if the torch is currently enabled |
646
+ | **`level`** | <code>number</code> | The current torch intensity level (0.0 to 1.0, iOS only). Always 1.0 on Android when enabled |
647
+
648
+
580
649
  #### PermissionStatus
581
650
 
582
651
  Response for the camera permission status.
@@ -0,0 +1,9 @@
1
+ package com.michaelwolz.capacitorcameraview
2
+
3
+ sealed class CameraError(message: String) : Exception(message) {
4
+ class TorchUnavailable : CameraError("Torch is not available on this device")
5
+ class CameraNotInitialized : CameraError("Camera controller not initialized")
6
+ class PreviewNotInitialized : CameraError("Camera preview not initialized")
7
+ class LifecycleOwnerMissing : CameraError("WebView context must be a LifecycleOwner")
8
+ class ZoomFactorOutOfRange : CameraError("The requested zoom factor is out of range.")
9
+ }
@@ -19,6 +19,7 @@ import androidx.camera.core.ImageAnalysis
19
19
  import androidx.camera.core.ImageCapture
20
20
  import androidx.camera.core.ImageCaptureException
21
21
  import androidx.camera.core.ImageProxy
22
+ import androidx.camera.core.TorchState
22
23
  import androidx.camera.core.resolutionselector.AspectRatioStrategy
23
24
  import androidx.camera.core.resolutionselector.ResolutionSelector
24
25
  import androidx.camera.mlkit.vision.MlKitAnalyzer
@@ -71,7 +72,7 @@ class CameraView(plugin: Plugin) {
71
72
  val lifecycleOwner =
72
73
  context as? LifecycleOwner
73
74
  ?: run {
74
- callback(Exception("WebView context must be a LifecycleOwner"))
75
+ callback(CameraError.LifecycleOwnerMissing())
75
76
  return
76
77
  }
77
78
 
@@ -129,16 +130,15 @@ class CameraView(plugin: Plugin) {
129
130
  callback: (JSObject?, Exception?) -> Unit
130
131
  ) {
131
132
  val startTime = System.currentTimeMillis()
132
- val controller =
133
- this.cameraController
134
- ?: run {
135
- callback(null, Exception("Camera controller not initialized"))
136
- return
137
- }
133
+ val controller = cameraController
134
+ ?: run {
135
+ callback(null, CameraError.CameraNotInitialized())
136
+ return
137
+ }
138
138
 
139
139
  val preview = previewView
140
140
  ?: run {
141
- callback(null, Exception("Camera preview not initialized"))
141
+ callback(null, CameraError.PreviewNotInitialized())
142
142
  return
143
143
  }
144
144
 
@@ -250,7 +250,7 @@ class CameraView(plugin: Plugin) {
250
250
  val previewView =
251
251
  this.previewView
252
252
  ?: run {
253
- callback(null, Exception("Camera preview not initialized"))
253
+ callback(null, CameraError.PreviewNotInitialized())
254
254
  return
255
255
  }
256
256
 
@@ -306,14 +306,16 @@ class CameraView(plugin: Plugin) {
306
306
  else -> CameraSelector.DEFAULT_FRONT_CAMERA
307
307
  }
308
308
 
309
- val controller =
310
- this.cameraController
311
- ?: run {
312
- callback(Exception("Camera controller not initialized"))
313
- return
314
- }
309
+ val controller = cameraController
310
+ ?: run {
311
+ callback(CameraError.CameraNotInitialized())
312
+ return
313
+ }
315
314
 
316
- mainHandler.post { controller.cameraSelector = currentCameraSelector }
315
+ mainHandler.post {
316
+ controller.cameraSelector = currentCameraSelector
317
+ callback(null)
318
+ }
317
319
  }
318
320
 
319
321
  /** Get the min, max, and current zoom values */
@@ -324,17 +326,16 @@ class CameraView(plugin: Plugin) {
324
326
  /** Set the zoom factor for the camera */
325
327
  fun setZoomFactor(zoomFactor: Float, callback: (((Exception?) -> Unit)?) = null) {
326
328
  mainHandler.post {
327
- val cameraControl =
328
- cameraController?.cameraControl
329
- ?: run {
330
- callback?.invoke(Exception("Camera controller not initialized"))
331
- return@post
332
- }
329
+ val cameraControl = cameraController?.cameraControl
330
+ ?: run {
331
+ callback?.invoke(CameraError.CameraNotInitialized())
332
+ return@post
333
+ }
333
334
 
334
335
  val availableZoomFactors = getZoomFactorsInternal()
335
336
 
336
337
  if (zoomFactor !in availableZoomFactors.min..availableZoomFactors.max) {
337
- callback?.invoke(Exception("The requested zoom factor is out of range."))
338
+ callback?.invoke(CameraError.ZoomFactorOutOfRange())
338
339
  return@post
339
340
  }
340
341
 
@@ -369,12 +370,11 @@ class CameraView(plugin: Plugin) {
369
370
  /** Get supported flash modes */
370
371
  fun getSupportedFlashModes(callback: (supportedFlashModes: List<String>) -> Unit) {
371
372
  mainHandler.post {
372
- val cameraInfo =
373
- cameraController?.cameraInfo
374
- ?: run {
375
- callback(listOf("off"))
376
- return@post
377
- }
373
+ val cameraInfo = cameraController?.cameraInfo
374
+ ?: run {
375
+ callback(listOf("off"))
376
+ return@post
377
+ }
378
378
 
379
379
  callback(
380
380
  if (cameraInfo.hasFlashUnit()) {
@@ -402,6 +402,56 @@ class CameraView(plugin: Plugin) {
402
402
  mainHandler.post { controller.imageCaptureFlashMode = currentFlashMode }
403
403
  }
404
404
 
405
+ /** Check if torch is available */
406
+ fun isTorchAvailable(callback: (Boolean) -> Unit) {
407
+ mainHandler.post {
408
+ val cameraInfo = cameraController?.cameraInfo
409
+ ?: run {
410
+ callback(false)
411
+ return@post
412
+ }
413
+
414
+ callback(cameraInfo.hasFlashUnit())
415
+ }
416
+ }
417
+
418
+ /** Get the current torch mode */
419
+ fun getTorchMode(callback: (Boolean) -> Unit) {
420
+ mainHandler.post {
421
+ val cameraInfo = cameraController?.cameraInfo
422
+ ?: run {
423
+ callback(false)
424
+ return@post
425
+ }
426
+
427
+ callback(cameraInfo.torchState.value == TorchState.ON)
428
+ }
429
+ }
430
+
431
+ /** Set the torch mode */
432
+ fun setTorchMode(enabled: Boolean, callback: ((Exception?) -> Unit)? = null) {
433
+ mainHandler.post {
434
+ try {
435
+ val controller = cameraController
436
+ ?: run {
437
+ callback?.invoke(CameraError.CameraNotInitialized())
438
+ return@post
439
+ }
440
+
441
+ val cameraInfo = controller.cameraInfo
442
+ if (cameraInfo?.hasFlashUnit() != true) {
443
+ callback?.invoke(CameraError.TorchUnavailable())
444
+ return@post
445
+ }
446
+
447
+ controller.cameraControl?.enableTorch(enabled)
448
+ callback?.invoke(null)
449
+ } catch (e: Exception) {
450
+ callback?.invoke(e)
451
+ }
452
+ }
453
+ }
454
+
405
455
  /** Get a list of available camera devices */
406
456
  fun getAvailableDevices(): List<CameraDevice> {
407
457
  try {
@@ -209,6 +209,46 @@ class CameraViewPlugin : Plugin() {
209
209
  }
210
210
  }
211
211
 
212
+ @PluginMethod
213
+ fun isTorchAvailable(call: PluginCall) {
214
+ implementation.isTorchAvailable { available ->
215
+ call.resolve(JSObject().apply {
216
+ put("available", available)
217
+ })
218
+ }
219
+ }
220
+
221
+ @PluginMethod
222
+ fun getTorchMode(call: PluginCall) {
223
+ implementation.getTorchMode { enabled ->
224
+ call.resolve(JSObject().apply {
225
+ put("enabled", enabled)
226
+ put(
227
+ "level",
228
+ // Android always uses full intensity when enabled
229
+ if (enabled) 1.0f else 0.0f
230
+ )
231
+ })
232
+ }
233
+ }
234
+
235
+ @PluginMethod
236
+ fun setTorchMode(call: PluginCall) {
237
+ val enabled = call.getBoolean("enabled")
238
+ if (enabled == null) {
239
+ call.reject("Enabled parameter is required")
240
+ return
241
+ }
242
+
243
+ implementation.setTorchMode(enabled) { error ->
244
+ if (error != null) {
245
+ call.reject("Failed to set torch mode: ${error.localizedMessage}", error)
246
+ } else {
247
+ call.resolve()
248
+ }
249
+ }
250
+ }
251
+
212
252
  /**
213
253
  * Called by the CameraView when a barcode is detected.
214
254
  */
package/dist/docs.json CHANGED
@@ -330,6 +330,97 @@
330
330
  ],
331
331
  "slug": "setflashmode"
332
332
  },
333
+ {
334
+ "name": "isTorchAvailable",
335
+ "signature": "() => Promise<IsTorchAvailableResponse>",
336
+ "parameters": [],
337
+ "returns": "Promise<IsTorchAvailableResponse>",
338
+ "tags": [
339
+ {
340
+ "name": "remarks",
341
+ "text": "**Important**: You must call this method and verify torch availability before using\n`setTorchMode()` or `getTorchMode()`. Calling torch methods on devices without\ntorch support will throw an exception."
342
+ },
343
+ {
344
+ "name": "returns",
345
+ "text": "A promise that resolves with an object containing torch availability status"
346
+ },
347
+ {
348
+ "name": "since",
349
+ "text": "1.2.0"
350
+ }
351
+ ],
352
+ "docs": "Check if the device supports torch (flashlight) functionality.",
353
+ "complexTypes": [
354
+ "IsTorchAvailableResponse"
355
+ ],
356
+ "slug": "istorchavailable"
357
+ },
358
+ {
359
+ "name": "getTorchMode",
360
+ "signature": "() => Promise<GetTorchModeResponse>",
361
+ "parameters": [],
362
+ "returns": "Promise<GetTorchModeResponse>",
363
+ "tags": [
364
+ {
365
+ "name": "remarks",
366
+ "text": "**Important**: Call `isTorchAvailable()` first to ensure the device supports torch\nfunctionality. This method will throw an exception if torch is not supported."
367
+ },
368
+ {
369
+ "name": "returns",
370
+ "text": "A promise that resolves with an object containing the current torch state"
371
+ },
372
+ {
373
+ "name": "since",
374
+ "text": "1.2.0"
375
+ }
376
+ ],
377
+ "docs": "Get the current torch (flashlight) state.",
378
+ "complexTypes": [
379
+ "GetTorchModeResponse"
380
+ ],
381
+ "slug": "gettorchmode"
382
+ },
383
+ {
384
+ "name": "setTorchMode",
385
+ "signature": "(options: { enabled: boolean; level?: number; }) => Promise<void>",
386
+ "parameters": [
387
+ {
388
+ "name": "options",
389
+ "docs": "- Torch configuration options",
390
+ "type": "{ enabled: boolean; level?: number | undefined; }"
391
+ }
392
+ ],
393
+ "returns": "Promise<void>",
394
+ "tags": [
395
+ {
396
+ "name": "remarks",
397
+ "text": "**Important**: Call `isTorchAvailable()` first to ensure the device supports torch\nfunctionality. This method will throw an exception if torch is not supported.\n\nThe torch provides continuous illumination, unlike flash which only activates during photo capture.\nOn iOS, you can control the torch intensity level. On Android, the torch is either on or off."
398
+ },
399
+ {
400
+ "name": "param",
401
+ "text": "options - Torch configuration options"
402
+ },
403
+ {
404
+ "name": "param",
405
+ "text": "options.enabled - Whether to enable or disable the torch"
406
+ },
407
+ {
408
+ "name": "param",
409
+ "text": "options.level - The torch intensity level (0.0 to 1.0, iOS only). Defaults to 1.0 when enabled"
410
+ },
411
+ {
412
+ "name": "returns",
413
+ "text": "A promise that resolves when the torch mode has been set"
414
+ },
415
+ {
416
+ "name": "since",
417
+ "text": "1.2.0"
418
+ }
419
+ ],
420
+ "docs": "Set the torch (flashlight) mode and intensity.",
421
+ "complexTypes": [],
422
+ "slug": "settorchmode"
423
+ },
333
424
  {
334
425
  "name": "checkPermissions",
335
426
  "signature": "() => Promise<PermissionStatus>",
@@ -760,6 +851,55 @@
760
851
  }
761
852
  ]
762
853
  },
854
+ {
855
+ "name": "IsTorchAvailableResponse",
856
+ "slug": "istorchavailableresponse",
857
+ "docs": "Response for checking torch availability.",
858
+ "tags": [
859
+ {
860
+ "text": "1.2.0",
861
+ "name": "since"
862
+ }
863
+ ],
864
+ "methods": [],
865
+ "properties": [
866
+ {
867
+ "name": "available",
868
+ "tags": [],
869
+ "docs": "Indicates if the device supports torch (flashlight) functionality",
870
+ "complexTypes": [],
871
+ "type": "boolean"
872
+ }
873
+ ]
874
+ },
875
+ {
876
+ "name": "GetTorchModeResponse",
877
+ "slug": "gettorchmoderesponse",
878
+ "docs": "Response for getting the current torch mode.",
879
+ "tags": [
880
+ {
881
+ "text": "1.2.0",
882
+ "name": "since"
883
+ }
884
+ ],
885
+ "methods": [],
886
+ "properties": [
887
+ {
888
+ "name": "enabled",
889
+ "tags": [],
890
+ "docs": "Indicates if the torch is currently enabled",
891
+ "complexTypes": [],
892
+ "type": "boolean"
893
+ },
894
+ {
895
+ "name": "level",
896
+ "tags": [],
897
+ "docs": "The current torch intensity level (0.0 to 1.0, iOS only). Always 1.0 on Android when enabled",
898
+ "complexTypes": [],
899
+ "type": "number"
900
+ }
901
+ ]
902
+ },
763
903
  {
764
904
  "name": "PermissionStatus",
765
905
  "slug": "permissionstatus",
@@ -130,6 +130,52 @@ export interface CameraViewPlugin {
130
130
  setFlashMode(options: {
131
131
  mode: FlashMode;
132
132
  }): Promise<void>;
133
+ /**
134
+ * Check if the device supports torch (flashlight) functionality.
135
+ *
136
+ * @remarks
137
+ * **Important**: You must call this method and verify torch availability before using
138
+ * `setTorchMode()` or `getTorchMode()`. Calling torch methods on devices without
139
+ * torch support will throw an exception.
140
+ *
141
+ * @returns A promise that resolves with an object containing torch availability status
142
+ *
143
+ * @since 1.2.0
144
+ */
145
+ isTorchAvailable(): Promise<IsTorchAvailableResponse>;
146
+ /**
147
+ * Get the current torch (flashlight) state.
148
+ *
149
+ * @remarks
150
+ * **Important**: Call `isTorchAvailable()` first to ensure the device supports torch
151
+ * functionality. This method will throw an exception if torch is not supported.
152
+ *
153
+ * @returns A promise that resolves with an object containing the current torch state
154
+ *
155
+ * @since 1.2.0
156
+ */
157
+ getTorchMode(): Promise<GetTorchModeResponse>;
158
+ /**
159
+ * Set the torch (flashlight) mode and intensity.
160
+ *
161
+ * @remarks
162
+ * **Important**: Call `isTorchAvailable()` first to ensure the device supports torch
163
+ * functionality. This method will throw an exception if torch is not supported.
164
+ *
165
+ * The torch provides continuous illumination, unlike flash which only activates during photo capture.
166
+ * On iOS, you can control the torch intensity level. On Android, the torch is either on or off.
167
+ *
168
+ * @param options - Torch configuration options
169
+ * @param options.enabled - Whether to enable or disable the torch
170
+ * @param options.level - The torch intensity level (0.0 to 1.0, iOS only). Defaults to 1.0 when enabled
171
+ * @returns A promise that resolves when the torch mode has been set
172
+ *
173
+ * @since 1.2.0
174
+ */
175
+ setTorchMode(options: {
176
+ enabled: boolean;
177
+ level?: number;
178
+ }): Promise<void>;
133
179
  /**
134
180
  * Check camera permission status without requesting permissions.
135
181
  *
@@ -355,6 +401,26 @@ export interface GetSupportedFlashModesResponse {
355
401
  /** An array of flash modes supported by the current camera */
356
402
  flashModes: FlashMode[];
357
403
  }
404
+ /**
405
+ * Response for checking torch availability.
406
+ *
407
+ * @since 1.2.0
408
+ */
409
+ export interface IsTorchAvailableResponse {
410
+ /** Indicates if the device supports torch (flashlight) functionality */
411
+ available: boolean;
412
+ }
413
+ /**
414
+ * Response for getting the current torch mode.
415
+ *
416
+ * @since 1.2.0
417
+ */
418
+ export interface GetTorchModeResponse {
419
+ /** Indicates if the torch is currently enabled */
420
+ enabled: boolean;
421
+ /** The current torch intensity level (0.0 to 1.0, iOS only). Always 1.0 on Android when enabled */
422
+ level: number;
423
+ }
358
424
  /**
359
425
  * Data for a detected barcode.
360
426
  *
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Main plugin interface for Capacitor Camera View functionality.\n *\n * @since 1.0.0\n */\nexport interface CameraViewPlugin {\n /**\n * Start the camera view with optional configuration.\n *\n * @param options - Configuration options for the camera session\n * @returns A promise that resolves when the camera has started\n *\n * @since 1.0.0\n */\n start(options?: CameraSessionConfiguration): Promise<void>;\n\n /**\n * Stop the camera view and release resources.\n *\n * @returns A promise that resolves when the camera has stopped\n *\n * @since 1.0.0\n */\n stop(): Promise<void>;\n\n /**\n * Check if the camera view is currently running.\n *\n * @returns A promise that resolves with an object containing the running state of the camera\n *\n * @since 1.0.0\n */\n isRunning(): Promise<IsRunningResponse>;\n\n /**\n * Capture a photo using the current camera configuration.\n *\n * @param options - Capture configuration options\n * @returns A promise that resolves with an object containing either a base64 encoded string or file path of the captured photo\n *\n * @since 1.0.0\n */\n capture<T extends CaptureOptions>(options: T): Promise<CaptureResponse<T>>;\n\n /**\n * Captures a frame from the current camera preview without using the full camera capture pipeline.\n *\n * Unlike `capture()` which may trigger hardware-level photo capture on native platforms,\n * this method quickly samples the current video stream. This is suitable computer vision or\n * simple snapshots where high fidelity is not required.\n *\n * On web this method does exactly the same as `capture()` as it only captures a frame from the video stream\n * because unfortunately [ImageCapture API](https://developer.mozilla.org/en-US/docs/Web/API/ImageCapture) is\n * not yet well supported on the web.\n *\n * @param options - Capture configuration options\n * @returns A promise that resolves with an object containing either a base64 encoded string or file path of the captured sample\n *\n * @since 1.0.0\n */\n captureSample<T extends CaptureOptions>(options: T): Promise<CaptureResponse<T>>;\n\n /**\n * Switch between front and back camera.\n *\n * @returns A promise that resolves when the camera has been flipped\n *\n * @since 1.0.0\n */\n flipCamera(): Promise<void>;\n\n /**\n * Get available camera devices for capturing photos.\n *\n * @returns A promise that resolves with an object containing an array of available capture devices\n *\n * @since 1.0.0\n */\n getAvailableDevices(): Promise<GetAvailableDevicesResponse>;\n\n /**\n * Get current zoom level information and available range.\n *\n * @remarks\n * Make sure the camera is properly initialized before calling this method. Otherwise, this might\n * lead to returning default values on android.\n *\n * @returns A promise that resolves with an object containing min, max and current zoom levels\n *\n * @since 1.0.0\n */\n getZoom(): Promise<GetZoomResponse>;\n\n /**\n * Set the camera zoom level.\n *\n * @param options - Zoom configuration options\n * @param options.level - The zoom level to set\n * @param options.ramp - Whether to animate the zoom level change, defaults to false (iOS only)\n * @returns A promise that resolves when the zoom level has been set\n *\n * @remarks\n * On web platforms, zoom functionality may be limited by browser support.\n * When native zoom is not available, a CSS-based zoom simulation is applied.\n *\n * @since 1.0.0\n */\n setZoom(options: { level: number; ramp?: boolean }): Promise<void>;\n\n /**\n * Get current flash mode setting.\n *\n * @returns A promise that resolves with an object containing the current flash mode\n *\n * @since 1.0.0\n */\n getFlashMode(): Promise<GetFlashModeResponse>;\n\n /**\n * Get supported flash modes for the current camera.\n *\n * @returns A promise that resolves with an object containing an array of supported flash modes\n *\n * @since 1.0.0\n */\n getSupportedFlashModes(): Promise<GetSupportedFlashModesResponse>;\n\n /**\n * Set the camera flash mode.\n *\n * @param options - Flash mode configuration options\n * @param options.mode - The flash mode to set\n * @returns A promise that resolves when the flash mode has been set\n *\n * @since 1.0.0\n */\n setFlashMode(options: { mode: FlashMode }): Promise<void>;\n\n /**\n * Check camera permission status without requesting permissions.\n *\n * @returns A promise that resolves with an object containing the camera permission status\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request camera permission from the user.\n *\n * @returns A promise that resolves with an object containing the camera permission status\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n\n /**\n * Listen for barcode detection events.\n * This event is emitted when a barcode is detected in the camera preview.\n *\n * @param eventName - The name of the event to listen for ('barcodeDetected')\n * @param listenerFunc - The callback function to execute when a barcode is detected\n * @returns A promise that resolves with an event subscription\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'barcodeDetected',\n listenerFunc: (data: BarcodeDetectionData) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @param eventName - Optional event name to remove listeners for\n * @returns A promise that resolves when the listeners are removed\n *\n * @since 1.0.0\n */\n removeAllListeners(eventName?: string): Promise<void>;\n}\n\n// ------------------------------------------------------------------------------\n// Camera Configuration Types\n// ------------------------------------------------------------------------------\n\n/**\n * Position options for the camera.\n * - 'front': Front-facing camera\n * - 'back': Rear-facing camera\n *\n * @since 1.0.0\n */\nexport type CameraPosition = 'front' | 'back';\n\n/**\n * Flash mode options for the camera.\n * - 'off': Flash disabled\n * - 'on': Flash always on\n * - 'auto': Flash automatically enabled in low-light conditions\n *\n * @since 1.0.0\n */\nexport type FlashMode = 'off' | 'on' | 'auto';\n\n/**\n * Represents a physical camera device on the device.\n *\n * @since 1.0.0\n */\nexport interface CameraDevice {\n /** The unique identifier of the camera device */\n id: string;\n\n /** The human-readable name of the camera device */\n name: string;\n\n /** The position of the camera device (front or back) */\n position: CameraPosition;\n\n /** The type of the camera device (e.g., wide, ultra-wide, telephoto) - iOS only */\n deviceType?: CameraDeviceType;\n}\n\n/**\n * Available camera device types for iOS.\n * Maps to AVCaptureDevice DeviceTypes in iOS.\n *\n * @see https://developer.apple.com/documentation/avfoundation/avcapturedevice/devicetype-swift.struct\n *\n * @since 1.0.0\n */\nexport type CameraDeviceType =\n /** builtInWideAngleCamera - standard camera */\n | 'wideAngle'\n /** builtInUltraWideCamera - 0.5x zoom level */\n | 'ultraWide'\n /** builtInTelephotoCamera - 2x/3x zoom level */\n | 'telephoto'\n /** builtInDualCamera - wide + telephoto combination */\n | 'dual'\n /** builtInDualWideCamera - wide + ultraWide combination */\n | 'dualWide'\n /** builtInTripleCamera - wide + ultraWide + telephoto */\n | 'triple'\n /** builtInTrueDepthCamera - front-facing camera with depth sensing */\n | 'trueDepth';\n\n/**\n * Configuration options for starting a camera session.\n *\n * @since 1.0.0\n */\nexport interface CameraSessionConfiguration {\n /**\n * Enables the barcode detection functionality\n * @default false\n */\n enableBarcodeDetection?: boolean;\n\n /**\n * Position of the camera to use\n * @default 'back'\n */\n position?: CameraPosition;\n\n /**\n * Specific device ID of the camera to use\n * If provided, takes precedence over position\n */\n deviceId?: string;\n\n /**\n * Whether to use the triple camera if available (iPhone Pro models only)\n * @default false\n */\n useTripleCameraIfAvailable?: boolean;\n\n /**\n * Ordered list of preferred camera device types to use (iOS only).\n * The system will attempt to use the first available camera type in the list.\n * If position is also provided, the system will use the first available camera type\n * that matches the position and is in the list.\n *\n * This will fallback to the default camera type if none of the preferred types are available.\n *\n * @example [CameraDeviceType.WideAngle, CameraDeviceType.UltraWide, CameraDeviceType.Telephoto]\n * @default undefined - system will decide based on position/deviceId\n */\n preferredCameraDeviceTypes?: CameraDeviceType[];\n\n /**\n * The initial zoom factor to use\n * @default 1.0\n */\n zoomFactor?: number;\n\n /**\n * Optional HTML ID of the container element where the camera view should be rendered.\n * If not provided, the camera view will be appended to the document body. Web only.\n * @example 'cameraContainer'\n */\n containerElementId?: string;\n}\n\n/**\n * Configuration options for capturing photos and samples.\n *\n * @since 1.1.0\n */\nexport interface CaptureOptions {\n /**\n * The JPEG quality of the captured photo/sample on a scale of 0-100\n * @since 1.1.0\n */\n quality: number;\n\n /**\n * If true, saves to a temporary file and returns the web path instead of base64.\n * The web path can be used to set the src attribute of an image for efficient loading and rendering.\n * This reduces the data that needs to be transferred over the bridge, which can improve performance\n * especially for high-resolution images.\n * @default false\n * @since 1.1.0\n */\n saveToFile?: boolean;\n}\n\n// ------------------------------------------------------------------------------\n// Response Interfaces\n// ------------------------------------------------------------------------------\n\n/**\n * Response for checking if the camera view is running.\n *\n * @since 1.0.0\n */\nexport interface IsRunningResponse {\n /** Indicates if the camera view is currently active and running */\n isRunning: boolean;\n}\n\n/**\n * Response for capturing a photo\n * This will contain either a base64 encoded string or a web path to the captured photo,\n * depending on the `saveToFile` option in the CaptureOptions.\n * @since 1.0.0\n */\nexport type CaptureResponse<T extends CaptureOptions = CaptureOptions> = T['saveToFile'] extends true\n ? {\n /** The web path to the captured photo that can be used to set the src attribute of an image for efficient loading and rendering (when saveToFile is true) */\n webPath: string;\n }\n : {\n /** The base64 encoded string of the captured photo (when saveToFile is false or undefined) */\n photo: string;\n };\n\n/**\n * Response for getting available camera devices.\n *\n * @since 1.0.0\n */\nexport interface GetAvailableDevicesResponse {\n /** An array of available camera devices */\n devices: CameraDevice[];\n}\n\n/**\n * Response for getting zoom level information.\n *\n * @since 1.0.0\n */\nexport interface GetZoomResponse {\n /** The minimum zoom level supported */\n min: number;\n\n /** The maximum zoom level supported */\n max: number;\n\n /** The current zoom level */\n current: number;\n}\n\n/**\n * Response for getting the current flash mode.\n *\n * @since 1.0.0\n */\nexport interface GetFlashModeResponse {\n /** The current flash mode setting */\n flashMode: FlashMode;\n}\n\n/**\n * Response for getting supported flash modes.\n *\n * @since 1.0.0\n */\nexport interface GetSupportedFlashModesResponse {\n /** An array of flash modes supported by the current camera */\n flashModes: FlashMode[];\n}\n\n/**\n * Data for a detected barcode.\n *\n * @since 1.0.0\n */\nexport interface BarcodeDetectionData {\n /** The decoded string value of the barcode */\n value: string;\n\n /** The display value of the barcode (may differ from the raw value) */\n displayValue?: string;\n\n /** The type/format of the barcode (e.g., 'qr', 'code128', etc.) */\n type: string;\n\n /** The bounding rectangle of the barcode in the camera frame. */\n boundingRect: BoundingRect;\n}\n\n/**\n * Rectangle defining the boundary of the barcode in the camera frame.\n * Coordinates are normalized between 0 and 1 relative to the camera frame.\n *\n * @since 1.0.0\n */\nexport interface BoundingRect {\n /** X-coordinate of the top-left corner */\n x: number;\n /** Y-coordinate of the top-left corner */\n y: number;\n /** Width of the bounding rectangle (should match the actual width of the barcode) */\n width: number;\n /** Height of the bounding rectangle (should match the actual height of the barcode) */\n height: number;\n}\n\n/**\n * Response for the camera permission status.\n *\n * @since 1.0.0\n */\nexport interface PermissionStatus {\n /** The state of the camera permission */\n camera: PermissionState;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Main plugin interface for Capacitor Camera View functionality.\n *\n * @since 1.0.0\n */\nexport interface CameraViewPlugin {\n /**\n * Start the camera view with optional configuration.\n *\n * @param options - Configuration options for the camera session\n * @returns A promise that resolves when the camera has started\n *\n * @since 1.0.0\n */\n start(options?: CameraSessionConfiguration): Promise<void>;\n\n /**\n * Stop the camera view and release resources.\n *\n * @returns A promise that resolves when the camera has stopped\n *\n * @since 1.0.0\n */\n stop(): Promise<void>;\n\n /**\n * Check if the camera view is currently running.\n *\n * @returns A promise that resolves with an object containing the running state of the camera\n *\n * @since 1.0.0\n */\n isRunning(): Promise<IsRunningResponse>;\n\n /**\n * Capture a photo using the current camera configuration.\n *\n * @param options - Capture configuration options\n * @returns A promise that resolves with an object containing either a base64 encoded string or file path of the captured photo\n *\n * @since 1.0.0\n */\n capture<T extends CaptureOptions>(options: T): Promise<CaptureResponse<T>>;\n\n /**\n * Captures a frame from the current camera preview without using the full camera capture pipeline.\n *\n * Unlike `capture()` which may trigger hardware-level photo capture on native platforms,\n * this method quickly samples the current video stream. This is suitable computer vision or\n * simple snapshots where high fidelity is not required.\n *\n * On web this method does exactly the same as `capture()` as it only captures a frame from the video stream\n * because unfortunately [ImageCapture API](https://developer.mozilla.org/en-US/docs/Web/API/ImageCapture) is\n * not yet well supported on the web.\n *\n * @param options - Capture configuration options\n * @returns A promise that resolves with an object containing either a base64 encoded string or file path of the captured sample\n *\n * @since 1.0.0\n */\n captureSample<T extends CaptureOptions>(options: T): Promise<CaptureResponse<T>>;\n\n /**\n * Switch between front and back camera.\n *\n * @returns A promise that resolves when the camera has been flipped\n *\n * @since 1.0.0\n */\n flipCamera(): Promise<void>;\n\n /**\n * Get available camera devices for capturing photos.\n *\n * @returns A promise that resolves with an object containing an array of available capture devices\n *\n * @since 1.0.0\n */\n getAvailableDevices(): Promise<GetAvailableDevicesResponse>;\n\n /**\n * Get current zoom level information and available range.\n *\n * @remarks\n * Make sure the camera is properly initialized before calling this method. Otherwise, this might\n * lead to returning default values on android.\n *\n * @returns A promise that resolves with an object containing min, max and current zoom levels\n *\n * @since 1.0.0\n */\n getZoom(): Promise<GetZoomResponse>;\n\n /**\n * Set the camera zoom level.\n *\n * @param options - Zoom configuration options\n * @param options.level - The zoom level to set\n * @param options.ramp - Whether to animate the zoom level change, defaults to false (iOS only)\n * @returns A promise that resolves when the zoom level has been set\n *\n * @remarks\n * On web platforms, zoom functionality may be limited by browser support.\n * When native zoom is not available, a CSS-based zoom simulation is applied.\n *\n * @since 1.0.0\n */\n setZoom(options: { level: number; ramp?: boolean }): Promise<void>;\n\n /**\n * Get current flash mode setting.\n *\n * @returns A promise that resolves with an object containing the current flash mode\n *\n * @since 1.0.0\n */\n getFlashMode(): Promise<GetFlashModeResponse>;\n\n /**\n * Get supported flash modes for the current camera.\n *\n * @returns A promise that resolves with an object containing an array of supported flash modes\n *\n * @since 1.0.0\n */\n getSupportedFlashModes(): Promise<GetSupportedFlashModesResponse>;\n\n /**\n * Set the camera flash mode.\n *\n * @param options - Flash mode configuration options\n * @param options.mode - The flash mode to set\n * @returns A promise that resolves when the flash mode has been set\n *\n * @since 1.0.0\n */\n setFlashMode(options: { mode: FlashMode }): Promise<void>;\n\n /**\n * Check if the device supports torch (flashlight) functionality.\n *\n * @remarks\n * **Important**: You must call this method and verify torch availability before using\n * `setTorchMode()` or `getTorchMode()`. Calling torch methods on devices without\n * torch support will throw an exception.\n *\n * @returns A promise that resolves with an object containing torch availability status\n *\n * @since 1.2.0\n */\n isTorchAvailable(): Promise<IsTorchAvailableResponse>;\n\n /**\n * Get the current torch (flashlight) state.\n *\n * @remarks\n * **Important**: Call `isTorchAvailable()` first to ensure the device supports torch\n * functionality. This method will throw an exception if torch is not supported.\n *\n * @returns A promise that resolves with an object containing the current torch state\n *\n * @since 1.2.0\n */\n getTorchMode(): Promise<GetTorchModeResponse>;\n\n /**\n * Set the torch (flashlight) mode and intensity.\n *\n * @remarks\n * **Important**: Call `isTorchAvailable()` first to ensure the device supports torch\n * functionality. This method will throw an exception if torch is not supported.\n *\n * The torch provides continuous illumination, unlike flash which only activates during photo capture.\n * On iOS, you can control the torch intensity level. On Android, the torch is either on or off.\n *\n * @param options - Torch configuration options\n * @param options.enabled - Whether to enable or disable the torch\n * @param options.level - The torch intensity level (0.0 to 1.0, iOS only). Defaults to 1.0 when enabled\n * @returns A promise that resolves when the torch mode has been set\n *\n * @since 1.2.0\n */\n setTorchMode(options: { enabled: boolean; level?: number }): Promise<void>;\n\n /**\n * Check camera permission status without requesting permissions.\n *\n * @returns A promise that resolves with an object containing the camera permission status\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request camera permission from the user.\n *\n * @returns A promise that resolves with an object containing the camera permission status\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n\n /**\n * Listen for barcode detection events.\n * This event is emitted when a barcode is detected in the camera preview.\n *\n * @param eventName - The name of the event to listen for ('barcodeDetected')\n * @param listenerFunc - The callback function to execute when a barcode is detected\n * @returns A promise that resolves with an event subscription\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'barcodeDetected',\n listenerFunc: (data: BarcodeDetectionData) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @param eventName - Optional event name to remove listeners for\n * @returns A promise that resolves when the listeners are removed\n *\n * @since 1.0.0\n */\n removeAllListeners(eventName?: string): Promise<void>;\n}\n\n// ------------------------------------------------------------------------------\n// Camera Configuration Types\n// ------------------------------------------------------------------------------\n\n/**\n * Position options for the camera.\n * - 'front': Front-facing camera\n * - 'back': Rear-facing camera\n *\n * @since 1.0.0\n */\nexport type CameraPosition = 'front' | 'back';\n\n/**\n * Flash mode options for the camera.\n * - 'off': Flash disabled\n * - 'on': Flash always on\n * - 'auto': Flash automatically enabled in low-light conditions\n *\n * @since 1.0.0\n */\nexport type FlashMode = 'off' | 'on' | 'auto';\n\n/**\n * Represents a physical camera device on the device.\n *\n * @since 1.0.0\n */\nexport interface CameraDevice {\n /** The unique identifier of the camera device */\n id: string;\n\n /** The human-readable name of the camera device */\n name: string;\n\n /** The position of the camera device (front or back) */\n position: CameraPosition;\n\n /** The type of the camera device (e.g., wide, ultra-wide, telephoto) - iOS only */\n deviceType?: CameraDeviceType;\n}\n\n/**\n * Available camera device types for iOS.\n * Maps to AVCaptureDevice DeviceTypes in iOS.\n *\n * @see https://developer.apple.com/documentation/avfoundation/avcapturedevice/devicetype-swift.struct\n *\n * @since 1.0.0\n */\nexport type CameraDeviceType =\n /** builtInWideAngleCamera - standard camera */\n | 'wideAngle'\n /** builtInUltraWideCamera - 0.5x zoom level */\n | 'ultraWide'\n /** builtInTelephotoCamera - 2x/3x zoom level */\n | 'telephoto'\n /** builtInDualCamera - wide + telephoto combination */\n | 'dual'\n /** builtInDualWideCamera - wide + ultraWide combination */\n | 'dualWide'\n /** builtInTripleCamera - wide + ultraWide + telephoto */\n | 'triple'\n /** builtInTrueDepthCamera - front-facing camera with depth sensing */\n | 'trueDepth';\n\n/**\n * Configuration options for starting a camera session.\n *\n * @since 1.0.0\n */\nexport interface CameraSessionConfiguration {\n /**\n * Enables the barcode detection functionality\n * @default false\n */\n enableBarcodeDetection?: boolean;\n\n /**\n * Position of the camera to use\n * @default 'back'\n */\n position?: CameraPosition;\n\n /**\n * Specific device ID of the camera to use\n * If provided, takes precedence over position\n */\n deviceId?: string;\n\n /**\n * Whether to use the triple camera if available (iPhone Pro models only)\n * @default false\n */\n useTripleCameraIfAvailable?: boolean;\n\n /**\n * Ordered list of preferred camera device types to use (iOS only).\n * The system will attempt to use the first available camera type in the list.\n * If position is also provided, the system will use the first available camera type\n * that matches the position and is in the list.\n *\n * This will fallback to the default camera type if none of the preferred types are available.\n *\n * @example [CameraDeviceType.WideAngle, CameraDeviceType.UltraWide, CameraDeviceType.Telephoto]\n * @default undefined - system will decide based on position/deviceId\n */\n preferredCameraDeviceTypes?: CameraDeviceType[];\n\n /**\n * The initial zoom factor to use\n * @default 1.0\n */\n zoomFactor?: number;\n\n /**\n * Optional HTML ID of the container element where the camera view should be rendered.\n * If not provided, the camera view will be appended to the document body. Web only.\n * @example 'cameraContainer'\n */\n containerElementId?: string;\n}\n\n/**\n * Configuration options for capturing photos and samples.\n *\n * @since 1.1.0\n */\nexport interface CaptureOptions {\n /**\n * The JPEG quality of the captured photo/sample on a scale of 0-100\n * @since 1.1.0\n */\n quality: number;\n\n /**\n * If true, saves to a temporary file and returns the web path instead of base64.\n * The web path can be used to set the src attribute of an image for efficient loading and rendering.\n * This reduces the data that needs to be transferred over the bridge, which can improve performance\n * especially for high-resolution images.\n * @default false\n * @since 1.1.0\n */\n saveToFile?: boolean;\n}\n\n// ------------------------------------------------------------------------------\n// Response Interfaces\n// ------------------------------------------------------------------------------\n\n/**\n * Response for checking if the camera view is running.\n *\n * @since 1.0.0\n */\nexport interface IsRunningResponse {\n /** Indicates if the camera view is currently active and running */\n isRunning: boolean;\n}\n\n/**\n * Response for capturing a photo\n * This will contain either a base64 encoded string or a web path to the captured photo,\n * depending on the `saveToFile` option in the CaptureOptions.\n * @since 1.0.0\n */\nexport type CaptureResponse<T extends CaptureOptions = CaptureOptions> = T['saveToFile'] extends true\n ? {\n /** The web path to the captured photo that can be used to set the src attribute of an image for efficient loading and rendering (when saveToFile is true) */\n webPath: string;\n }\n : {\n /** The base64 encoded string of the captured photo (when saveToFile is false or undefined) */\n photo: string;\n };\n\n/**\n * Response for getting available camera devices.\n *\n * @since 1.0.0\n */\nexport interface GetAvailableDevicesResponse {\n /** An array of available camera devices */\n devices: CameraDevice[];\n}\n\n/**\n * Response for getting zoom level information.\n *\n * @since 1.0.0\n */\nexport interface GetZoomResponse {\n /** The minimum zoom level supported */\n min: number;\n\n /** The maximum zoom level supported */\n max: number;\n\n /** The current zoom level */\n current: number;\n}\n\n/**\n * Response for getting the current flash mode.\n *\n * @since 1.0.0\n */\nexport interface GetFlashModeResponse {\n /** The current flash mode setting */\n flashMode: FlashMode;\n}\n\n/**\n * Response for getting supported flash modes.\n *\n * @since 1.0.0\n */\nexport interface GetSupportedFlashModesResponse {\n /** An array of flash modes supported by the current camera */\n flashModes: FlashMode[];\n}\n\n/**\n * Response for checking torch availability.\n *\n * @since 1.2.0\n */\nexport interface IsTorchAvailableResponse {\n /** Indicates if the device supports torch (flashlight) functionality */\n available: boolean;\n}\n\n/**\n * Response for getting the current torch mode.\n *\n * @since 1.2.0\n */\nexport interface GetTorchModeResponse {\n /** Indicates if the torch is currently enabled */\n enabled: boolean;\n /** The current torch intensity level (0.0 to 1.0, iOS only). Always 1.0 on Android when enabled */\n level: number;\n}\n\n/**\n * Data for a detected barcode.\n *\n * @since 1.0.0\n */\nexport interface BarcodeDetectionData {\n /** The decoded string value of the barcode */\n value: string;\n\n /** The display value of the barcode (may differ from the raw value) */\n displayValue?: string;\n\n /** The type/format of the barcode (e.g., 'qr', 'code128', etc.) */\n type: string;\n\n /** The bounding rectangle of the barcode in the camera frame. */\n boundingRect: BoundingRect;\n}\n\n/**\n * Rectangle defining the boundary of the barcode in the camera frame.\n * Coordinates are normalized between 0 and 1 relative to the camera frame.\n *\n * @since 1.0.0\n */\nexport interface BoundingRect {\n /** X-coordinate of the top-left corner */\n x: number;\n /** Y-coordinate of the top-left corner */\n y: number;\n /** Width of the bounding rectangle (should match the actual width of the barcode) */\n width: number;\n /** Height of the bounding rectangle (should match the actual height of the barcode) */\n height: number;\n}\n\n/**\n * Response for the camera permission status.\n *\n * @since 1.0.0\n */\nexport interface PermissionStatus {\n /** The state of the camera permission */\n camera: PermissionState;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { CameraSessionConfiguration, CameraViewPlugin, GetAvailableDevicesResponse, GetFlashModeResponse, GetSupportedFlashModesResponse, GetZoomResponse, IsRunningResponse, PermissionStatus, CaptureResponse, FlashMode, CaptureOptions } from './definitions';
2
+ import type { CameraSessionConfiguration, CameraViewPlugin, GetAvailableDevicesResponse, GetFlashModeResponse, GetSupportedFlashModesResponse, GetTorchModeResponse, GetZoomResponse, IsTorchAvailableResponse, IsRunningResponse, PermissionStatus, CaptureResponse, FlashMode, CaptureOptions } from './definitions';
3
3
  /**
4
4
  * Web implementation of the CameraViewPlugin.
5
5
  * Optimized for performance and battery efficiency.
@@ -69,6 +69,18 @@ export declare class CameraViewWeb extends WebPlugin implements CameraViewPlugin
69
69
  setFlashMode(options: {
70
70
  mode: FlashMode;
71
71
  }): Promise<void>;
72
+ /**
73
+ * Check if torch is available (not supported in web)
74
+ */
75
+ isTorchAvailable(): Promise<IsTorchAvailableResponse>;
76
+ /**
77
+ * Get torch mode (not supported in web)
78
+ */
79
+ getTorchMode(): Promise<GetTorchModeResponse>;
80
+ /**
81
+ * Set torch mode (not supported in web)
82
+ */
83
+ setTorchMode(): Promise<void>;
72
84
  /**
73
85
  * Check camera permission without requesting
74
86
  */