@capacitor/camera 8.1.0-test.20260402.2 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}',
14
14
  s.ios.deployment_target = '15.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'IONCameraLib', spec='~> 0.1.2'
16
+ s.dependency 'IONCameraLib', spec='~> 1.0.0'
17
17
  s.swift_version = '5.1'
18
18
  end
package/Package.swift CHANGED
@@ -11,7 +11,7 @@ let package = Package(
11
11
  ],
12
12
  dependencies: [
13
13
  .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
14
- .package(url: "https://github.com/ionic-team/ion-ios-camera.git", branch: "fix/editable") // TODO extra: revert to main before merging PR; TODO: update to a stable release when available
14
+ .package(url: "https://github.com/ionic-team/ion-ios-camera.git", from: "1.0.0")
15
15
  ],
16
16
  targets: [
17
17
  .target(
package/README.md CHANGED
@@ -42,7 +42,7 @@ Older devices and Android Go devices running Android 11 or 12 that support Googl
42
42
  </service>
43
43
  ```
44
44
 
45
- If that entry is not added, the devices that don't support the Photo Picker, the Photo Picker component fallbacks to `Intent.ACTION_OPEN_DOCUMENT`.
45
+ If that entry is not added, on devices that don't support the Photo Picker, the Photo Picker component falls back to `Intent.ACTION_OPEN_DOCUMENT`.
46
46
 
47
47
  The Camera plugin requires no permissions, unless using `saveToGallery: true`, in that case the following permissions should be added to your `AndroidManifest.xml`:
48
48
 
@@ -73,31 +73,351 @@ This plugin will use the following project variables (defined in your app's `var
73
73
 
74
74
  ## PWA Notes
75
75
 
76
- [PWA Elements](https://capacitorjs.com/docs/web/pwa-elements) are required for Camera plugin to work.
76
+ On Web, `takePhoto` can use the [PWA Elements](https://capacitorjs.com/docs/web/pwa-elements) `pwa-camera-modal` custom element to provide a native-like camera UI. If the element is not registered, the plugin falls back to an `<input type="file">` picker. `chooseFromGallery` always uses `<input type="file">` on Web, regardless of whether PWA Elements are installed.
77
77
 
78
- ## Example
78
+ ### Installing PWA Elements programmatically
79
+
80
+ See the [PWA Elements installation guide](https://capacitorjs.com/docs/web/pwa-elements#installation) for full instructions.
81
+
82
+ ### Providing a custom camera element
83
+
84
+ Instead of using `@ionic/pwa-elements`, you can register your own `pwa-camera-modal` custom element. The plugin interacts with it using the following interface:
85
+
86
+ | Member | Type | Description |
87
+ |---|---|---|
88
+ | `facingMode` | `string` property | Set to `'user'` (front camera) or `'environment'` (rear camera) before presenting |
89
+ | `componentOnReady()` | method → `Promise<void>` | Called by the plugin after creating the element; resolve when the element is ready |
90
+ | `present()` | method | Called by the plugin to display the camera UI |
91
+ | `dismiss()` | method | Called by the plugin to close the camera UI after a photo is taken or cancelled |
92
+ | `onPhoto` | event | Dispatched when the user takes a photo or cancels. `event.detail` must be a `Blob` (photo taken), `null` (user cancelled), or an `Error` (something went wrong) |
93
+
94
+ ```typescript
95
+ class MyCameraModal extends HTMLElement {
96
+ facingMode = 'environment';
97
+
98
+ componentOnReady() {
99
+ return Promise.resolve();
100
+ }
101
+
102
+ present() {
103
+ // Show your custom camera UI, then dispatch exactly one 'onPhoto' event when done:
104
+ // - Blob: user took a photo
105
+ // - null: user cancelled
106
+ // - Error: something went wrong
107
+ // Example:
108
+ this.dispatchEvent(new CustomEvent('onPhoto', { detail: photoBlob }));
109
+ }
110
+
111
+ dismiss() {
112
+ // Hide your custom camera UI (called by the plugin after receiving 'onPhoto')
113
+ }
114
+ }
115
+
116
+ customElements.define('pwa-camera-modal', MyCameraModal);
117
+ ```
118
+
119
+ ## Examples
120
+
121
+ ### Taking a photo
79
122
 
80
123
  ```typescript
81
- import { Camera, CameraResultType } from '@capacitor/camera';
124
+ import { Camera } from '@capacitor/camera';
82
125
 
83
126
  const takePicture = async () => {
84
- const image = await Camera.getPhoto({
85
- quality: 90,
86
- allowEditing: true,
87
- resultType: CameraResultType.Uri
88
- });
89
-
90
- // image.webPath will contain a path that can be set as an image src.
91
- // You can access the original file using image.path, which can be
92
- // passed to the Filesystem API to read the raw data of the image,
93
- // if desired (or pass resultType: CameraResultType.Base64 to getPhoto)
94
- var imageUrl = image.webPath;
95
-
96
- // Can be set to the src of an image now
97
- imageElement.src = imageUrl;
127
+ try {
128
+ const result = await Camera.takePhoto({
129
+ quality: 90,
130
+ includeMetadata: true,
131
+ });
132
+
133
+ // result.webPath can be set directly as the src of an image element
134
+ imageElement.src = result.webPath;
135
+
136
+ // On native: pass result.uri to the Filesystem API to get the full-resolution base64,
137
+ // or use result.thumbnail for a lower-resolution base64 preview.
138
+ // On Web: result.thumbnail contains the full image base64 encoded.
139
+
140
+ console.log('Format:', result.metadata?.format);
141
+ console.log('Resolution:', result.metadata?.resolution);
142
+ } catch (e) {
143
+ const error = e as any;
144
+ // error.code contains the structured error code (e.g. 'OS-PLUG-CAMR-0003')
145
+ // when thrown by the native layer. See the Errors section for all codes.
146
+ const message = error.code ? `[${error.code}] ${error.message}` : error.message;
147
+ console.error('takePhoto failed:', message);
148
+ }
149
+ };
150
+ ```
151
+
152
+ ### Choosing from the gallery
153
+
154
+ ```typescript
155
+ import { Camera, MediaTypeSelection } from '@capacitor/camera';
156
+
157
+ const pickMedia = async () => {
158
+ try {
159
+ const { results } = await Camera.chooseFromGallery({
160
+ mediaType: MediaTypeSelection.All, // photos, videos, or both
161
+ allowMultipleSelection: true,
162
+ limit: 5,
163
+ includeMetadata: true,
164
+ });
165
+
166
+ for (const item of results) {
167
+ console.log('Type:', item.type); // MediaType.Photo or MediaType.Video
168
+ console.log('webPath:', item.webPath);
169
+ console.log('Format:', item.metadata?.format);
170
+ console.log('Size:', item.metadata?.size);
171
+ }
172
+ } catch (e) {
173
+ const error = e as any;
174
+ const message = error.code ? `[${error.code}] ${error.message}` : error.message;
175
+ console.error('chooseFromGallery failed:', message);
176
+ }
177
+ };
178
+ ```
179
+
180
+ ### Recording and playing a video
181
+
182
+ ```typescript
183
+ import { Camera } from '@capacitor/camera';
184
+
185
+ const recordAndPlay = async () => {
186
+ let videoUri: string | undefined;
187
+
188
+ try {
189
+ const result = await Camera.recordVideo({
190
+ saveToGallery: false,
191
+ isPersistent: true, // keep the file available across app launches
192
+ includeMetadata: true,
193
+ });
194
+
195
+ videoUri = result.uri;
196
+ console.log('Duration:', result.metadata?.duration);
197
+ console.log('Saved to gallery:', result.saved);
198
+ } catch (e) {
199
+ const error = e as any;
200
+ const message = error.code ? `[${error.code}] ${error.message}` : error.message;
201
+ console.error('recordVideo failed:', message);
202
+ return;
203
+ }
204
+
205
+ if (videoUri) {
206
+ try {
207
+ await Camera.playVideo({ uri: videoUri });
208
+ } catch (e) {
209
+ const error = e as any;
210
+ const message = error.code ? `[${error.code}] ${error.message}` : error.message;
211
+ console.error('playVideo failed:', message);
212
+ }
213
+ }
98
214
  };
99
215
  ```
100
216
 
217
+ ### Editing a photo from a base64 string
218
+
219
+ `editPhoto` opens an in-app editor from a base64-encoded image and returns the edited image as a base64 string in `outputImage`.
220
+
221
+ ```typescript
222
+ import { Camera } from '@capacitor/camera';
223
+
224
+ const editFromBase64 = async (base64Image: string) => {
225
+ try {
226
+ const { outputImage } = await Camera.editPhoto({
227
+ inputImage: base64Image, // raw base64, no data URL prefix
228
+ });
229
+
230
+ // outputImage is the edited image, base64 encoded
231
+ imageElement.src = `data:image/jpeg;base64,${outputImage}`;
232
+ } catch (e) {
233
+ const error = e as any;
234
+ const message = error.code ? `[${error.code}] ${error.message}` : error.message;
235
+ console.error('editPhoto failed:', message);
236
+ }
237
+ };
238
+ ```
239
+
240
+ ### Editing a photo from a URI
241
+
242
+ `editURIPhoto` opens an in-app editor from a file URI (e.g. from `takePhoto` or the Filesystem API) and returns a `MediaResult`.
243
+
244
+ ```typescript
245
+ import { Camera } from '@capacitor/camera';
246
+
247
+ const editFromURI = async (uri: string) => {
248
+ try {
249
+ const result = await Camera.editURIPhoto({
250
+ uri,
251
+ saveToGallery: false,
252
+ includeMetadata: true,
253
+ });
254
+
255
+ // result.webPath can be used directly as an image src
256
+ imageElement.src = result.webPath;
257
+
258
+ console.log('Format:', result.metadata?.format);
259
+ console.log('Size:', result.metadata?.size);
260
+ console.log('Saved to gallery:', result.saved);
261
+ } catch (e) {
262
+ const error = e as any;
263
+ const message = error.code ? `[${error.code}] ${error.message}` : error.message;
264
+ console.error('editURIPhoto failed:', message);
265
+ }
266
+ };
267
+ ```
268
+
269
+ ## Migrating to the New API
270
+
271
+ Version 8.1.0 introduces a new improved API and deprecates `getPhoto` and `pickImages`.
272
+
273
+ ### Replacing `getPhoto`
274
+
275
+ `getPhoto` handled three sources via `CameraSource`: `Camera`, `Photos`, and `Prompt`. `Camera` and `Photos` now map to different methods, while `Prompt` was removed.
276
+
277
+ #### `CameraSource.Camera` to `takePhoto`
278
+
279
+ `CameraResultType.Base64` and `CameraResultType.DataUrl` are not supported in the new API. See [Result type changes](#result-type-changes) for alternatives.
280
+
281
+ ```typescript
282
+ // Before
283
+ const photo = await Camera.getPhoto({
284
+ source: CameraSource.Camera,
285
+ quality: 90,
286
+ allowEditing: true,
287
+ resultType: CameraResultType.Uri,
288
+ direction: CameraDirection.Rear,
289
+ width: 1280,
290
+ height: 720,
291
+ });
292
+ const imageUrl = photo.webPath;
293
+
294
+ // After
295
+ const result = await Camera.takePhoto({
296
+ quality: 90,
297
+ editable: 'in-app', // replaces allowEditing: true
298
+ cameraDirection: CameraDirection.Rear, // replaces direction
299
+ targetWidth: 1280, // replaces width (1)
300
+ targetHeight: 720, // replaces height (1)
301
+ });
302
+ const imageUrl = result.webPath;
303
+ ```
304
+
305
+ **(1)** `width`/`height` each worked independently and set a maximum dimension while preserving aspect ratio. `targetWidth`/`targetHeight` must be used together — setting only one has no effect.
306
+
307
+ #### `CameraSource.Photos` to `chooseFromGallery`
308
+
309
+ ```typescript
310
+ // Before
311
+ const photo = await Camera.getPhoto({
312
+ source: CameraSource.Photos,
313
+ quality: 90,
314
+ resultType: CameraResultType.Uri,
315
+ });
316
+ const imageUrl = photo.webPath;
317
+
318
+ // After
319
+ const { results } = await Camera.chooseFromGallery({
320
+ quality: 90,
321
+ });
322
+ const imageUrl = results[0].webPath;
323
+ ```
324
+
325
+ #### `CameraSource.Prompt` (or default)
326
+
327
+ `getPhoto` previously displayed a native prompt letting the user choose between the camera and the gallery. This prompt is no longer part of the plugin. You should build the prompt using your own UI (for example, with `@capacitor/action-sheet`) and then call `takePhoto` or `chooseFromGallery` based on the user's selection.
328
+
329
+ ```typescript
330
+ // Before
331
+ const photo = await Camera.getPhoto({
332
+ // source defaults to CameraSource.Prompt
333
+ quality: 90,
334
+ resultType: CameraResultType.Uri,
335
+ });
336
+
337
+ // After: show your own UI to determine the source, then call the appropriate method
338
+ const result = await Camera.takePhoto({ quality: 90 });
339
+ // or
340
+ const { results } = await Camera.chooseFromGallery({ quality: 90 });
341
+ ```
342
+
343
+ #### Result type changes
344
+
345
+ `getPhoto` returned a `Photo` object where the fields available depended on `resultType`. The new API removes `resultType` entirely — `MediaResult` has a fixed set of fields regardless of how the photo was taken.
346
+
347
+ | `Photo` field | `MediaResult` equivalent |
348
+ |---|---|
349
+ | `path` | `uri` |
350
+ | `webPath` | `webPath` |
351
+ | `base64String` | `thumbnail` (on Web, contains the full image base64 encoded; on native, contains a thumbnail) |
352
+ | `dataUrl` | No direct equivalent — see note below |
353
+ | `saved` | `saved` |
354
+ | `format` | `metadata.format` (requires `includeMetadata: true`) |
355
+ | `exif` | `metadata.exif` (requires `includeMetadata: true`) |
356
+
357
+ **Constructing a data URL** — two options are available depending on your needs:
358
+
359
+ On all platforms, you can combine `thumbnail` and `metadata.format` (requires `includeMetadata: true`). On native, `thumbnail` is lower-resolution:
360
+
361
+ ```typescript
362
+ const dataUrl = `data:image/${result.metadata.format};base64,${result.thumbnail}`;
363
+ ```
364
+
365
+ On native, if you need the full-resolution base64, read `uri` via the Filesystem API and construct the data URL from there:
366
+
367
+ ```typescript
368
+ import { Filesystem } from '@capacitor/filesystem';
369
+
370
+ const { data } = await Filesystem.readFile({ path: result.uri });
371
+ const dataUrl = `data:image/${result.metadata.format};base64,${data}`;
372
+ ```
373
+
374
+ ### Replacing `pickImages` → `chooseFromGallery`
375
+
376
+ `pickImages` allowed selecting multiple photos from the gallery. Pass `allowMultipleSelection: true` to `chooseFromGallery` to get the same behaviour.
377
+
378
+ ```typescript
379
+ // Before
380
+ const { photos } = await Camera.pickImages({
381
+ quality: 90,
382
+ limit: 5,
383
+ width: 1280,
384
+ height: 720,
385
+ });
386
+ for (const photo of photos) {
387
+ console.log(photo.webPath);
388
+ }
389
+
390
+ // After
391
+ const { results } = await Camera.chooseFromGallery({
392
+ allowMultipleSelection: true,
393
+ quality: 90,
394
+ limit: 5,
395
+ targetWidth: 1280, // replaces width (1)
396
+ targetHeight: 720, // replaces height (1)
397
+ });
398
+ for (const result of results) {
399
+ console.log(result.webPath);
400
+ }
401
+ ```
402
+
403
+ **(1)** `width`/`height` each worked independently and set a maximum dimension while preserving aspect ratio. `targetWidth`/`targetHeight` must be used together — setting only one has no effect.
404
+
405
+ `chooseFromGallery` can also select videos or mixed media by setting `mediaType` to `MediaTypeSelection.Video` or `MediaTypeSelection.All`.
406
+
407
+ ### Option rename summary
408
+
409
+ | Old option | New option | Applies to |
410
+ |---|---|---|
411
+ | `width` | `targetWidth` (1) | `takePhoto`, `chooseFromGallery` |
412
+ | `height` | `targetHeight` (1) | `takePhoto`, `chooseFromGallery` |
413
+ | `direction` | `cameraDirection` | `takePhoto` |
414
+ | `allowEditing` | `editable: 'in-app'` | `takePhoto`, `chooseFromGallery` |
415
+ | `resultType` | — (removed, see [Result type changes](#result-type-changes)) | — |
416
+ | `source` | — (removed, use separate methods) | — |
417
+ | `promptLabel*` | — (removed, build your own UI) | — |
418
+
419
+ **(1)** `width`/`height` each worked independently and set a maximum dimension while preserving aspect ratio. `targetWidth`/`targetHeight` must be used together — setting only one has no effect.
420
+
101
421
  ## API
102
422
 
103
423
  <docgen-index>
@@ -120,6 +440,8 @@ const takePicture = async () => {
120
440
 
121
441
  </docgen-index>
122
442
 
443
+ For a list of existing error codes, see [Errors](#errors).
444
+
123
445
  <docgen-api>
124
446
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
125
447
 
@@ -361,14 +683,14 @@ Allows the user to pick multiple pictures from the photo gallery.
361
683
 
362
684
  #### MediaMetadata
363
685
 
364
- | Prop | Type | Description | Since |
365
- | ------------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
366
- | **`size`** | <code>number</code> | File size of the media, in bytes. | 8.1.0 |
367
- | **`duration`** | <code>number</code> | Only applicable for <a href="#mediatype">`MediaType.Video`</a> - the duration of the media, in seconds. | 8.1.0 |
368
- | **`format`** | <code>string</code> | The format of the image, ex: jpeg, png, mp4. Web supports jpeg, png and gif, but the exact availability may vary depending on the browser. gif is only supported for `chooseFromGallery` on Web. | 8.1.0 |
369
- | **`resolution`** | <code>string</code> | The resolution of the media, in `&lt;width&gt;x&lt;height&gt;` format. Example: '1920x1080'. | 8.1.0 |
370
- | **`creationDate`** | <code>string</code> | The date and time the media was created, in ISO 8601 format. If creation date is not available (e.g. Android 7 and below), the last modified date is returned. For Web, the last modified date is always returned. | 8.1.0 |
371
- | **`exif`** | <code>string</code> | Exif data, if any, retreived from the media item. Only available for <a href="#mediatype">`MediaType.Photo`</a>. Not available on Web. | 8.1.0 |
686
+ | Prop | Type | Description | Since |
687
+ | ------------------ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
688
+ | **`size`** | <code>number</code> | File size of the media, in bytes. | 8.1.0 |
689
+ | **`duration`** | <code>number</code> | Only applicable for <a href="#mediatype">`MediaType.Video`</a> - the duration of the media, in seconds. | 8.1.0 |
690
+ | **`format`** | <code>string</code> | The format of the image, ex: jpeg, png, mp4. Android and iOS may return 'jpg' instead of 'jpeg'. The format is the same, just with a different name. Please compare against both 'jpeg' and 'jpg' when checking if the format of the returned media is JPEG. Web supports jpeg, png and gif, but the exact availability may vary depending on the browser. gif is only supported for `chooseFromGallery` on Web. | 8.1.0 |
691
+ | **`resolution`** | <code>string</code> | The resolution of the media, in `&lt;width&gt;x&lt;height&gt;` format. Example: '1920x1080'. | 8.1.0 |
692
+ | **`creationDate`** | <code>string</code> | The date and time the media was created, in ISO 8601 format. If creation date is not available (e.g. Android 7 and below), the last modified date is returned. For Web, the last modified date is always returned. | 8.1.0 |
693
+ | **`exif`** | <code>string</code> | Exif data, if any, retreived from the media item. Only available for <a href="#mediatype">`MediaType.Photo`</a>. Not available on Web. | 8.1.0 |
372
694
 
373
695
 
374
696
  #### TakePhotoOptions
@@ -601,3 +923,35 @@ Allows the user to pick multiple pictures from the photo gallery.
601
923
  | **`Photos`** | <code>'PHOTOS'</code> | Pick an existing photo from the gallery or photo album. |
602
924
 
603
925
  </docgen-api>
926
+
927
+ ### Errors
928
+
929
+ The plugin returns structured errors on Android and iOS. Each error has a `code` (e.g. `OS-PLUG-CAMR-0003`) and a `message` with a human-readable description. Note that these are only available for native platforms starting on the new APIs introduced in version `8.1.0`: `takePhoto`, `chooseFromGallery`, `editPhoto`, `editURIPhoto`, `recordVideo`, and `playVideo`.
930
+
931
+ | Error code | Platform(s) | Description |
932
+ |---|---|---|
933
+ | OS-PLUG-CAMR-0003 | Android, iOS | Couldn't access camera. Check your camera permissions and try again. |
934
+ | OS-PLUG-CAMR-0005 | Android, iOS | Couldn't access your photo gallery because access wasn't provided. |
935
+ | OS-PLUG-CAMR-0006 | Android, iOS | Couldn't take photo because the process was canceled. |
936
+ | OS-PLUG-CAMR-0007 | Android, iOS | No camera available. |
937
+ | OS-PLUG-CAMR-0008 | iOS | The selected file contains data that isn't valid. |
938
+ | OS-PLUG-CAMR-0009 | Android, iOS | Couldn't edit image. |
939
+ | OS-PLUG-CAMR-0010 | Android, iOS | Couldn't take photo. |
940
+ | OS-PLUG-CAMR-0011 | iOS | Couldn't get image from the gallery. |
941
+ | OS-PLUG-CAMR-0012 | Android, iOS | Couldn't process image. |
942
+ | OS-PLUG-CAMR-0013 | Android, iOS | Couldn't edit photo because the process was canceled. |
943
+ | OS-PLUG-CAMR-0014 | iOS | Couldn't decode the 'Take Photo' action parameters. |
944
+ | OS-PLUG-CAMR-0016 | Android, iOS | Couldn't record video. |
945
+ | OS-PLUG-CAMR-0017 | Android, iOS | Couldn't record video because the process was canceled. |
946
+ | OS-PLUG-CAMR-0018 | Android, iOS | Couldn't choose media from the gallery. |
947
+ | OS-PLUG-CAMR-0019 | iOS | Couldn't encode the media result. |
948
+ | OS-PLUG-CAMR-0020 | Android, iOS | Couldn't choose media from the gallery because the process was canceled. |
949
+ | OS-PLUG-CAMR-0021 | Android | Couldn't get media file path. |
950
+ | OS-PLUG-CAMR-0023 | Android, iOS | Couldn't play video. |
951
+ | OS-PLUG-CAMR-0024 | Android | URI parameter cannot be empty. |
952
+ | OS-PLUG-CAMR-0025 | iOS | Couldn't get video from the gallery. |
953
+ | OS-PLUG-CAMR-0026 | iOS | There's an issue with the plugin. |
954
+ | OS-PLUG-CAMR-0027 | Android, iOS | The selected file doesn't exist. |
955
+ | OS-PLUG-CAMR-0028 | Android, iOS | Couldn't retrieve image from the URI. |
956
+ | OS-PLUG-CAMR-0031 | Android | Invalid argument provided to plugin method. |
957
+ | OS-PLUG-CAMR-0033 | Android | Unable to get the context. |
@@ -30,8 +30,8 @@ apply plugin: 'com.android.library'
30
30
  apply plugin: 'kotlin-android'
31
31
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
32
32
  apply plugin: 'io.github.gradle-nexus.publish-plugin'
33
- apply from: file('../../scripts/android/publish-root.gradle')
34
- apply from: file('../../scripts/android/publish-module.gradle')
33
+ apply from: file('../scripts/android/publish-root.gradle')
34
+ apply from: file('../scripts/android/publish-module.gradle')
35
35
  }
36
36
 
37
37
  android {
@@ -74,6 +74,8 @@ repositories {
74
74
 
75
75
  dependencies {
76
76
  implementation fileTree(dir: 'libs', include: ['*.jar'])
77
+
78
+ implementation 'io.ionic.libs:ioncamera-android:1.0.0'
77
79
 
78
80
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
79
81
  implementation "com.capacitorjs:core:$capacitorVersion"
@@ -89,5 +91,4 @@ dependencies {
89
91
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
90
92
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
91
93
  implementation 'com.google.code.gson:gson:2.10.1'
92
- implementation 'io.ionic.libs:ioncamera-android:0.1.0'
93
94
  }
@@ -90,7 +90,7 @@ class CameraPlugin : Plugin() {
90
90
  ionFlow.load()
91
91
  }
92
92
 
93
-
93
+ @Deprecated("Use either takePhoto for CameraSource.Camera or chooseFromGallery for CameraSource.Photos")
94
94
  @PluginMethod
95
95
  fun getPhoto(call: PluginCall) {
96
96
  legacyFlow.getPhoto(call)
@@ -126,6 +126,7 @@ class CameraPlugin : Plugin() {
126
126
  ionFlow.editURIPhoto(call)
127
127
  }
128
128
 
129
+ @Deprecated("Use chooseFromGallery instead")
129
130
  @PluginMethod
130
131
  fun pickImages(call: PluginCall) {
131
132
  legacyFlow.pickImages(call)
package/dist/docs.json CHANGED
@@ -407,7 +407,7 @@
407
407
  "name": "since"
408
408
  }
409
409
  ],
410
- "docs": "The format of the image, ex: jpeg, png, mp4.\n\nWeb supports jpeg, png and gif, but the exact availability may vary depending on the browser.\ngif is only supported for `chooseFromGallery` on Web.",
410
+ "docs": "The format of the image, ex: jpeg, png, mp4.\n\nAndroid and iOS may return 'jpg' instead of 'jpeg'. The format is the same, just with a different name.\nPlease compare against both 'jpeg' and 'jpg' when checking if the format of the returned media is JPEG.\nWeb supports jpeg, png and gif, but the exact availability may vary depending on the browser.\ngif is only supported for `chooseFromGallery` on Web.",
411
411
  "complexTypes": [],
412
412
  "type": "string"
413
413
  },
@@ -422,6 +422,8 @@ export interface MediaMetadata {
422
422
  /**
423
423
  * The format of the image, ex: jpeg, png, mp4.
424
424
  *
425
+ * Android and iOS may return 'jpg' instead of 'jpeg'. The format is the same, just with a different name.
426
+ * Please compare against both 'jpeg' and 'jpg' when checking if the format of the returned media is JPEG.
425
427
  * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.
426
428
  * gif is only supported for `chooseFromGallery` on Web.
427
429
  *
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAoyBA;;;GAGG;AACH,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,2CAAS,CAAA;IACT,2CAAS,CAAA;AACX,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,6DAAS,CAAA;IACT,6DAAS,CAAA;IACT,yDAAO,CAAA;AACT,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,+CAAQ,CAAA;IACR,6CAAO,CAAA;AACT,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nexport type CameraPermissionState = PermissionState | 'limited';\n\nexport type CameraPermissionType = 'camera' | 'photos';\n\nexport interface PermissionStatus {\n camera: CameraPermissionState;\n photos: CameraPermissionState;\n}\n\nexport interface CameraPluginPermissions {\n permissions: CameraPermissionType[];\n}\n\nexport interface CameraPlugin {\n /**\n * Open the device's camera and allow the user to take a photo.\n *\n * @since 8.1.0\n */\n takePhoto(options: TakePhotoOptions): Promise<MediaResult>;\n\n /**\n * Open the device's camera and allow the user to record a video.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n recordVideo(options: RecordVideoOptions): Promise<MediaResult>;\n\n /**\n * Open a native video player.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n playVideo(options: PlayVideoOptions): Promise<void>;\n\n /**\n * Allow users to choose pictures, videos, or both, directly from their gallery.\n *\n * @since 8.1.0\n */\n chooseFromGallery(options: ChooseFromGalleryOptions): Promise<MediaResults>;\n\n /**\n * Open an in-app screen to edit a given photo using the provided base64 string.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n editPhoto(options: EditPhotoOptions): Promise<EditPhotoResult>;\n\n /**\n * Open an in-app screen to edit a photo using the provided URI.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n editURIPhoto(options: EditURIPhotoOptions): Promise<MediaResult>;\n\n /**\n * Allows the user to update their limited photo library selection.\n * Returns all the limited photos after the picker dismissal.\n * If instead the user gave full access to the photos it returns an empty array.\n *\n * @since 4.1.0\n */\n pickLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n /**\n * Return an array of photos selected from the limited photo library.\n *\n * @since 4.1.0\n */\n getLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n\n /**\n * Check camera and photo album permissions\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request camera and photo album permissions\n *\n * @since 1.0.0\n */\n requestPermissions(permissions?: CameraPluginPermissions): Promise<PermissionStatus>;\n\n /**\n * Prompt the user to pick a photo from an album, or take a new photo\n * with the camera.\n *\n * @since 1.0.0\n * @deprecated Use `takePhoto` for a camera photo, or `chooseFromGallery` to select from the gallery. For creating a prompt for the user to select which source, use `@capacitor/action-sheet` or any UI component of your choosing. Refer to the Camera API documentation for more information on migrating.\n */\n getPhoto(options: ImageOptions): Promise<Photo>;\n\n /**\n * Allows the user to pick multiple pictures from the photo gallery.\n *\n * @since 1.2.0\n * @deprecated Use `chooseFromGallery` instead. Refer to the Camera API documentation for more information on migrating.\n */\n pickImages(options: GalleryImageOptions): Promise<GalleryPhotos>;\n}\n\nexport interface TakePhotoOptions {\n /**\n * The quality of image to return, from 0-100.\n * Only applicable for `EncodingType.JPEG`.\n * Note: This option is only supported on Android and iOS.\n *\n * @default 100\n * @since 8.1.0\n */\n quality?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetHeight`.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetWidth?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetWidth`.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetHeight?: number;\n\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Note: This option is only supported on Android and iOS\n * @default true\n *\n * @since 8.1.0\n */\n correctOrientation?: boolean;\n\n /**\n * The encoding type for the captured photo - JPEG or PNG.\n * Note: This option is only supported on Android and iOS.\n * @default EncodingType.JPEG\n *\n * @since 8.1.0\n */\n encodingType?: EncodingType;\n\n /**\n * Whether to save the photo to the gallery.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 8.1.0\n */\n saveToGallery?: boolean;\n\n /**\n * iOS and Web only: The camera direction.\n * @default CameraDirection.Rear\n *\n * @since 8.1.0\n */\n cameraDirection?: CameraDirection;\n\n /**\n * Determines if and how the user can edit the photo.\n * - 'in-app': Use an in-app editor for photo edition.\n * - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.\n * - 'no': No editing allowed.\n * Not available on Web.\n * @default 'no'\n *\n * @since 8.1.0\n */\n editable?: 'in-app' | 'external' | 'no';\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 8.1.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 8.1.0\n */\n webUseInput?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n}\n\nexport interface RecordVideoOptions {\n /**\n * Whether to save the video to the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n saveToGallery?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n\n /**\n * Whether the to store the video in persistent app storage or in temporary cache.\n * If you plan to use the returned `MediaResult#URI` across app launches, you may want to set to true.\n * Otherwise, you can set to false.\n * @default true\n *\n * @since 8.1.0\n */\n isPersistent?: boolean;\n}\n\nexport interface PlayVideoOptions {\n /**\n * The URI of the video to play.\n * You may use the `MediaResult#URI` returned from `recordVideo` or `chooseFromGallery` directly.\n *\n * @since 8.1.0\n */\n uri: string;\n}\n\nexport interface ChooseFromGalleryOptions {\n /**\n * The type of media to select. Can be pictures, videos, or both.\n * @default MediaTypeSelection.Photo\n *\n * @since 8.1.0\n */\n mediaType?: MediaTypeSelection;\n\n /**\n * Whether or not to allow selecting multiple media files from the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n allowMultipleSelection?: boolean;\n\n /**\n * The maximum number of media files that the user can choose.\n * Only applicable if `allowMultipleSelection` is `true`.\n * Any non-positive number will be treated as unlimited.\n * Note: This option is only supported on Android 13+ and iOS.\n * @default 0\n *\n * @since 8.1.0\n */\n limit?: number;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n\n /**\n * Determines if and how the user can edit the photo.\n * - 'in-app': Use an in-app editor for photo edition.\n * - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.\n * - 'no': No editing allowed.\n * Only applicable for `MediaTypeSelection.Photo` and `allowMultipleSelection` set to `false`.\n * Not available on Web.\n * @default 'no'\n *\n * @since 8.1.0\n */\n editable?: 'in-app' | 'external' | 'no';\n\n /**\n * iOS only: The presentation style of media picker.\n * @default 'fullscreen'\n *\n * @since 8.1.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * The quality of images to return, from 0-100.\n * Only applicable for `MediaType.Photo` and JPEG format.\n * Note: This option is only supported on Android and iOS.\n *\n * @default 100\n * @since 8.1.0\n */\n quality?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetHeight`.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n targetWidth?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetWidth`.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetHeight?: number;\n\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS\n * @default true\n *\n * @since 8.1.0\n */\n correctOrientation?: boolean;\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 8.1.0\n */\n webUseInput?: boolean;\n}\n\nexport interface EditURIPhotoOptions {\n /**\n * The URI that contains the photo to edit.\n *\n * @since 8.1.0\n */\n uri: string;\n\n /**\n * Whether to save the edited photo to the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n\n saveToGallery?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n}\n\nexport interface EditPhotoOptions {\n /**\n * The base64 encoded image to edit.\n *\n * @since 8.1.0\n */\n inputImage: string;\n}\n\nexport interface EditPhotoResult {\n /**\n * The edited image, base64 encoded.\n *\n * @since 8.1.0\n */\n outputImage: string;\n}\n\nexport interface MediaResult {\n /**\n * The type of media result. Either `Photo` or `Video`.\n *\n * @since 8.1.0\n */\n type: MediaType;\n\n /**\n * The URI pointing to the media file.\n * Not available on Web. Use `webPath` instead for Web.\n *\n * @since 8.1.0\n */\n uri?: string;\n\n /**\n * Returns the thumbnail of the media, base64 encoded.\n * On Web, for `MediaType.Photo`, the full image is returned here, also base64 encoded.\n * On Web, for `MediaType.Video`, a full-resolution JPEG frame captured from the video is returned, base64 encoded at 80% quality.\n *\n * @since 8.1.0\n */\n thumbnail?: string;\n\n /**\n * Whether if the media was saved to the gallery successfully or not.\n * Only applicable if `saveToGallery` was set to `true` in input options.\n * Otherwise, `false` is always returned for `save`.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n saved: boolean;\n\n /**\n * webPath returns a path that can be used to set the src attribute of a media item for efficient\n * loading and rendering.\n *\n * @since 8.1.0\n */\n webPath?: string;\n\n /**\n * Metadata associated to the media result.\n * Only included if `includeMetadata` was set to `true` in input options.\n *\n * @since 8.1.0\n */\n metadata?: MediaMetadata;\n}\n\nexport interface MediaMetadata {\n /**\n * File size of the media, in bytes.\n *\n * @since 8.1.0\n */\n size?: number;\n\n /**\n * Only applicable for `MediaType.Video` - the duration of the media, in seconds.\n *\n * @since 8.1.0\n */\n duration?: number;\n\n /**\n * The format of the image, ex: jpeg, png, mp4.\n *\n * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.\n * gif is only supported for `chooseFromGallery` on Web.\n *\n * @since 8.1.0\n */\n format: string;\n\n /**\n * The resolution of the media, in `<width>x<height>` format. Example: '1920x1080'.\n *\n * @since 8.1.0\n */\n resolution?: string;\n\n /**\n * The date and time the media was created, in ISO 8601 format.\n * If creation date is not available (e.g. Android 7 and below), the last modified date is returned.\n * For Web, the last modified date is always returned.\n *\n * @since 8.1.0\n */\n creationDate?: string;\n\n /**\n * Exif data, if any, retreived from the media item.\n * Only available for `MediaType.Photo`.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n exif?: string;\n}\n\nexport interface MediaResults {\n /**\n * The list of media results.\n *\n * @since 8.1.0\n */\n results: MediaResult[];\n}\n\n/**\n * @deprecated This interface is only meant to be used for deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport interface ImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n quality?: number;\n /**\n * Whether to allow the user to crop or make small edits (platform specific).\n * Note: This option is only supported on Android and iOS.\n * On iOS it's only supported for CameraSource.Camera, but not for CameraSource.Photos.\n *\n * @since 1.0.0\n */\n allowEditing?: boolean;\n /**\n * How the data should be returned. Currently, only 'Base64', 'DataUrl' or 'Uri' is supported\n *\n * @since 1.0.0\n */\n resultType: CameraResultType;\n /**\n * Whether to save the photo to the gallery.\n * If the photo was picked from the gallery, it will only be saved if edited.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 1.0.0\n */\n saveToGallery?: boolean;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Note: This option is only supported on Android and iOS.\n * @default true\n *\n * @since 1.0.0\n */\n correctOrientation?: boolean;\n /**\n * The source to get the photo from. By default this prompts the user to select\n * either the photo album or take a photo.\n * @default CameraSource.Prompt\n *\n * @since 1.0.0\n */\n source?: CameraSource;\n /**\n * iOS and Web only: The camera direction.\n * @default CameraDirection.Rear\n *\n * @since 1.0.0\n */\n direction?: CameraDirection;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 1.0.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 1.0.0\n */\n webUseInput?: boolean;\n\n /**\n * Text value to use when displaying the prompt.\n * @default 'Photo'\n *\n * @since 1.0.0\n *\n */\n promptLabelHeader?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * iOS only: The label of the 'cancel' button.\n * @default 'Cancel'\n *\n * @since 1.0.0\n */\n promptLabelCancel?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to select a saved image.\n * @default 'From Photos'\n *\n * @since 1.0.0\n */\n promptLabelPhoto?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to open the camera.\n * @default 'Take Picture'\n *\n * @since 1.0.0\n */\n promptLabelPicture?: string;\n}\n\n/**\n * @deprecated This interface is only meant to be used for received the result of deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport interface Photo {\n /**\n * The base64 encoded string representation of the image, if using CameraResultType.Base64.\n *\n * @since 1.0.0\n */\n base64String?: string;\n /**\n * The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.\n *\n * Note: On web, the file format could change depending on the browser.\n * @since 1.0.0\n */\n dataUrl?: string;\n /**\n * If using CameraResultType.Uri, the path will contain a full,\n * platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.0.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.0.0\n */\n webPath?: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.0.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.\n * gif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`.\n *\n * @since 1.0.0\n */\n format: string;\n /**\n * Whether if the image was saved to the gallery or not.\n *\n * On Android and iOS, saving to the gallery can fail if the user didn't\n * grant the required permissions.\n * On Web there is no gallery, so always returns false.\n *\n * @since 1.1.0\n */\n saved: boolean;\n}\n\nexport interface GalleryPhotos {\n /**\n * Array of all the picked photos.\n *\n * @since 1.2.0\n */\n photos: GalleryPhoto[];\n}\n\nexport interface GalleryPhoto {\n /**\n * Full, platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.2.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.2.0\n */\n webPath: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.2.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif.\n *\n * @since 1.2.0\n */\n format: string;\n}\n\n/**\n * @deprecated This interface is only meant to be used for deprecated `pickImages` method.\n * It will be removed in a future major version of the plugin, along with `pickImages`.\n */\nexport interface GalleryImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.2.0\n */\n quality?: number;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode\n * @default true\n *\n * @since 1.2.0\n */\n correctOrientation?: boolean;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 1.2.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Maximum number of pictures the user will be able to choose.\n * Note: This option is only supported on Android 13+ and iOS.\n *\n * @default 0 (unlimited)\n *\n * @since 1.2.0\n */\n limit?: number;\n}\n\n/**\n * @deprecated This enum is only meant to be used for deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport enum CameraSource {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n Prompt = 'PROMPT',\n /**\n * Take a new photo using the camera.\n */\n Camera = 'CAMERA',\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n Photos = 'PHOTOS',\n}\n\nexport enum CameraDirection {\n Rear = 'REAR',\n Front = 'FRONT',\n}\n\n/**\n * @deprecated This enum is only meant to be used for `ImageOptions` in deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport enum CameraResultType {\n Uri = 'uri',\n Base64 = 'base64',\n DataUrl = 'dataUrl',\n}\n\nexport enum MediaType {\n Photo = 0,\n Video = 1,\n}\n\nexport enum MediaTypeSelection {\n Photo = 0,\n Video = 1,\n All = 2,\n}\n\nexport enum EncodingType {\n JPEG = 0,\n PNG = 1,\n}\n\n/**\n * @deprecated Use `Photo`.\n * @since 1.0.0\n */\nexport type CameraPhoto = Photo;\n\n/**\n * @deprecated Use `ImageOptions`.\n * @since 1.0.0\n */\nexport type CameraOptions = ImageOptions;\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsyBA;;;GAGG;AACH,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,2CAAS,CAAA;IACT,2CAAS,CAAA;AACX,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,6DAAS,CAAA;IACT,6DAAS,CAAA;IACT,yDAAO,CAAA;AACT,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,+CAAQ,CAAA;IACR,6CAAO,CAAA;AACT,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nexport type CameraPermissionState = PermissionState | 'limited';\n\nexport type CameraPermissionType = 'camera' | 'photos';\n\nexport interface PermissionStatus {\n camera: CameraPermissionState;\n photos: CameraPermissionState;\n}\n\nexport interface CameraPluginPermissions {\n permissions: CameraPermissionType[];\n}\n\nexport interface CameraPlugin {\n /**\n * Open the device's camera and allow the user to take a photo.\n *\n * @since 8.1.0\n */\n takePhoto(options: TakePhotoOptions): Promise<MediaResult>;\n\n /**\n * Open the device's camera and allow the user to record a video.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n recordVideo(options: RecordVideoOptions): Promise<MediaResult>;\n\n /**\n * Open a native video player.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n playVideo(options: PlayVideoOptions): Promise<void>;\n\n /**\n * Allow users to choose pictures, videos, or both, directly from their gallery.\n *\n * @since 8.1.0\n */\n chooseFromGallery(options: ChooseFromGalleryOptions): Promise<MediaResults>;\n\n /**\n * Open an in-app screen to edit a given photo using the provided base64 string.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n editPhoto(options: EditPhotoOptions): Promise<EditPhotoResult>;\n\n /**\n * Open an in-app screen to edit a photo using the provided URI.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n editURIPhoto(options: EditURIPhotoOptions): Promise<MediaResult>;\n\n /**\n * Allows the user to update their limited photo library selection.\n * Returns all the limited photos after the picker dismissal.\n * If instead the user gave full access to the photos it returns an empty array.\n *\n * @since 4.1.0\n */\n pickLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n /**\n * Return an array of photos selected from the limited photo library.\n *\n * @since 4.1.0\n */\n getLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n\n /**\n * Check camera and photo album permissions\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request camera and photo album permissions\n *\n * @since 1.0.0\n */\n requestPermissions(permissions?: CameraPluginPermissions): Promise<PermissionStatus>;\n\n /**\n * Prompt the user to pick a photo from an album, or take a new photo\n * with the camera.\n *\n * @since 1.0.0\n * @deprecated Use `takePhoto` for a camera photo, or `chooseFromGallery` to select from the gallery. For creating a prompt for the user to select which source, use `@capacitor/action-sheet` or any UI component of your choosing. Refer to the Camera API documentation for more information on migrating.\n */\n getPhoto(options: ImageOptions): Promise<Photo>;\n\n /**\n * Allows the user to pick multiple pictures from the photo gallery.\n *\n * @since 1.2.0\n * @deprecated Use `chooseFromGallery` instead. Refer to the Camera API documentation for more information on migrating.\n */\n pickImages(options: GalleryImageOptions): Promise<GalleryPhotos>;\n}\n\nexport interface TakePhotoOptions {\n /**\n * The quality of image to return, from 0-100.\n * Only applicable for `EncodingType.JPEG`.\n * Note: This option is only supported on Android and iOS.\n *\n * @default 100\n * @since 8.1.0\n */\n quality?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetHeight`.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetWidth?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetWidth`.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetHeight?: number;\n\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Note: This option is only supported on Android and iOS\n * @default true\n *\n * @since 8.1.0\n */\n correctOrientation?: boolean;\n\n /**\n * The encoding type for the captured photo - JPEG or PNG.\n * Note: This option is only supported on Android and iOS.\n * @default EncodingType.JPEG\n *\n * @since 8.1.0\n */\n encodingType?: EncodingType;\n\n /**\n * Whether to save the photo to the gallery.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 8.1.0\n */\n saveToGallery?: boolean;\n\n /**\n * iOS and Web only: The camera direction.\n * @default CameraDirection.Rear\n *\n * @since 8.1.0\n */\n cameraDirection?: CameraDirection;\n\n /**\n * Determines if and how the user can edit the photo.\n * - 'in-app': Use an in-app editor for photo edition.\n * - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.\n * - 'no': No editing allowed.\n * Not available on Web.\n * @default 'no'\n *\n * @since 8.1.0\n */\n editable?: 'in-app' | 'external' | 'no';\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 8.1.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 8.1.0\n */\n webUseInput?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n}\n\nexport interface RecordVideoOptions {\n /**\n * Whether to save the video to the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n saveToGallery?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n\n /**\n * Whether the to store the video in persistent app storage or in temporary cache.\n * If you plan to use the returned `MediaResult#URI` across app launches, you may want to set to true.\n * Otherwise, you can set to false.\n * @default true\n *\n * @since 8.1.0\n */\n isPersistent?: boolean;\n}\n\nexport interface PlayVideoOptions {\n /**\n * The URI of the video to play.\n * You may use the `MediaResult#URI` returned from `recordVideo` or `chooseFromGallery` directly.\n *\n * @since 8.1.0\n */\n uri: string;\n}\n\nexport interface ChooseFromGalleryOptions {\n /**\n * The type of media to select. Can be pictures, videos, or both.\n * @default MediaTypeSelection.Photo\n *\n * @since 8.1.0\n */\n mediaType?: MediaTypeSelection;\n\n /**\n * Whether or not to allow selecting multiple media files from the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n allowMultipleSelection?: boolean;\n\n /**\n * The maximum number of media files that the user can choose.\n * Only applicable if `allowMultipleSelection` is `true`.\n * Any non-positive number will be treated as unlimited.\n * Note: This option is only supported on Android 13+ and iOS.\n * @default 0\n *\n * @since 8.1.0\n */\n limit?: number;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n\n /**\n * Determines if and how the user can edit the photo.\n * - 'in-app': Use an in-app editor for photo edition.\n * - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.\n * - 'no': No editing allowed.\n * Only applicable for `MediaTypeSelection.Photo` and `allowMultipleSelection` set to `false`.\n * Not available on Web.\n * @default 'no'\n *\n * @since 8.1.0\n */\n editable?: 'in-app' | 'external' | 'no';\n\n /**\n * iOS only: The presentation style of media picker.\n * @default 'fullscreen'\n *\n * @since 8.1.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * The quality of images to return, from 0-100.\n * Only applicable for `MediaType.Photo` and JPEG format.\n * Note: This option is only supported on Android and iOS.\n *\n * @default 100\n * @since 8.1.0\n */\n quality?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetHeight`.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n targetWidth?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetWidth`.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetHeight?: number;\n\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS\n * @default true\n *\n * @since 8.1.0\n */\n correctOrientation?: boolean;\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 8.1.0\n */\n webUseInput?: boolean;\n}\n\nexport interface EditURIPhotoOptions {\n /**\n * The URI that contains the photo to edit.\n *\n * @since 8.1.0\n */\n uri: string;\n\n /**\n * Whether to save the edited photo to the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n\n saveToGallery?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n}\n\nexport interface EditPhotoOptions {\n /**\n * The base64 encoded image to edit.\n *\n * @since 8.1.0\n */\n inputImage: string;\n}\n\nexport interface EditPhotoResult {\n /**\n * The edited image, base64 encoded.\n *\n * @since 8.1.0\n */\n outputImage: string;\n}\n\nexport interface MediaResult {\n /**\n * The type of media result. Either `Photo` or `Video`.\n *\n * @since 8.1.0\n */\n type: MediaType;\n\n /**\n * The URI pointing to the media file.\n * Not available on Web. Use `webPath` instead for Web.\n *\n * @since 8.1.0\n */\n uri?: string;\n\n /**\n * Returns the thumbnail of the media, base64 encoded.\n * On Web, for `MediaType.Photo`, the full image is returned here, also base64 encoded.\n * On Web, for `MediaType.Video`, a full-resolution JPEG frame captured from the video is returned, base64 encoded at 80% quality.\n *\n * @since 8.1.0\n */\n thumbnail?: string;\n\n /**\n * Whether if the media was saved to the gallery successfully or not.\n * Only applicable if `saveToGallery` was set to `true` in input options.\n * Otherwise, `false` is always returned for `save`.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n saved: boolean;\n\n /**\n * webPath returns a path that can be used to set the src attribute of a media item for efficient\n * loading and rendering.\n *\n * @since 8.1.0\n */\n webPath?: string;\n\n /**\n * Metadata associated to the media result.\n * Only included if `includeMetadata` was set to `true` in input options.\n *\n * @since 8.1.0\n */\n metadata?: MediaMetadata;\n}\n\nexport interface MediaMetadata {\n /**\n * File size of the media, in bytes.\n *\n * @since 8.1.0\n */\n size?: number;\n\n /**\n * Only applicable for `MediaType.Video` - the duration of the media, in seconds.\n *\n * @since 8.1.0\n */\n duration?: number;\n\n /**\n * The format of the image, ex: jpeg, png, mp4.\n *\n * Android and iOS may return 'jpg' instead of 'jpeg'. The format is the same, just with a different name.\n * Please compare against both 'jpeg' and 'jpg' when checking if the format of the returned media is JPEG.\n * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.\n * gif is only supported for `chooseFromGallery` on Web.\n *\n * @since 8.1.0\n */\n format: string;\n\n /**\n * The resolution of the media, in `<width>x<height>` format. Example: '1920x1080'.\n *\n * @since 8.1.0\n */\n resolution?: string;\n\n /**\n * The date and time the media was created, in ISO 8601 format.\n * If creation date is not available (e.g. Android 7 and below), the last modified date is returned.\n * For Web, the last modified date is always returned.\n *\n * @since 8.1.0\n */\n creationDate?: string;\n\n /**\n * Exif data, if any, retreived from the media item.\n * Only available for `MediaType.Photo`.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n exif?: string;\n}\n\nexport interface MediaResults {\n /**\n * The list of media results.\n *\n * @since 8.1.0\n */\n results: MediaResult[];\n}\n\n/**\n * @deprecated This interface is only meant to be used for deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport interface ImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n quality?: number;\n /**\n * Whether to allow the user to crop or make small edits (platform specific).\n * Note: This option is only supported on Android and iOS.\n * On iOS it's only supported for CameraSource.Camera, but not for CameraSource.Photos.\n *\n * @since 1.0.0\n */\n allowEditing?: boolean;\n /**\n * How the data should be returned. Currently, only 'Base64', 'DataUrl' or 'Uri' is supported\n *\n * @since 1.0.0\n */\n resultType: CameraResultType;\n /**\n * Whether to save the photo to the gallery.\n * If the photo was picked from the gallery, it will only be saved if edited.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 1.0.0\n */\n saveToGallery?: boolean;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Note: This option is only supported on Android and iOS.\n * @default true\n *\n * @since 1.0.0\n */\n correctOrientation?: boolean;\n /**\n * The source to get the photo from. By default this prompts the user to select\n * either the photo album or take a photo.\n * @default CameraSource.Prompt\n *\n * @since 1.0.0\n */\n source?: CameraSource;\n /**\n * iOS and Web only: The camera direction.\n * @default CameraDirection.Rear\n *\n * @since 1.0.0\n */\n direction?: CameraDirection;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 1.0.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 1.0.0\n */\n webUseInput?: boolean;\n\n /**\n * Text value to use when displaying the prompt.\n * @default 'Photo'\n *\n * @since 1.0.0\n *\n */\n promptLabelHeader?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * iOS only: The label of the 'cancel' button.\n * @default 'Cancel'\n *\n * @since 1.0.0\n */\n promptLabelCancel?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to select a saved image.\n * @default 'From Photos'\n *\n * @since 1.0.0\n */\n promptLabelPhoto?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to open the camera.\n * @default 'Take Picture'\n *\n * @since 1.0.0\n */\n promptLabelPicture?: string;\n}\n\n/**\n * @deprecated This interface is only meant to be used for received the result of deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport interface Photo {\n /**\n * The base64 encoded string representation of the image, if using CameraResultType.Base64.\n *\n * @since 1.0.0\n */\n base64String?: string;\n /**\n * The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.\n *\n * Note: On web, the file format could change depending on the browser.\n * @since 1.0.0\n */\n dataUrl?: string;\n /**\n * If using CameraResultType.Uri, the path will contain a full,\n * platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.0.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.0.0\n */\n webPath?: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.0.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.\n * gif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`.\n *\n * @since 1.0.0\n */\n format: string;\n /**\n * Whether if the image was saved to the gallery or not.\n *\n * On Android and iOS, saving to the gallery can fail if the user didn't\n * grant the required permissions.\n * On Web there is no gallery, so always returns false.\n *\n * @since 1.1.0\n */\n saved: boolean;\n}\n\nexport interface GalleryPhotos {\n /**\n * Array of all the picked photos.\n *\n * @since 1.2.0\n */\n photos: GalleryPhoto[];\n}\n\nexport interface GalleryPhoto {\n /**\n * Full, platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.2.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.2.0\n */\n webPath: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.2.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif.\n *\n * @since 1.2.0\n */\n format: string;\n}\n\n/**\n * @deprecated This interface is only meant to be used for deprecated `pickImages` method.\n * It will be removed in a future major version of the plugin, along with `pickImages`.\n */\nexport interface GalleryImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.2.0\n */\n quality?: number;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode\n * @default true\n *\n * @since 1.2.0\n */\n correctOrientation?: boolean;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 1.2.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Maximum number of pictures the user will be able to choose.\n * Note: This option is only supported on Android 13+ and iOS.\n *\n * @default 0 (unlimited)\n *\n * @since 1.2.0\n */\n limit?: number;\n}\n\n/**\n * @deprecated This enum is only meant to be used for deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport enum CameraSource {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n Prompt = 'PROMPT',\n /**\n * Take a new photo using the camera.\n */\n Camera = 'CAMERA',\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n Photos = 'PHOTOS',\n}\n\nexport enum CameraDirection {\n Rear = 'REAR',\n Front = 'FRONT',\n}\n\n/**\n * @deprecated This enum is only meant to be used for `ImageOptions` in deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport enum CameraResultType {\n Uri = 'uri',\n Base64 = 'base64',\n DataUrl = 'dataUrl',\n}\n\nexport enum MediaType {\n Photo = 0,\n Video = 1,\n}\n\nexport enum MediaTypeSelection {\n Photo = 0,\n Video = 1,\n All = 2,\n}\n\nexport enum EncodingType {\n JPEG = 0,\n PNG = 1,\n}\n\n/**\n * @deprecated Use `Photo`.\n * @since 1.0.0\n */\nexport type CameraPhoto = Photo;\n\n/**\n * @deprecated Use `ImageOptions`.\n * @since 1.0.0\n */\nexport type CameraOptions = ImageOptions;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/camera",
3
- "version": "8.1.0-test.20260402.2",
3
+ "version": "8.1.0",
4
4
  "description": "The Camera API provides the ability to take a photo with the camera or choose an existing one from the photo album.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -61,7 +61,13 @@
61
61
  "rimraf": "^6.1.0",
62
62
  "rollup": "^4.53.2",
63
63
  "swiftlint": "^2.0.0",
64
- "typescript": "^5.9.3"
64
+ "typescript": "^5.9.3",
65
+ "@semantic-release/changelog": "^6.0.3",
66
+ "@semantic-release/exec": "^7.1.0",
67
+ "@semantic-release/git": "^10.0.1",
68
+ "@semantic-release/github": "^12.0.2",
69
+ "@semantic-release/npm": "^13.1.2",
70
+ "semantic-release": "^25.0.2"
65
71
  },
66
72
  "peerDependencies": {
67
73
  "@capacitor/core": ">=8.0.0"