@capacitor/camera 5.0.0-nightly-20230502T150745.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/dist/docs.json +4 -4
- package/dist/esm/definitions.d.ts +5 -1
- package/dist/esm/definitions.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,8 +39,8 @@ Additionally, because the Camera API launches a separate Activity to handle taki
|
|
|
39
39
|
|
|
40
40
|
This plugin will use the following project variables (defined in your app's `variables.gradle` file):
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
42
|
+
- `androidxExifInterfaceVersion`: version of `androidx.exifinterface:exifinterface` (default: `1.3.6`)
|
|
43
|
+
- `androidxMaterialVersion`: version of `com.google.android.material:material` (default: `1.8.0`)
|
|
44
44
|
|
|
45
45
|
## PWA Notes
|
|
46
46
|
|
|
@@ -199,22 +199,22 @@ Request camera and photo album permissions
|
|
|
199
199
|
|
|
200
200
|
#### Photo
|
|
201
201
|
|
|
202
|
-
| Prop | Type | Description
|
|
203
|
-
| ------------------ | -------------------- |
|
|
204
|
-
| **`base64String`** | <code>string</code> | The base64 encoded string representation of the image, if using <a href="#cameraresulttype">CameraResultType.Base64</a>.
|
|
205
|
-
| **`dataUrl`** | <code>string</code> | The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using <a href="#cameraresulttype">CameraResultType.DataUrl</a>.
|
|
206
|
-
| **`path`** | <code>string</code> | If using <a href="#cameraresulttype">CameraResultType.Uri</a>, the path will contain a full, platform-specific file URL that can be read later using the Filesystem API.
|
|
207
|
-
| **`webPath`** | <code>string</code> | webPath returns a path that can be used to set the src attribute of an image for efficient loading and rendering.
|
|
208
|
-
| **`exif`** | <code>any</code> | Exif data, if any, retrieved from the image
|
|
209
|
-
| **`format`** | <code>string</code> | The format of the image, ex: jpeg, png, gif. iOS and Android only support jpeg. Web supports jpeg and
|
|
210
|
-
| **`saved`** | <code>boolean</code> | Whether if the image was saved to the gallery or not. On Android and iOS, saving to the gallery can fail if the user didn't grant the required permissions. On Web there is no gallery, so always returns false.
|
|
202
|
+
| Prop | Type | Description | Since |
|
|
203
|
+
| ------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
|
|
204
|
+
| **`base64String`** | <code>string</code> | The base64 encoded string representation of the image, if using <a href="#cameraresulttype">CameraResultType.Base64</a>. | 1.0.0 |
|
|
205
|
+
| **`dataUrl`** | <code>string</code> | The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using <a href="#cameraresulttype">CameraResultType.DataUrl</a>. Note: On web, the file format could change depending on the browser. | 1.0.0 |
|
|
206
|
+
| **`path`** | <code>string</code> | If using <a href="#cameraresulttype">CameraResultType.Uri</a>, the path will contain a full, platform-specific file URL that can be read later using the Filesystem API. | 1.0.0 |
|
|
207
|
+
| **`webPath`** | <code>string</code> | webPath returns a path that can be used to set the src attribute of an image for efficient loading and rendering. | 1.0.0 |
|
|
208
|
+
| **`exif`** | <code>any</code> | Exif data, if any, retrieved from the image | 1.0.0 |
|
|
209
|
+
| **`format`** | <code>string</code> | The format of the image, ex: jpeg, png, gif. iOS and Android only support jpeg. Web supports jpeg, png and gif, but the exact availability may vary depending on the browser. gif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`. | 1.0.0 |
|
|
210
|
+
| **`saved`** | <code>boolean</code> | Whether if the image was saved to the gallery or not. On Android and iOS, saving to the gallery can fail if the user didn't grant the required permissions. On Web there is no gallery, so always returns false. | 1.1.0 |
|
|
211
211
|
|
|
212
212
|
|
|
213
213
|
#### ImageOptions
|
|
214
214
|
|
|
215
215
|
| Prop | Type | Description | Default | Since |
|
|
216
216
|
| ------------------------ | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ----- |
|
|
217
|
-
| **`quality`** | <code>number</code> | The quality of image to return as JPEG, from 0-100
|
|
217
|
+
| **`quality`** | <code>number</code> | The quality of image to return as JPEG, from 0-100 Note: This option is only supported on Android and iOS | | 1.0.0 |
|
|
218
218
|
| **`allowEditing`** | <code>boolean</code> | Whether to allow the user to crop or make small edits (platform specific). On iOS 14+ it's only supported for <a href="#camerasource">CameraSource.Camera</a>, but not for <a href="#camerasource">CameraSource.Photos</a>. | | 1.0.0 |
|
|
219
219
|
| **`resultType`** | <code><a href="#cameraresulttype">CameraResultType</a></code> | How the data should be returned. Currently, only 'Base64', 'DataUrl' or 'Uri' is supported | | 1.0.0 |
|
|
220
220
|
| **`saveToGallery`** | <code>boolean</code> | Whether to save the photo to the gallery. If the photo was picked from the gallery, it will only be saved if edited. | <code>: false</code> | 1.0.0 |
|
|
@@ -250,14 +250,14 @@ Request camera and photo album permissions
|
|
|
250
250
|
|
|
251
251
|
#### GalleryImageOptions
|
|
252
252
|
|
|
253
|
-
| Prop | Type | Description
|
|
254
|
-
| ------------------------ | -------------------------------------- |
|
|
255
|
-
| **`quality`** | <code>number</code> | The quality of image to return as JPEG, from 0-100
|
|
256
|
-
| **`width`** | <code>number</code> | The desired maximum width of the saved image. The aspect ratio is respected.
|
|
257
|
-
| **`height`** | <code>number</code> | The desired maximum height of the saved image. The aspect ratio is respected.
|
|
258
|
-
| **`correctOrientation`** | <code>boolean</code> | Whether to automatically rotate the image "up" to correct for orientation in portrait mode
|
|
259
|
-
| **`presentationStyle`** | <code>'fullscreen' \| 'popover'</code> | iOS only: The presentation style of the Camera.
|
|
260
|
-
| **`limit`** | <code>number</code> | iOS only: Maximum number of pictures the user will be able to choose.
|
|
253
|
+
| Prop | Type | Description | Default | Since |
|
|
254
|
+
| ------------------------ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------- | --------------------------- | ----- |
|
|
255
|
+
| **`quality`** | <code>number</code> | The quality of image to return as JPEG, from 0-100 Note: This option is only supported on Android and iOS. | | 1.2.0 |
|
|
256
|
+
| **`width`** | <code>number</code> | The desired maximum width of the saved image. The aspect ratio is respected. | | 1.2.0 |
|
|
257
|
+
| **`height`** | <code>number</code> | The desired maximum height of the saved image. The aspect ratio is respected. | | 1.2.0 |
|
|
258
|
+
| **`correctOrientation`** | <code>boolean</code> | Whether to automatically rotate the image "up" to correct for orientation in portrait mode | <code>: true</code> | 1.2.0 |
|
|
259
|
+
| **`presentationStyle`** | <code>'fullscreen' \| 'popover'</code> | iOS only: The presentation style of the Camera. | <code>: 'fullscreen'</code> | 1.2.0 |
|
|
260
|
+
| **`limit`** | <code>number</code> | iOS only: Maximum number of pictures the user will be able to choose. | <code>0 (unlimited)</code> | 1.2.0 |
|
|
261
261
|
|
|
262
262
|
|
|
263
263
|
#### PermissionStatus
|
package/dist/docs.json
CHANGED
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"name": "since"
|
|
160
160
|
}
|
|
161
161
|
],
|
|
162
|
-
"docs": "The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.",
|
|
162
|
+
"docs": "The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.\n\nNote: On web, the file format could change depending on the browser.",
|
|
163
163
|
"complexTypes": [],
|
|
164
164
|
"type": "string | undefined"
|
|
165
165
|
},
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
"name": "since"
|
|
208
208
|
}
|
|
209
209
|
],
|
|
210
|
-
"docs": "The format of the image, ex: jpeg, png, gif.\n\niOS and Android only support jpeg.\nWeb supports jpeg and
|
|
210
|
+
"docs": "The format of the image, ex: jpeg, png, gif.\n\niOS and Android only support jpeg.\nWeb supports jpeg, png and gif, but the exact availability may vary depending on the browser.\ngif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`.",
|
|
211
211
|
"complexTypes": [],
|
|
212
212
|
"type": "string"
|
|
213
213
|
},
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
"name": "since"
|
|
241
241
|
}
|
|
242
242
|
],
|
|
243
|
-
"docs": "The quality of image to return as JPEG, from 0-100",
|
|
243
|
+
"docs": "The quality of image to return as JPEG, from 0-100\nNote: This option is only supported on Android and iOS",
|
|
244
244
|
"complexTypes": [],
|
|
245
245
|
"type": "number | undefined"
|
|
246
246
|
},
|
|
@@ -551,7 +551,7 @@
|
|
|
551
551
|
"name": "since"
|
|
552
552
|
}
|
|
553
553
|
],
|
|
554
|
-
"docs": "The quality of image to return as JPEG, from 0-100",
|
|
554
|
+
"docs": "The quality of image to return as JPEG, from 0-100\nNote: This option is only supported on Android and iOS.",
|
|
555
555
|
"complexTypes": [],
|
|
556
556
|
"type": "number | undefined"
|
|
557
557
|
},
|
|
@@ -53,6 +53,7 @@ export interface CameraPlugin {
|
|
|
53
53
|
export interface ImageOptions {
|
|
54
54
|
/**
|
|
55
55
|
* The quality of image to return as JPEG, from 0-100
|
|
56
|
+
* Note: This option is only supported on Android and iOS
|
|
56
57
|
*
|
|
57
58
|
* @since 1.0.0
|
|
58
59
|
*/
|
|
@@ -173,6 +174,7 @@ export interface Photo {
|
|
|
173
174
|
/**
|
|
174
175
|
* The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.
|
|
175
176
|
*
|
|
177
|
+
* Note: On web, the file format could change depending on the browser.
|
|
176
178
|
* @since 1.0.0
|
|
177
179
|
*/
|
|
178
180
|
dataUrl?: string;
|
|
@@ -200,7 +202,8 @@ export interface Photo {
|
|
|
200
202
|
* The format of the image, ex: jpeg, png, gif.
|
|
201
203
|
*
|
|
202
204
|
* iOS and Android only support jpeg.
|
|
203
|
-
* Web supports jpeg and
|
|
205
|
+
* Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.
|
|
206
|
+
* gif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`.
|
|
204
207
|
*
|
|
205
208
|
* @since 1.0.0
|
|
206
209
|
*/
|
|
@@ -257,6 +260,7 @@ export interface GalleryPhoto {
|
|
|
257
260
|
export interface GalleryImageOptions {
|
|
258
261
|
/**
|
|
259
262
|
* The quality of image to return as JPEG, from 0-100
|
|
263
|
+
* Note: This option is only supported on Android and iOS.
|
|
260
264
|
*
|
|
261
265
|
* @since 1.2.0
|
|
262
266
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsUA,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,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B","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 * 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 */\n getPhoto(options: ImageOptions): Promise<Photo>;\n\n /**\n * Allows the user to pick multiple pictures from the photo gallery.\n * On iOS 13 and older it only allows to pick one picture.\n *\n * @since 1.2.0\n */\n pickImages(options: GalleryImageOptions): Promise<GalleryPhotos>;\n\n /**\n * iOS 14+ Only: Allows the user to update their limited photo library selection.\n * On iOS 15+ returns all the limited photos after the picker dismissal.\n * On iOS 14 or if 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 * iOS 14+ Only: 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(\n permissions?: CameraPluginPermissions,\n ): Promise<PermissionStatus>;\n}\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 * On iOS 14+ 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 * @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 *\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 *\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 * @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\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}\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 * iOS only: Maximum number of pictures the user will be able to choose.\n * @default 0 (unlimited)\n *\n * @since 1.2.0\n */\n limit?: number;\n}\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\nexport enum CameraResultType {\n Uri = 'uri',\n Base64 = 'base64',\n DataUrl = 'dataUrl',\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": "5.0.0
|
|
3
|
+
"version": "5.0.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",
|