expo-camera 13.0.0 → 13.2.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/CHANGELOG.md +21 -0
- package/README.md +1 -1
- package/android/build.gradle +4 -4
- package/android/src/main/java/expo/modules/camera/CameraViewModule.kt +3 -0
- package/android/src/main/java/expo/modules/camera/Options.kt +1 -0
- package/android/src/main/java/expo/modules/camera/tasks/ResolveTakenPictureAsyncTask.kt +38 -9
- package/build/Camera.d.ts +2 -6
- package/build/Camera.d.ts.map +1 -1
- package/build/Camera.js +0 -4
- package/build/Camera.js.map +1 -1
- package/build/Camera.types.d.ts +88 -65
- package/build/Camera.types.d.ts.map +1 -1
- package/build/Camera.types.js +5 -2
- package/build/Camera.types.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/ios/EXCamera/CameraViewModule.swift +1 -1
- package/ios/EXCamera/EXCamera.m +1 -1
- package/package.json +2 -2
- package/src/Camera.tsx +0 -4
- package/src/Camera.types.ts +79 -52
- package/src/index.ts +1 -23
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,27 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 13.2.0 — 2023-02-03
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fix path where simulator saves photos ([#20872](https://github.com/expo/expo/pull/20872) by [@pettomartino](https://github.com/pettomartino))
|
|
18
|
+
- Fixed `Cannot set prop 'barCodeScannerSettings' on view 'class expo.modules.camera.ExpoCameraView'` on Android. ([#21033](https://github.com/expo/expo/pull/21033) by [@lukmccall](https://github.com/lukmccall))
|
|
19
|
+
|
|
20
|
+
### 💡 Others
|
|
21
|
+
|
|
22
|
+
- On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
|
|
23
|
+
|
|
24
|
+
## 13.1.0 - 2022-11-23
|
|
25
|
+
|
|
26
|
+
### 🐛 Bug fixes
|
|
27
|
+
|
|
28
|
+
- Fix import issue on case-sensitive file systems ([#20141](https://github.com/expo/expo/pull/20141) by [@hirbod](https://github.com/hirbod))
|
|
29
|
+
|
|
30
|
+
### 💡 Others
|
|
31
|
+
|
|
32
|
+
- Use correct type for `videoStabilizationMode` option. ([#20130](https://github.com/expo/expo/pull/20130) by [@simek](https://github.com/simek))
|
|
33
|
+
|
|
13
34
|
## 13.0.0 — 2022-10-25
|
|
14
35
|
|
|
15
36
|
### 🐛 Bug fixes
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A React component that renders a preview for the device's either front or back c
|
|
|
4
4
|
|
|
5
5
|
# API documentation
|
|
6
6
|
|
|
7
|
-
- [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/camera.
|
|
7
|
+
- [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/camera.mdx)
|
|
8
8
|
- [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/camera/)
|
|
9
9
|
|
|
10
10
|
# Installation in managed Expo projects
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '13.
|
|
6
|
+
version = '13.2.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -59,7 +59,7 @@ afterEvaluate {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
android {
|
|
62
|
-
compileSdkVersion safeExtGet("compileSdkVersion",
|
|
62
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
|
63
63
|
|
|
64
64
|
compileOptions {
|
|
65
65
|
sourceCompatibility JavaVersion.VERSION_11
|
|
@@ -72,9 +72,9 @@ android {
|
|
|
72
72
|
|
|
73
73
|
defaultConfig {
|
|
74
74
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
75
|
-
targetSdkVersion safeExtGet("targetSdkVersion",
|
|
75
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
76
76
|
versionCode 32
|
|
77
|
-
versionName "13.
|
|
77
|
+
versionName "13.2.0"
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
lintOptions {
|
|
@@ -228,6 +228,9 @@ class CameraViewModule : Module() {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
Prop("barCodeScannerSettings") { view: ExpoCameraView, settings: Map<String, Any?>? ->
|
|
231
|
+
if (settings == null) {
|
|
232
|
+
return@Prop
|
|
233
|
+
}
|
|
231
234
|
view.setBarCodeScannerSettings(BarCodeScannerSettings(settings))
|
|
232
235
|
}
|
|
233
236
|
|
|
@@ -25,7 +25,9 @@ private const val DIRECTORY_NOT_FOUND_MSG = "Documents directory of the app coul
|
|
|
25
25
|
private const val UNKNOWN_IO_EXCEPTION_MSG = "An unknown I/O exception has occurred."
|
|
26
26
|
private const val UNKNOWN_EXCEPTION_MSG = "An unknown exception has occurred."
|
|
27
27
|
private const val PARAMETER_EXCEPTION_MSG = "An incompatible parameter has been passed in. "
|
|
28
|
+
private const val OUT_OF_MEMORY_EXCEPTION_MSG = "Cannot allocate enough space to process the taken picture."
|
|
28
29
|
private const val ERROR_TAG = "E_TAKING_PICTURE_FAILED"
|
|
30
|
+
private const val OUT_OF_MEMORY_TAG = "ERR_CAMERA_OUT_OF_MEMORY"
|
|
29
31
|
private const val DIRECTORY_NAME = "Camera"
|
|
30
32
|
private const val EXTENSION = ".jpg"
|
|
31
33
|
private const val BASE64_KEY = "base64"
|
|
@@ -53,8 +55,6 @@ class ResolveTakenPictureAsyncTask(
|
|
|
53
55
|
return handleSkipProcessing()
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
var bitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.size)
|
|
57
|
-
|
|
58
58
|
// set, read, and apply EXIF data
|
|
59
59
|
try {
|
|
60
60
|
ByteArrayInputStream(imageData).use { inputStream ->
|
|
@@ -73,9 +73,28 @@ class ResolveTakenPictureAsyncTask(
|
|
|
73
73
|
ExifInterface.ORIENTATION_UNDEFINED
|
|
74
74
|
)
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
val bitmapOptions = BitmapFactory
|
|
77
|
+
.Options()
|
|
78
|
+
.apply {
|
|
79
|
+
inSampleSize = 1
|
|
80
|
+
}
|
|
81
|
+
var bitmap: Bitmap? = null
|
|
82
|
+
var lastError: Error? = null
|
|
83
|
+
|
|
84
|
+
// If OOM exception was thrown, we try to use downsampling to recover.
|
|
85
|
+
while (bitmapOptions.inSampleSize <= options.maxDownsampling) {
|
|
86
|
+
try {
|
|
87
|
+
bitmap = decodeBitmap(imageData, orientation, bitmapOptions)
|
|
88
|
+
break
|
|
89
|
+
} catch (exception: OutOfMemoryError) {
|
|
90
|
+
bitmapOptions.inSampleSize *= 2
|
|
91
|
+
lastError = exception
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (bitmap == null) {
|
|
96
|
+
promise.reject(OUT_OF_MEMORY_TAG, OUT_OF_MEMORY_EXCEPTION_MSG, lastError)
|
|
97
|
+
return null
|
|
79
98
|
}
|
|
80
99
|
|
|
81
100
|
// Write Exif data to the response if requested
|
|
@@ -86,13 +105,13 @@ class ResolveTakenPictureAsyncTask(
|
|
|
86
105
|
|
|
87
106
|
// Upon rotating, write the image's dimensions to the response
|
|
88
107
|
response.apply {
|
|
89
|
-
putInt(WIDTH_KEY, bitmap
|
|
90
|
-
putInt(HEIGHT_KEY, bitmap
|
|
108
|
+
putInt(WIDTH_KEY, bitmap.width)
|
|
109
|
+
putInt(HEIGHT_KEY, bitmap.height)
|
|
91
110
|
}
|
|
92
111
|
|
|
93
112
|
// Cache compressed image in imageStream
|
|
94
113
|
ByteArrayOutputStream().use { imageStream ->
|
|
95
|
-
bitmap
|
|
114
|
+
bitmap.compress(Bitmap.CompressFormat.JPEG, quality, imageStream)
|
|
96
115
|
// Write compressed image to file in cache directory
|
|
97
116
|
val filePath = writeStreamToFile(imageStream)
|
|
98
117
|
|
|
@@ -199,7 +218,17 @@ class ResolveTakenPictureAsyncTask(
|
|
|
199
218
|
return null
|
|
200
219
|
}
|
|
201
220
|
|
|
202
|
-
private fun
|
|
221
|
+
private fun decodeBitmap(imageData: ByteArray, orientation: Int, bitmapOptions: BitmapFactory.Options): Bitmap {
|
|
222
|
+
// Rotate the bitmap to the proper orientation if needed
|
|
223
|
+
return if (orientation != ExifInterface.ORIENTATION_UNDEFINED) {
|
|
224
|
+
decodeAndRotateBitmap(imageData, getImageRotation(orientation), bitmapOptions)
|
|
225
|
+
} else {
|
|
226
|
+
BitmapFactory.decodeByteArray(imageData, 0, imageData.size, bitmapOptions)
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
private fun decodeAndRotateBitmap(imageData: ByteArray, angle: Int, options: BitmapFactory.Options): Bitmap {
|
|
231
|
+
val source = BitmapFactory.decodeByteArray(imageData, 0, imageData.size, options)
|
|
203
232
|
val matrix = Matrix()
|
|
204
233
|
matrix.postRotate(angle.toFloat())
|
|
205
234
|
return Bitmap.createBitmap(source, 0, 0, source.width, source.height, matrix, true)
|
package/build/Camera.d.ts
CHANGED
|
@@ -104,10 +104,6 @@ export default class Camera extends React.Component<CameraProps> {
|
|
|
104
104
|
*
|
|
105
105
|
* > On native platforms, the local image URI is temporary. Use [`FileSystem.copyAsync`](filesystem.md#filesystemcopyasyncoptions)
|
|
106
106
|
* > to make a permanent copy of the image.
|
|
107
|
-
*
|
|
108
|
-
* > On web, the `uri` is a base64 representation of the image because file system URLs are not supported in the browser.
|
|
109
|
-
* > The `exif` data returned on web is a partial representation of the [`MediaTrackSettings`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings),
|
|
110
|
-
* > if available.
|
|
111
107
|
*/
|
|
112
108
|
takePictureAsync(options?: CameraPictureOptions): Promise<CameraCapturedPicture>;
|
|
113
109
|
/**
|
|
@@ -153,10 +149,10 @@ export default class Camera extends React.Component<CameraProps> {
|
|
|
153
149
|
message: string;
|
|
154
150
|
};
|
|
155
151
|
}) => void;
|
|
156
|
-
_onObjectDetected: (callback?: Function
|
|
152
|
+
_onObjectDetected: (callback?: Function) => ({ nativeEvent }: {
|
|
157
153
|
nativeEvent: any;
|
|
158
154
|
}) => void;
|
|
159
|
-
_setReference: (ref?: React.Component
|
|
155
|
+
_setReference: (ref?: React.Component) => void;
|
|
160
156
|
render(): JSX.Element;
|
|
161
157
|
}
|
|
162
158
|
export declare const Constants: ConstantsType, getPermissionsAsync: typeof Camera.getPermissionsAsync, requestPermissionsAsync: typeof Camera.requestPermissionsAsync, getCameraPermissionsAsync: typeof Camera.getCameraPermissionsAsync, requestCameraPermissionsAsync: typeof Camera.requestCameraPermissionsAsync, getMicrophonePermissionsAsync: typeof Camera.getMicrophonePermissionsAsync, requestMicrophonePermissionsAsync: typeof Camera.requestMicrophonePermissionsAsync;
|
package/build/Camera.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.d.ts","sourceRoot":"","sources":["../src/Camera.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,UAAU,EACX,MAAM,gBAAgB,CAAC;AAoDxB,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IAC9D;;;;;OAKG;WACU,gBAAgB,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;;;;;;;;;;;;;;;OAeG;IACG,gBAAgB,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAMtF;;;;OAIG;IACG,uBAAuB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQlD;;;;;OAKG;IACG,6BAA6B,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAOtE;;;;;;;;OAQG;IACG,WAAW,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAS7E;;OAEG;IACH,aAAa;IAQb;;OAEG;IACH,YAAY;IAQZ;;OAEG;IACH,aAAa;IAQb,cAAc,aAIZ;IAEF,aAAa;qBAAoC;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE;eAIlE;IAEF,iBAAiB,cACH,QAAQ;qBACa,GAAG;eAgBlC;IAEJ,aAAa,SAAU,MAAM,SAAS,UAapC;IAEF,MAAM;CAqBP;AAED,eAAO,MACL,SAAS,iBACT,mBAAmB,qCACnB,uBAAuB,yCACvB,yBAAyB,2CACzB,6BAA6B,+CAC7B,6BAA6B,+CAC7B,iCAAiC,iDACzB,CAAC"}
|
package/build/Camera.js
CHANGED
|
@@ -196,10 +196,6 @@ export default class Camera extends React.Component {
|
|
|
196
196
|
*
|
|
197
197
|
* > On native platforms, the local image URI is temporary. Use [`FileSystem.copyAsync`](filesystem.md#filesystemcopyasyncoptions)
|
|
198
198
|
* > to make a permanent copy of the image.
|
|
199
|
-
*
|
|
200
|
-
* > On web, the `uri` is a base64 representation of the image because file system URLs are not supported in the browser.
|
|
201
|
-
* > The `exif` data returned on web is a partial representation of the [`MediaTrackSettings`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings),
|
|
202
|
-
* > if available.
|
|
203
199
|
*/
|
|
204
200
|
async takePictureAsync(options) {
|
|
205
201
|
const pictureOptions = ensurePictureOptions(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KAAK,EAAE;gBACzB,IAAI,CAAC,aAAa,GAAG,GAAU,CAAC;aACjC;iBAAM;gBACL,IAAI,CAAC,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;aAC1C;SACF;aAAM;YACL,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC3B;IACH,CAAC,CAAC;IAEF,MAAM;QACJ,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAElD,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB;YAClD,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACrD,CAAC,CAAC,SAAS,CAAC;QAEd,MAAM,eAAe,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAE3E,OAAO,CACL,oBAAC,cAAc,OACT,WAAW,EACf,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,aAAa,EAAE,IAAI,CAAC,cAAc,EAClC,YAAY,EAAE,IAAI,CAAC,aAAa,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,eAAe,GAC/B,CACH,CAAC;IACJ,CAAC;;AAGH,MAAM,CAAC,MAAM,EACX,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,GAClC,GAAG,MAAM,CAAC","sourcesContent":["import { createPermissionHook, Platform, UnavailabilityError } from 'expo-modules-core';\nimport * as React from 'react';\nimport { findNodeHandle } from 'react-native';\n\nimport {\n CameraCapturedPicture,\n CameraPictureOptions,\n CameraProps,\n CameraRecordingOptions,\n CameraType,\n ConstantsType,\n PermissionResponse,\n VideoCodec,\n} from './Camera.types';\nimport ExponentCamera from './ExponentCamera';\nimport CameraManager from './ExponentCameraManager';\nimport { ConversionTables, ensureNativeProps } from './utils/props';\n\nconst EventThrottleMs = 500;\n\nconst _PICTURE_SAVED_CALLBACKS = {};\n\nlet _GLOBAL_PICTURE_ID = 1;\n\nfunction ensurePictureOptions(options?: CameraPictureOptions): CameraPictureOptions {\n const pictureOptions: CameraPictureOptions =\n !options || typeof options !== 'object' ? {} : options;\n\n if (!pictureOptions.quality) {\n pictureOptions.quality = 1;\n }\n if (pictureOptions.onPictureSaved) {\n const id = _GLOBAL_PICTURE_ID++;\n _PICTURE_SAVED_CALLBACKS[id] = pictureOptions.onPictureSaved;\n pictureOptions.id = id;\n pictureOptions.fastMode = true;\n }\n return pictureOptions;\n}\n\nfunction ensureRecordingOptions(options?: CameraRecordingOptions): CameraRecordingOptions {\n let recordingOptions = options || {};\n\n if (!recordingOptions || typeof recordingOptions !== 'object') {\n recordingOptions = {};\n } else if (typeof recordingOptions.quality === 'string') {\n recordingOptions.quality = Camera.Constants.VideoQuality[recordingOptions.quality];\n }\n\n return recordingOptions;\n}\n\nfunction _onPictureSaved({\n nativeEvent,\n}: {\n nativeEvent: { data: CameraCapturedPicture; id: number };\n}) {\n const { id, data } = nativeEvent;\n const callback = _PICTURE_SAVED_CALLBACKS[id];\n if (callback) {\n callback(data);\n delete _PICTURE_SAVED_CALLBACKS[id];\n }\n}\n\nexport default class Camera extends React.Component<CameraProps> {\n /**\n * Check whether the current device has a camera. This is useful for web and simulators cases.\n * This isn't influenced by the Permissions API (all platforms), or HTTP usage (in the browser).\n * You will still need to check if the native permission has been accepted.\n * @platform web\n */\n static async isAvailableAsync(): Promise<boolean> {\n if (!CameraManager.isAvailableAsync) {\n throw new UnavailabilityError('expo-camera', 'isAvailableAsync');\n }\n\n return await CameraManager.isAvailableAsync();\n }\n\n /**\n * Returns a list of camera types `['front', 'back']`. This is useful for desktop browsers which only have front-facing cameras.\n * @platform web\n */\n static async getAvailableCameraTypesAsync(): Promise<CameraType[]> {\n if (!CameraManager.getAvailableCameraTypesAsync) {\n throw new UnavailabilityError('expo-camera', 'getAvailableCameraTypesAsync');\n }\n\n return await CameraManager.getAvailableCameraTypesAsync();\n }\n\n // @needsAudit\n /**\n * Queries the device for the available video codecs that can be used in video recording.\n * @return A promise that resolves to a list of strings that represents available codecs.\n * @platform ios\n */\n static async getAvailableVideoCodecsAsync(): Promise<VideoCodec[]> {\n if (!CameraManager.getAvailableVideoCodecsAsync) {\n throw new UnavailabilityError('Camera', 'getAvailableVideoCodecsAsync');\n }\n\n return await CameraManager.getAvailableVideoCodecsAsync();\n }\n\n static Constants: ConstantsType = {\n Type: CameraManager.Type,\n FlashMode: CameraManager.FlashMode,\n AutoFocus: CameraManager.AutoFocus,\n WhiteBalance: CameraManager.WhiteBalance,\n VideoQuality: CameraManager.VideoQuality,\n VideoStabilization: CameraManager.VideoStabilization || {},\n VideoCodec: CameraManager.VideoCodec,\n };\n\n // Values under keys from this object will be transformed to native options\n static ConversionTables = ConversionTables;\n\n static defaultProps: CameraProps = {\n zoom: 0,\n ratio: '4:3',\n focusDepth: 0,\n faceDetectorSettings: {},\n type: CameraManager.Type.back,\n autoFocus: CameraManager.AutoFocus.on,\n flashMode: CameraManager.FlashMode.off,\n whiteBalance: CameraManager.WhiteBalance.auto,\n };\n\n // @needsAudit\n /**\n * @deprecated Use `getCameraPermissionsAsync` or `getMicrophonePermissionsAsync` instead.\n * Checks user's permissions for accessing camera.\n */\n static async getPermissionsAsync(): Promise<PermissionResponse> {\n console.warn(\n `\"getPermissionsAsync()\" is now deprecated. Please use \"getCameraPermissionsAsync()\" or \"getMicrophonePermissionsAsync()\" instead.`\n );\n return CameraManager.getPermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Asks the user to grant permissions for accessing camera.\n * On iOS this will require apps to specify both `NSCameraUsageDescription` and `NSMicrophoneUsageDescription` entries in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n * @deprecated Use `requestCameraPermissionsAsync` or `requestMicrophonePermissionsAsync` instead.\n */\n static async requestPermissionsAsync(): Promise<PermissionResponse> {\n console.warn(\n `\"requestPermissionsAsync()\" is now deprecated. Please use \"requestCameraPermissionsAsync()\" or \"requestMicrophonePermissionsAsync()\" instead.`\n );\n return CameraManager.requestPermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Checks user's permissions for accessing camera.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\n static async getCameraPermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.getCameraPermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Asks the user to grant permissions for accessing camera.\n * On iOS this will require apps to specify an `NSCameraUsageDescription` entry in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\n static async requestCameraPermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.requestCameraPermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Check or request permissions to access the camera.\n * This uses both `requestCameraPermissionsAsync` and `getCameraPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Camera.useCameraPermissions();\n * ```\n */\n static useCameraPermissions = createPermissionHook({\n getMethod: Camera.getCameraPermissionsAsync,\n requestMethod: Camera.requestCameraPermissionsAsync,\n });\n\n // @needsAudit\n /**\n * Checks user's permissions for accessing microphone.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\n static async getMicrophonePermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.getMicrophonePermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Asks the user to grant permissions for accessing the microphone.\n * On iOS this will require apps to specify an `NSMicrophoneUsageDescription` entry in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\n static async requestMicrophonePermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.requestMicrophonePermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Check or request permissions to access the microphone.\n * This uses both `requestMicrophonePermissionsAsync` and `getMicrophonePermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Camera.useMicrophonePermissions();\n * ```\n */\n static useMicrophonePermissions = createPermissionHook({\n getMethod: Camera.getMicrophonePermissionsAsync,\n requestMethod: Camera.requestMicrophonePermissionsAsync,\n });\n\n _cameraHandle?: number | null;\n _cameraRef?: React.Component | null;\n _lastEvents: { [eventName: string]: string } = {};\n _lastEventsTimes: { [eventName: string]: Date } = {};\n\n // @needsAudit\n /**\n * Takes a picture and saves it to app's cache directory. Photos are rotated to match device's orientation\n * (if `options.skipProcessing` flag is not enabled) and scaled to match the preview. Anyway on Android it is essential\n * to set ratio prop to get a picture with correct dimensions.\n * > **Note**: Make sure to wait for the [`onCameraReady`](#oncameraready) callback before calling this method.\n * @param options An object in form of `CameraPictureOptions` type.\n * @return Returns a Promise that resolves to `CameraCapturedPicture` object, where `uri` is a URI to the local image file on iOS,\n * Android, and a base64 string on web (usable as the source for an `Image` element). The `width` and `height` properties specify\n * the dimensions of the image. `base64` is included if the `base64` option was truthy, and is a string containing the JPEG data\n * of the image in Base64--prepend that with `'data:image/jpg;base64,'` to get a data URI, which you can use as the source\n * for an `Image` element for example. `exif` is included if the `exif` option was truthy, and is an object containing EXIF\n * data for the image--the names of its properties are EXIF tags and their values are the values for those tags.\n *\n * > On native platforms, the local image URI is temporary. Use [`FileSystem.copyAsync`](filesystem.md#filesystemcopyasyncoptions)\n * > to make a permanent copy of the image.\n *\n * > On web, the `uri` is a base64 representation of the image because file system URLs are not supported in the browser.\n * > The `exif` data returned on web is a partial representation of the [`MediaTrackSettings`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings),\n * > if available.\n */\n async takePictureAsync(options?: CameraPictureOptions): Promise<CameraCapturedPicture> {\n const pictureOptions = ensurePictureOptions(options);\n\n return await CameraManager.takePicture(pictureOptions, this._cameraHandle);\n }\n\n /**\n * Get aspect ratios that are supported by the device and can be passed via `ratio` prop.\n * @return Returns a Promise that resolves to an array of strings representing ratios, eg. `['4:3', '1:1']`.\n * @platform android\n */\n async getSupportedRatiosAsync(): Promise<string[]> {\n if (!CameraManager.getSupportedRatios) {\n throw new UnavailabilityError('Camera', 'getSupportedRatiosAsync');\n }\n\n return await CameraManager.getSupportedRatios(this._cameraHandle);\n }\n\n /**\n * Get picture sizes that are supported by the device for given `ratio`.\n * @param ratio A string representing aspect ratio of sizes to be returned.\n * @return Returns a Promise that resolves to an array of strings representing picture sizes that can be passed to `pictureSize` prop.\n * The list varies across Android devices but is the same for every iOS.\n */\n async getAvailablePictureSizesAsync(ratio?: string): Promise<string[]> {\n if (!CameraManager.getAvailablePictureSizes) {\n throw new UnavailabilityError('Camera', 'getAvailablePictureSizesAsync');\n }\n return await CameraManager.getAvailablePictureSizes(ratio, this._cameraHandle);\n }\n\n /**\n * Starts recording a video that will be saved to cache directory. Videos are rotated to match device's orientation.\n * Flipping camera during a recording results in stopping it.\n * @param options A map of `CameraRecordingOptions` type.\n * @return Returns a Promise that resolves to an object containing video file `uri` property and a `codec` property on iOS.\n * The Promise is returned if `stopRecording` was invoked, one of `maxDuration` and `maxFileSize` is reached or camera preview is stopped.\n * @platform android\n * @platform ios\n */\n async recordAsync(options?: CameraRecordingOptions): Promise<{ uri: string }> {\n if (!CameraManager.record) {\n throw new UnavailabilityError('Camera', 'recordAsync');\n }\n\n const recordingOptions = ensureRecordingOptions(options);\n return await CameraManager.record(recordingOptions, this._cameraHandle);\n }\n\n /**\n * Stops recording if any is in progress.\n */\n stopRecording() {\n if (!CameraManager.stopRecording) {\n throw new UnavailabilityError('Camera', 'stopRecording');\n }\n\n CameraManager.stopRecording(this._cameraHandle);\n }\n\n /**\n * Pauses the camera preview. It is not recommended to use `takePictureAsync` when preview is paused.\n */\n pausePreview() {\n if (!CameraManager.pausePreview) {\n throw new UnavailabilityError('Camera', 'pausePreview');\n }\n\n CameraManager.pausePreview(this._cameraHandle);\n }\n\n /**\n * Resumes the camera preview.\n */\n resumePreview() {\n if (!CameraManager.resumePreview) {\n throw new UnavailabilityError('Camera', 'resumePreview');\n }\n\n CameraManager.resumePreview(this._cameraHandle);\n }\n\n _onCameraReady = () => {\n if (this.props.onCameraReady) {\n this.props.onCameraReady();\n }\n };\n\n _onMountError = ({ nativeEvent }: { nativeEvent: { message: string } }) => {\n if (this.props.onMountError) {\n this.props.onMountError(nativeEvent);\n }\n };\n\n _onObjectDetected =\n (callback?: Function) =>\n ({ nativeEvent }: { nativeEvent: any }) => {\n const { type } = nativeEvent;\n if (\n this._lastEvents[type] &&\n this._lastEventsTimes[type] &&\n JSON.stringify(nativeEvent) === this._lastEvents[type] &&\n new Date().getTime() - this._lastEventsTimes[type].getTime() < EventThrottleMs\n ) {\n return;\n }\n\n if (callback) {\n callback(nativeEvent);\n this._lastEventsTimes[type] = new Date();\n this._lastEvents[type] = JSON.stringify(nativeEvent);\n }\n };\n\n _setReference = (ref?: React.Component) => {\n if (ref) {\n this._cameraRef = ref;\n // TODO(Bacon): Unify these - perhaps with hooks?\n if (Platform.OS === 'web') {\n this._cameraHandle = ref as any;\n } else {\n this._cameraHandle = findNodeHandle(ref);\n }\n } else {\n this._cameraRef = null;\n this._cameraHandle = null;\n }\n };\n\n render() {\n const nativeProps = ensureNativeProps(this.props);\n\n const onBarCodeScanned = this.props.onBarCodeScanned\n ? this._onObjectDetected(this.props.onBarCodeScanned)\n : undefined;\n\n const onFacesDetected = this._onObjectDetected(this.props.onFacesDetected);\n\n return (\n <ExponentCamera\n {...nativeProps}\n ref={this._setReference}\n onCameraReady={this._onCameraReady}\n onMountError={this._onMountError}\n onBarCodeScanned={onBarCodeScanned}\n onFacesDetected={onFacesDetected}\n onPictureSaved={_onPictureSaved}\n />\n );\n }\n}\n\nexport const {\n Constants,\n getPermissionsAsync,\n requestPermissionsAsync,\n getCameraPermissionsAsync,\n requestCameraPermissionsAsync,\n getMicrophonePermissionsAsync,\n requestMicrophonePermissionsAsync,\n} = Camera;\n"]}
|
|
1
|
+
{"version":3,"file":"Camera.js","source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AAa,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;aAC1C;SACF;aAAM;YACL,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC3B;IACH,CAAC,CAAC;IAEF,MAAM;QACJ,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAElD,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB;YAClD,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACrD,CAAC,CAAC,SAAS,CAAC;QAEd,MAAM,eAAe,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAE3E,OAAO,CACL,oBAAC,cAAc,OACT,WAAW,EACf,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,aAAa,EAAE,IAAI,CAAC,cAAc,EAClC,YAAY,EAAE,IAAI,CAAC,aAAa,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,eAAe,GAC/B,CACH,CAAC;IACJ,CAAC;;AAGH,MAAM,CAAC,MAAM,EACX,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,GAClC,GAAG,MAAM,CAAC","sourcesContent":["import { createPermissionHook, Platform, UnavailabilityError } from 'expo-modules-core';\nimport * as React from 'react';\nimport { findNodeHandle } from 'react-native';\n\nimport {\n CameraCapturedPicture,\n CameraPictureOptions,\n CameraProps,\n CameraRecordingOptions,\n CameraType,\n ConstantsType,\n PermissionResponse,\n VideoCodec,\n} from './Camera.types';\nimport ExponentCamera from './ExponentCamera';\nimport CameraManager from './ExponentCameraManager';\nimport { ConversionTables, ensureNativeProps } from './utils/props';\n\nconst EventThrottleMs = 500;\n\nconst _PICTURE_SAVED_CALLBACKS = {};\n\nlet _GLOBAL_PICTURE_ID = 1;\n\nfunction ensurePictureOptions(options?: CameraPictureOptions): CameraPictureOptions {\n const pictureOptions: CameraPictureOptions =\n !options || typeof options !== 'object' ? {} : options;\n\n if (!pictureOptions.quality) {\n pictureOptions.quality = 1;\n }\n if (pictureOptions.onPictureSaved) {\n const id = _GLOBAL_PICTURE_ID++;\n _PICTURE_SAVED_CALLBACKS[id] = pictureOptions.onPictureSaved;\n pictureOptions.id = id;\n pictureOptions.fastMode = true;\n }\n return pictureOptions;\n}\n\nfunction ensureRecordingOptions(options?: CameraRecordingOptions): CameraRecordingOptions {\n let recordingOptions = options || {};\n\n if (!recordingOptions || typeof recordingOptions !== 'object') {\n recordingOptions = {};\n } else if (typeof recordingOptions.quality === 'string') {\n recordingOptions.quality = Camera.Constants.VideoQuality[recordingOptions.quality];\n }\n\n return recordingOptions;\n}\n\nfunction _onPictureSaved({\n nativeEvent,\n}: {\n nativeEvent: { data: CameraCapturedPicture; id: number };\n}) {\n const { id, data } = nativeEvent;\n const callback = _PICTURE_SAVED_CALLBACKS[id];\n if (callback) {\n callback(data);\n delete _PICTURE_SAVED_CALLBACKS[id];\n }\n}\n\nexport default class Camera extends React.Component<CameraProps> {\n /**\n * Check whether the current device has a camera. This is useful for web and simulators cases.\n * This isn't influenced by the Permissions API (all platforms), or HTTP usage (in the browser).\n * You will still need to check if the native permission has been accepted.\n * @platform web\n */\n static async isAvailableAsync(): Promise<boolean> {\n if (!CameraManager.isAvailableAsync) {\n throw new UnavailabilityError('expo-camera', 'isAvailableAsync');\n }\n\n return await CameraManager.isAvailableAsync();\n }\n\n /**\n * Returns a list of camera types `['front', 'back']`. This is useful for desktop browsers which only have front-facing cameras.\n * @platform web\n */\n static async getAvailableCameraTypesAsync(): Promise<CameraType[]> {\n if (!CameraManager.getAvailableCameraTypesAsync) {\n throw new UnavailabilityError('expo-camera', 'getAvailableCameraTypesAsync');\n }\n\n return await CameraManager.getAvailableCameraTypesAsync();\n }\n\n // @needsAudit\n /**\n * Queries the device for the available video codecs that can be used in video recording.\n * @return A promise that resolves to a list of strings that represents available codecs.\n * @platform ios\n */\n static async getAvailableVideoCodecsAsync(): Promise<VideoCodec[]> {\n if (!CameraManager.getAvailableVideoCodecsAsync) {\n throw new UnavailabilityError('Camera', 'getAvailableVideoCodecsAsync');\n }\n\n return await CameraManager.getAvailableVideoCodecsAsync();\n }\n\n static Constants: ConstantsType = {\n Type: CameraManager.Type,\n FlashMode: CameraManager.FlashMode,\n AutoFocus: CameraManager.AutoFocus,\n WhiteBalance: CameraManager.WhiteBalance,\n VideoQuality: CameraManager.VideoQuality,\n VideoStabilization: CameraManager.VideoStabilization || {},\n VideoCodec: CameraManager.VideoCodec,\n };\n\n // Values under keys from this object will be transformed to native options\n static ConversionTables = ConversionTables;\n\n static defaultProps: CameraProps = {\n zoom: 0,\n ratio: '4:3',\n focusDepth: 0,\n faceDetectorSettings: {},\n type: CameraManager.Type.back,\n autoFocus: CameraManager.AutoFocus.on,\n flashMode: CameraManager.FlashMode.off,\n whiteBalance: CameraManager.WhiteBalance.auto,\n };\n\n // @needsAudit\n /**\n * @deprecated Use `getCameraPermissionsAsync` or `getMicrophonePermissionsAsync` instead.\n * Checks user's permissions for accessing camera.\n */\n static async getPermissionsAsync(): Promise<PermissionResponse> {\n console.warn(\n `\"getPermissionsAsync()\" is now deprecated. Please use \"getCameraPermissionsAsync()\" or \"getMicrophonePermissionsAsync()\" instead.`\n );\n return CameraManager.getPermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Asks the user to grant permissions for accessing camera.\n * On iOS this will require apps to specify both `NSCameraUsageDescription` and `NSMicrophoneUsageDescription` entries in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n * @deprecated Use `requestCameraPermissionsAsync` or `requestMicrophonePermissionsAsync` instead.\n */\n static async requestPermissionsAsync(): Promise<PermissionResponse> {\n console.warn(\n `\"requestPermissionsAsync()\" is now deprecated. Please use \"requestCameraPermissionsAsync()\" or \"requestMicrophonePermissionsAsync()\" instead.`\n );\n return CameraManager.requestPermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Checks user's permissions for accessing camera.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\n static async getCameraPermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.getCameraPermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Asks the user to grant permissions for accessing camera.\n * On iOS this will require apps to specify an `NSCameraUsageDescription` entry in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\n static async requestCameraPermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.requestCameraPermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Check or request permissions to access the camera.\n * This uses both `requestCameraPermissionsAsync` and `getCameraPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Camera.useCameraPermissions();\n * ```\n */\n static useCameraPermissions = createPermissionHook({\n getMethod: Camera.getCameraPermissionsAsync,\n requestMethod: Camera.requestCameraPermissionsAsync,\n });\n\n // @needsAudit\n /**\n * Checks user's permissions for accessing microphone.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\n static async getMicrophonePermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.getMicrophonePermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Asks the user to grant permissions for accessing the microphone.\n * On iOS this will require apps to specify an `NSMicrophoneUsageDescription` entry in the **Info.plist**.\n * @return A promise that resolves to an object of type [PermissionResponse](#permissionresponse).\n */\n static async requestMicrophonePermissionsAsync(): Promise<PermissionResponse> {\n return CameraManager.requestMicrophonePermissionsAsync();\n }\n\n // @needsAudit\n /**\n * Check or request permissions to access the microphone.\n * This uses both `requestMicrophonePermissionsAsync` and `getMicrophonePermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = Camera.useMicrophonePermissions();\n * ```\n */\n static useMicrophonePermissions = createPermissionHook({\n getMethod: Camera.getMicrophonePermissionsAsync,\n requestMethod: Camera.requestMicrophonePermissionsAsync,\n });\n\n _cameraHandle?: number | null;\n _cameraRef?: React.Component | null;\n _lastEvents: { [eventName: string]: string } = {};\n _lastEventsTimes: { [eventName: string]: Date } = {};\n\n // @needsAudit\n /**\n * Takes a picture and saves it to app's cache directory. Photos are rotated to match device's orientation\n * (if `options.skipProcessing` flag is not enabled) and scaled to match the preview. Anyway on Android it is essential\n * to set ratio prop to get a picture with correct dimensions.\n * > **Note**: Make sure to wait for the [`onCameraReady`](#oncameraready) callback before calling this method.\n * @param options An object in form of `CameraPictureOptions` type.\n * @return Returns a Promise that resolves to `CameraCapturedPicture` object, where `uri` is a URI to the local image file on iOS,\n * Android, and a base64 string on web (usable as the source for an `Image` element). The `width` and `height` properties specify\n * the dimensions of the image. `base64` is included if the `base64` option was truthy, and is a string containing the JPEG data\n * of the image in Base64--prepend that with `'data:image/jpg;base64,'` to get a data URI, which you can use as the source\n * for an `Image` element for example. `exif` is included if the `exif` option was truthy, and is an object containing EXIF\n * data for the image--the names of its properties are EXIF tags and their values are the values for those tags.\n *\n * > On native platforms, the local image URI is temporary. Use [`FileSystem.copyAsync`](filesystem.md#filesystemcopyasyncoptions)\n * > to make a permanent copy of the image.\n */\n async takePictureAsync(options?: CameraPictureOptions): Promise<CameraCapturedPicture> {\n const pictureOptions = ensurePictureOptions(options);\n\n return await CameraManager.takePicture(pictureOptions, this._cameraHandle);\n }\n\n /**\n * Get aspect ratios that are supported by the device and can be passed via `ratio` prop.\n * @return Returns a Promise that resolves to an array of strings representing ratios, eg. `['4:3', '1:1']`.\n * @platform android\n */\n async getSupportedRatiosAsync(): Promise<string[]> {\n if (!CameraManager.getSupportedRatios) {\n throw new UnavailabilityError('Camera', 'getSupportedRatiosAsync');\n }\n\n return await CameraManager.getSupportedRatios(this._cameraHandle);\n }\n\n /**\n * Get picture sizes that are supported by the device for given `ratio`.\n * @param ratio A string representing aspect ratio of sizes to be returned.\n * @return Returns a Promise that resolves to an array of strings representing picture sizes that can be passed to `pictureSize` prop.\n * The list varies across Android devices but is the same for every iOS.\n */\n async getAvailablePictureSizesAsync(ratio?: string): Promise<string[]> {\n if (!CameraManager.getAvailablePictureSizes) {\n throw new UnavailabilityError('Camera', 'getAvailablePictureSizesAsync');\n }\n return await CameraManager.getAvailablePictureSizes(ratio, this._cameraHandle);\n }\n\n /**\n * Starts recording a video that will be saved to cache directory. Videos are rotated to match device's orientation.\n * Flipping camera during a recording results in stopping it.\n * @param options A map of `CameraRecordingOptions` type.\n * @return Returns a Promise that resolves to an object containing video file `uri` property and a `codec` property on iOS.\n * The Promise is returned if `stopRecording` was invoked, one of `maxDuration` and `maxFileSize` is reached or camera preview is stopped.\n * @platform android\n * @platform ios\n */\n async recordAsync(options?: CameraRecordingOptions): Promise<{ uri: string }> {\n if (!CameraManager.record) {\n throw new UnavailabilityError('Camera', 'recordAsync');\n }\n\n const recordingOptions = ensureRecordingOptions(options);\n return await CameraManager.record(recordingOptions, this._cameraHandle);\n }\n\n /**\n * Stops recording if any is in progress.\n */\n stopRecording() {\n if (!CameraManager.stopRecording) {\n throw new UnavailabilityError('Camera', 'stopRecording');\n }\n\n CameraManager.stopRecording(this._cameraHandle);\n }\n\n /**\n * Pauses the camera preview. It is not recommended to use `takePictureAsync` when preview is paused.\n */\n pausePreview() {\n if (!CameraManager.pausePreview) {\n throw new UnavailabilityError('Camera', 'pausePreview');\n }\n\n CameraManager.pausePreview(this._cameraHandle);\n }\n\n /**\n * Resumes the camera preview.\n */\n resumePreview() {\n if (!CameraManager.resumePreview) {\n throw new UnavailabilityError('Camera', 'resumePreview');\n }\n\n CameraManager.resumePreview(this._cameraHandle);\n }\n\n _onCameraReady = () => {\n if (this.props.onCameraReady) {\n this.props.onCameraReady();\n }\n };\n\n _onMountError = ({ nativeEvent }: { nativeEvent: { message: string } }) => {\n if (this.props.onMountError) {\n this.props.onMountError(nativeEvent);\n }\n };\n\n _onObjectDetected =\n (callback?: Function) =>\n ({ nativeEvent }: { nativeEvent: any }) => {\n const { type } = nativeEvent;\n if (\n this._lastEvents[type] &&\n this._lastEventsTimes[type] &&\n JSON.stringify(nativeEvent) === this._lastEvents[type] &&\n new Date().getTime() - this._lastEventsTimes[type].getTime() < EventThrottleMs\n ) {\n return;\n }\n\n if (callback) {\n callback(nativeEvent);\n this._lastEventsTimes[type] = new Date();\n this._lastEvents[type] = JSON.stringify(nativeEvent);\n }\n };\n\n _setReference = (ref?: React.Component) => {\n if (ref) {\n this._cameraRef = ref;\n // TODO(Bacon): Unify these - perhaps with hooks?\n if (Platform.OS === 'web') {\n this._cameraHandle = ref as any;\n } else {\n this._cameraHandle = findNodeHandle(ref);\n }\n } else {\n this._cameraRef = null;\n this._cameraHandle = null;\n }\n };\n\n render() {\n const nativeProps = ensureNativeProps(this.props);\n\n const onBarCodeScanned = this.props.onBarCodeScanned\n ? this._onObjectDetected(this.props.onBarCodeScanned)\n : undefined;\n\n const onFacesDetected = this._onObjectDetected(this.props.onFacesDetected);\n\n return (\n <ExponentCamera\n {...nativeProps}\n ref={this._setReference}\n onCameraReady={this._onCameraReady}\n onMountError={this._onMountError}\n onBarCodeScanned={onBarCodeScanned}\n onFacesDetected={onFacesDetected}\n onPictureSaved={_onPictureSaved}\n />\n );\n }\n}\n\nexport const {\n Constants,\n getPermissionsAsync,\n requestPermissionsAsync,\n getCameraPermissionsAsync,\n requestCameraPermissionsAsync,\n getMicrophonePermissionsAsync,\n requestMicrophonePermissionsAsync,\n} = Camera;\n"]}
|
package/build/Camera.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PermissionResponse, PermissionStatus, PermissionExpiration, PermissionHookOptions } from 'expo-modules-core';
|
|
2
|
-
import { ViewProps } from 'react-native';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
3
|
export declare enum CameraType {
|
|
4
4
|
front = "front",
|
|
5
5
|
back = "back"
|
|
@@ -73,6 +73,10 @@ export declare enum VideoCodec {
|
|
|
73
73
|
AppleProRes422 = "apcn",
|
|
74
74
|
AppleProRes4444 = "ap4h"
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* This option specifies the stabilization mode to use when recording a video.
|
|
78
|
+
* @platform ios
|
|
79
|
+
*/
|
|
76
80
|
export declare enum VideoStabilization {
|
|
77
81
|
off = "off",
|
|
78
82
|
standard = "standard",
|
|
@@ -86,36 +90,56 @@ export declare enum VideoQuality {
|
|
|
86
90
|
'480p' = "480p",
|
|
87
91
|
'4:3' = "4:3"
|
|
88
92
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
export
|
|
93
|
+
/**
|
|
94
|
+
* @hidden We do not expose related web methods in docs.
|
|
95
|
+
* @platform web
|
|
96
|
+
*/
|
|
97
|
+
export type ImageSize = {
|
|
94
98
|
width: number;
|
|
95
99
|
height: number;
|
|
96
100
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
101
|
+
/**
|
|
102
|
+
* @hidden We do not expose related web methods in docs.
|
|
103
|
+
* @platform web
|
|
104
|
+
*/
|
|
105
|
+
export type WebCameraSettings = {
|
|
106
|
+
autoFocus?: string;
|
|
107
|
+
flashMode?: string;
|
|
108
|
+
whiteBalance?: string;
|
|
109
|
+
exposureCompensation?: number;
|
|
110
|
+
colorTemperature?: number;
|
|
111
|
+
iso?: number;
|
|
112
|
+
brightness?: number;
|
|
113
|
+
contrast?: number;
|
|
114
|
+
saturation?: number;
|
|
115
|
+
sharpness?: number;
|
|
116
|
+
focusDistance?: number;
|
|
117
|
+
zoom?: number;
|
|
118
|
+
};
|
|
119
|
+
export type CameraCapturedPicture = {
|
|
120
|
+
/**
|
|
121
|
+
* Captured image width.
|
|
122
|
+
*/
|
|
112
123
|
width: number;
|
|
124
|
+
/**
|
|
125
|
+
* Captured image height.
|
|
126
|
+
*/
|
|
113
127
|
height: number;
|
|
128
|
+
/**
|
|
129
|
+
* On web, the value of `uri` is the same as `base64` because file system URLs are not supported in the browser.
|
|
130
|
+
*/
|
|
114
131
|
uri: string;
|
|
132
|
+
/**
|
|
133
|
+
* A Base64 representation of the image.
|
|
134
|
+
*/
|
|
115
135
|
base64?: string;
|
|
136
|
+
/**
|
|
137
|
+
* On Android and iOS this object may include various fields based on the device and operating system.
|
|
138
|
+
* On web, it is a partial representation of the [`MediaTrackSettings`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings) dictionary.
|
|
139
|
+
*/
|
|
116
140
|
exif?: Partial<MediaTrackSettings> | any;
|
|
117
141
|
};
|
|
118
|
-
export
|
|
142
|
+
export type CameraPictureOptions = {
|
|
119
143
|
/**
|
|
120
144
|
* Specify the quality of compression, from 0 to 1. 0 means compress for small size, 1 means compress for maximum quality.
|
|
121
145
|
*/
|
|
@@ -174,8 +198,12 @@ export declare type CameraPictureOptions = {
|
|
|
174
198
|
* @hidden
|
|
175
199
|
*/
|
|
176
200
|
fastMode?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* @hidden
|
|
203
|
+
*/
|
|
204
|
+
maxDownsampling?: number;
|
|
177
205
|
};
|
|
178
|
-
export
|
|
206
|
+
export type CameraRecordingOptions = {
|
|
179
207
|
/**
|
|
180
208
|
* Maximum video duration in seconds.
|
|
181
209
|
*/
|
|
@@ -211,24 +239,33 @@ export declare type CameraRecordingOptions = {
|
|
|
211
239
|
*/
|
|
212
240
|
codec?: VideoCodec;
|
|
213
241
|
};
|
|
214
|
-
|
|
242
|
+
/**
|
|
243
|
+
* @hidden
|
|
244
|
+
*/
|
|
245
|
+
export type PictureSavedListener = (event: {
|
|
215
246
|
nativeEvent: {
|
|
216
247
|
data: CameraCapturedPicture;
|
|
217
248
|
id: number;
|
|
218
249
|
};
|
|
219
250
|
}) => void;
|
|
220
|
-
|
|
221
|
-
|
|
251
|
+
/**
|
|
252
|
+
* @hidden
|
|
253
|
+
*/
|
|
254
|
+
export type CameraReadyListener = () => void;
|
|
255
|
+
/**
|
|
256
|
+
* @hidden
|
|
257
|
+
*/
|
|
258
|
+
export type MountErrorListener = (event: {
|
|
222
259
|
nativeEvent: CameraMountError;
|
|
223
260
|
}) => void;
|
|
224
|
-
export
|
|
261
|
+
export type CameraMountError = {
|
|
225
262
|
message: string;
|
|
226
263
|
};
|
|
227
|
-
export
|
|
264
|
+
export type Point = {
|
|
228
265
|
x: number;
|
|
229
266
|
y: number;
|
|
230
267
|
};
|
|
231
|
-
export
|
|
268
|
+
export type BarCodeSize = {
|
|
232
269
|
/**
|
|
233
270
|
* The height value.
|
|
234
271
|
*/
|
|
@@ -242,8 +279,8 @@ export declare type BarCodeSize = {
|
|
|
242
279
|
* These coordinates are represented in the coordinate space of the camera source (e.g. when you
|
|
243
280
|
* are using the camera view, these values are adjusted to the dimensions of the view).
|
|
244
281
|
*/
|
|
245
|
-
export
|
|
246
|
-
export
|
|
282
|
+
export type BarCodePoint = Point;
|
|
283
|
+
export type BarCodeBounds = {
|
|
247
284
|
/**
|
|
248
285
|
* The origin point of the bounding box.
|
|
249
286
|
*/
|
|
@@ -253,7 +290,7 @@ export declare type BarCodeBounds = {
|
|
|
253
290
|
*/
|
|
254
291
|
size: BarCodeSize;
|
|
255
292
|
};
|
|
256
|
-
export
|
|
293
|
+
export type BarCodeScanningResult = {
|
|
257
294
|
/**
|
|
258
295
|
* The barcode type.
|
|
259
296
|
*/
|
|
@@ -276,35 +313,17 @@ export declare type BarCodeScanningResult = {
|
|
|
276
313
|
*/
|
|
277
314
|
bounds: BarCodeBounds;
|
|
278
315
|
};
|
|
279
|
-
export
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
width: number;
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
rollAngle: number;
|
|
289
|
-
yawAngle: number;
|
|
290
|
-
smilingProbability: number;
|
|
291
|
-
leftEarPosition: Point;
|
|
292
|
-
rightEarPosition: Point;
|
|
293
|
-
leftEyePosition: Point;
|
|
294
|
-
leftEyeOpenProbability: number;
|
|
295
|
-
rightEyePosition: Point;
|
|
296
|
-
rightEyeOpenProbability: number;
|
|
297
|
-
leftCheekPosition: Point;
|
|
298
|
-
rightCheekPosition: Point;
|
|
299
|
-
mouthPosition: Point;
|
|
300
|
-
leftMouthPosition: Point;
|
|
301
|
-
rightMouthPosition: Point;
|
|
302
|
-
noseBasePosition: Point;
|
|
303
|
-
};
|
|
304
|
-
export declare type FaceDetectionResult = {
|
|
305
|
-
faces: Face[];
|
|
316
|
+
export type FaceDetectionResult = {
|
|
317
|
+
/**
|
|
318
|
+
* Array of objects representing results of face detection.
|
|
319
|
+
* See [`FaceFeature`](facedetector/#facefeature) in FaceDetector documentation for more details.
|
|
320
|
+
*/
|
|
321
|
+
faces: object[];
|
|
306
322
|
};
|
|
307
|
-
|
|
323
|
+
/**
|
|
324
|
+
* @hidden
|
|
325
|
+
*/
|
|
326
|
+
export type ConstantsType = {
|
|
308
327
|
Type: CameraType;
|
|
309
328
|
FlashMode: FlashMode;
|
|
310
329
|
AutoFocus: AutoFocus;
|
|
@@ -313,7 +332,7 @@ export declare type ConstantsType = {
|
|
|
313
332
|
VideoStabilization: VideoStabilization;
|
|
314
333
|
VideoCodec: VideoCodec;
|
|
315
334
|
};
|
|
316
|
-
export
|
|
335
|
+
export type CameraProps = ViewProps & {
|
|
317
336
|
/**
|
|
318
337
|
* Camera facing. Use one of `CameraType`. When `CameraType.front`, use the front-facing camera.
|
|
319
338
|
* When `CameraType.back`, use the back-facing camera.
|
|
@@ -376,7 +395,7 @@ export declare type CameraProps = ViewProps & {
|
|
|
376
395
|
* You can read more about each stabilization type in [Apple Documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideostabilizationmode).
|
|
377
396
|
* @platform ios
|
|
378
397
|
*/
|
|
379
|
-
videoStabilizationMode?:
|
|
398
|
+
videoStabilizationMode?: VideoStabilization;
|
|
380
399
|
/**
|
|
381
400
|
* Callback invoked when camera preview could not been started.
|
|
382
401
|
* @param event Error object that contains a `message`.
|
|
@@ -409,7 +428,8 @@ export declare type CameraProps = ViewProps & {
|
|
|
409
428
|
*/
|
|
410
429
|
faceDetectorSettings?: object;
|
|
411
430
|
/**
|
|
412
|
-
* Callback invoked with results of face detection on the preview.
|
|
431
|
+
* Callback invoked with results of face detection on the preview.
|
|
432
|
+
* See [`DetectionResult`](facedetector/#detectionresult) in FaceDetector documentation for more details.
|
|
413
433
|
* @param faces
|
|
414
434
|
*/
|
|
415
435
|
onFacesDetected?: (faces: FaceDetectionResult) => void;
|
|
@@ -419,7 +439,10 @@ export declare type CameraProps = ViewProps & {
|
|
|
419
439
|
*/
|
|
420
440
|
poster?: string;
|
|
421
441
|
};
|
|
422
|
-
|
|
442
|
+
/**
|
|
443
|
+
* @hidden
|
|
444
|
+
*/
|
|
445
|
+
export type CameraNativeProps = {
|
|
423
446
|
pointerEvents?: any;
|
|
424
447
|
style?: any;
|
|
425
448
|
ref?: Function;
|
|
@@ -450,7 +473,7 @@ export declare type CameraNativeProps = {
|
|
|
450
473
|
useCamera2Api?: boolean;
|
|
451
474
|
poster?: string;
|
|
452
475
|
};
|
|
453
|
-
export
|
|
476
|
+
export type BarCodeSettings = {
|
|
454
477
|
barCodeTypes: string[];
|
|
455
478
|
interval?: number;
|
|
456
479
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.types.d.ts","sourceRoot":"","sources":["../src/Camera.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Cam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AoB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,KAAK,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/D,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC"}
|
package/build/Camera.types.js
CHANGED
|
@@ -78,7 +78,10 @@ export var VideoCodec;
|
|
|
78
78
|
VideoCodec["AppleProRes422"] = "apcn";
|
|
79
79
|
VideoCodec["AppleProRes4444"] = "ap4h";
|
|
80
80
|
})(VideoCodec || (VideoCodec = {}));
|
|
81
|
-
|
|
81
|
+
/**
|
|
82
|
+
* This option specifies the stabilization mode to use when recording a video.
|
|
83
|
+
* @platform ios
|
|
84
|
+
*/
|
|
82
85
|
export var VideoStabilization;
|
|
83
86
|
(function (VideoStabilization) {
|
|
84
87
|
VideoStabilization["off"] = "off";
|
|
@@ -86,7 +89,7 @@ export var VideoStabilization;
|
|
|
86
89
|
VideoStabilization["cinematic"] = "cinematic";
|
|
87
90
|
VideoStabilization["auto"] = "auto";
|
|
88
91
|
})(VideoStabilization || (VideoStabilization = {}));
|
|
89
|
-
// @
|
|
92
|
+
// @docsMissing
|
|
90
93
|
export var VideoQuality;
|
|
91
94
|
(function (VideoQuality) {
|
|
92
95
|
VideoQuality["2160p"] = "2160p";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.types.js","sourceRoot":"","sources":["../src/Camera.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;AACf,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX,0BAAa,CAAA;IACb,4BAAe,CAAA;AACjB,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB;AAED,MAAM,CAAN,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX;;OAEG;IACH,0BAAa,CAAA;IACb;;OAEG;IACH,sCAAyB,CAAA;AAC3B,CAAC,EAXW,SAAS,KAAT,SAAS,QAWpB;AAED,MAAM,CAAN,IAAY,YAmCX;AAnCD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb;;;OAGG;IACH,+BAAe,CAAA;IACf;;;OAGG;IACH,iCAAiB,CAAA;IACjB;;;OAGG;IACH,iCAAiB,CAAA;IACjB;;;OAGG;IACH,6CAA6B,CAAA;IAC7B;;;OAGG;IACH,2CAA2B,CAAA;IAC3B;;OAEG;IACH,yCAAyB,CAAA;IACzB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EAnCW,YAAY,KAAZ,YAAY,QAmCvB;AAED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,wBAAW,CAAA;AACb,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,qCAAuB,CAAA;IACvB,sCAAwB,CAAA;AAC1B,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAED,cAAc;AACd,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,6CAAuB,CAAA;IACvB,mCAAa,CAAA;AACf,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED,cAAc;AACd,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,6BAAe,CAAA;IACf,6BAAe,CAAA;IACf,2BAAa,CAAA;AACf,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB;AA4XD,OAAO,EAAsB,gBAAgB,EAA+C,CAAC","sourcesContent":["import {\n PermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n} from 'expo-modules-core';\nimport { ViewProps } from 'react-native';\n\nexport enum CameraType {\n front = 'front',\n back = 'back',\n}\n\nexport enum FlashMode {\n on = 'on',\n off = 'off',\n auto = 'auto',\n torch = 'torch',\n}\n\nexport enum AutoFocus {\n on = 'on',\n off = 'off',\n /**\n * @platform web\n */\n auto = 'auto',\n /**\n * @platform web\n */\n singleShot = 'singleShot',\n}\n\nexport enum WhiteBalance {\n auto = 'auto',\n /**\n * @platform android\n * @platform ios\n */\n sunny = 'sunny',\n /**\n * @platform android\n * @platform ios\n */\n cloudy = 'cloudy',\n /**\n * @platform android\n * @platform ios\n */\n shadow = 'shadow',\n /**\n * @platform android\n * @platform ios\n */\n incandescent = 'incandescent',\n /**\n * @platform android\n * @platform ios\n */\n fluorescent = 'fluorescent',\n /**\n * @platform web\n */\n continuous = 'continuous',\n /**\n * @platform web\n */\n manual = 'manual',\n}\n\nexport enum ImageType {\n png = 'png',\n jpg = 'jpg',\n}\n\n/**\n * This option specifies what codec to use when recording a video.\n * @platform ios\n */\nexport enum VideoCodec {\n H264 = 'avc1',\n HEVC = 'hvc1',\n JPEG = 'jpeg',\n AppleProRes422 = 'apcn',\n AppleProRes4444 = 'ap4h',\n}\n\n// @needsAudit\nexport enum VideoStabilization {\n off = 'off',\n standard = 'standard',\n cinematic = 'cinematic',\n auto = 'auto',\n}\n\n// @needsAudit\nexport enum VideoQuality {\n '2160p' = '2160p',\n '1080p' = '1080p',\n '720p' = '720p',\n '480p' = '480p',\n '4:3' = '4:3',\n}\n\n// @needsAudit\nexport type ImageParameters = {\n imageType: ImageType;\n quality: number | null;\n};\n\nexport type ImageSize = {\n width: number;\n height: number;\n};\n\nexport type WebCameraSettings = Partial<{\n autoFocus: string;\n flashMode: string;\n whiteBalance: string;\n exposureCompensation: number;\n colorTemperature: number;\n iso: number;\n brightness: number;\n contrast: number;\n saturation: number;\n sharpness: number;\n focusDistance: number;\n zoom: number;\n}>;\n\nexport type CameraCapturedPicture = {\n width: number;\n height: number;\n uri: string;\n base64?: string;\n exif?: Partial<MediaTrackSettings> | any;\n};\n\n// @needsAudit @docsMissing\nexport type CameraPictureOptions = {\n /**\n * Specify the quality of compression, from 0 to 1. 0 means compress for small size, 1 means compress for maximum quality.\n */\n quality?: number;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64?: boolean;\n /**\n * Whether to also include the EXIF data for the image.\n */\n exif?: boolean;\n /**\n * Additional EXIF data to be included for the image. Only useful when `exif` option is set to `true`.\n * @platform android\n * @platform ios\n */\n additionalExif?: { [name: string]: any };\n /**\n * A callback invoked when picture is saved. If set, the promise of this method will resolve immediately with no data after picture is captured.\n * The data that it should contain will be passed to this callback. If displaying or processing a captured photo right after taking it\n * is not your case, this callback lets you skip waiting for it to be saved.\n * @param picture\n */\n onPictureSaved?: (picture: CameraCapturedPicture) => void;\n // TODO(Bacon): Is it possible to implement this in the browser?\n /**\n * If set to `true`, camera skips orientation adjustment and returns an image straight from the device's camera.\n * If enabled, `quality` option is discarded (processing pipeline is skipped as a whole).\n * Although enabling this option reduces image delivery time significantly, it may cause the image to appear in a wrong orientation\n * in the `Image` component (at the time of writing, it does not respect EXIF orientation of the images).\n * > **Note**: Enabling `skipProcessing` would cause orientation uncertainty. `Image` component does not respect EXIF\n * > stored orientation information, that means obtained image would be displayed wrongly (rotated by 90°, 180° or 270°).\n * > Different devices provide different orientations. For example some Sony Xperia or Samsung devices don't provide\n * > correctly oriented images by default. To always obtain correctly oriented image disable `skipProcessing` option.\n */\n skipProcessing?: boolean;\n /**\n * @platform web\n */\n scale?: number;\n /**\n * @platform web\n */\n imageType?: ImageType;\n /**\n * @platform web\n */\n isImageMirror?: boolean;\n /**\n * @hidden\n */\n id?: number;\n /**\n * @hidden\n */\n fastMode?: boolean;\n};\n\n// @needsAudit\nexport type CameraRecordingOptions = {\n /**\n * Maximum video duration in seconds.\n */\n maxDuration?: number;\n /**\n * Maximum video file size in bytes.\n */\n maxFileSize?: number;\n /**\n * Specify the quality of recorded video. Use one of [`VideoQuality.<value>`](#videoquality).\n * Possible values: for 16:9 resolution `2160p`, `1080p`, `720p`, `480p` : `Android only` and for 4:3 `4:3` (the size is 640x480).\n * If the chosen quality is not available for a device, the highest available is chosen.\n */\n quality?: number | string;\n /**\n * If present, video will be recorded with no sound.\n */\n mute?: boolean;\n /**\n * If `true`, the recorded video will be flipped along the vertical axis. iOS flips videos recorded with the front camera by default,\n * but you can reverse that back by setting this to `true`. On Android, this is handled in the user's device settings.\n * @platform ios\n */\n mirror?: boolean;\n /**\n * Only works if `useCamera2Api` is set to `true`. This option specifies a desired video bitrate. For example, `5*1000*1000` would be 5Mbps.\n * @platform android\n */\n videoBitrate?: number;\n /**\n * This option specifies what codec to use when recording the video. See [`VideoCodec`](#videocodec) for the possible values.\n * @platform ios\n */\n codec?: VideoCodec;\n};\n\nexport type PictureSavedListener = (event: {\n nativeEvent: { data: CameraCapturedPicture; id: number };\n}) => void;\n\nexport type CameraReadyListener = () => void;\n\nexport type MountErrorListener = (event: { nativeEvent: CameraMountError }) => void;\n\nexport type CameraMountError = { message: string };\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport type BarCodeSize = {\n /**\n * The height value.\n */\n height: number;\n /**\n * The width value.\n */\n width: number;\n};\n\n/**\n * These coordinates are represented in the coordinate space of the camera source (e.g. when you\n * are using the camera view, these values are adjusted to the dimensions of the view).\n */\nexport type BarCodePoint = Point;\n\nexport type BarCodeBounds = {\n /**\n * The origin point of the bounding box.\n */\n origin: BarCodePoint;\n /**\n * The size of the bounding box.\n */\n size: BarCodeSize;\n};\n\n// @needsAudit\nexport type BarCodeScanningResult = {\n /**\n * The barcode type.\n */\n type: string;\n /**\n * The information encoded in the bar code.\n */\n data: string;\n /**\n * Corner points of the bounding box.\n * `cornerPoints` is not always available and may be empty. On iOS, for `code39` and `pdf417`\n * you don't get this value.\n */\n cornerPoints: BarCodePoint[];\n /**\n * The [BarCodeBounds](#barcodebounds) object.\n * `bounds` in some case will be representing an empty rectangle.\n * Moreover, `bounds` doesn't have to bound the whole barcode.\n * For some types, they will represent the area used by the scanner.\n */\n bounds: BarCodeBounds;\n};\n\nexport type Face = {\n faceID: number;\n bounds: {\n origin: Point;\n size: {\n height: number;\n width: number;\n };\n };\n rollAngle: number;\n yawAngle: number;\n smilingProbability: number;\n leftEarPosition: Point;\n rightEarPosition: Point;\n leftEyePosition: Point;\n leftEyeOpenProbability: number;\n rightEyePosition: Point;\n rightEyeOpenProbability: number;\n leftCheekPosition: Point;\n rightCheekPosition: Point;\n mouthPosition: Point;\n leftMouthPosition: Point;\n rightMouthPosition: Point;\n noseBasePosition: Point;\n};\n\nexport type FaceDetectionResult = { faces: Face[] };\n\nexport type ConstantsType = {\n Type: CameraType;\n FlashMode: FlashMode;\n AutoFocus: AutoFocus;\n WhiteBalance: WhiteBalance;\n VideoQuality: VideoQuality;\n VideoStabilization: VideoStabilization;\n VideoCodec: VideoCodec;\n};\n\n// @needsAudit\nexport type CameraProps = ViewProps & {\n /**\n * Camera facing. Use one of `CameraType`. When `CameraType.front`, use the front-facing camera.\n * When `CameraType.back`, use the back-facing camera.\n * @default CameraType.back\n */\n type?: number | CameraType;\n /**\n * Camera flash mode. Use one of [`FlashMode.<value>`](#flashmode-1). When `FlashMode.on`, the flash on your device will\n * turn on when taking a picture, when `FlashMode.off`, it won't. Setting to `FlashMode.auto` will fire flash if required,\n * `FlashMode.torch` turns on flash during the preview.\n * @default FlashMode.off\n */\n flashMode?: number | FlashMode;\n /**\n * Camera white balance. Use one of [`WhiteBalance.<value>`](#whitebalance). If a device does not support any of these values previous one is used.\n * @default WhiteBalance.auto\n */\n whiteBalance?: number | WhiteBalance;\n /**\n * State of camera auto focus. Use one of [`AutoFocus.<value>`](#autofocus-1). When `AutoFocus.on`,\n * auto focus will be enabled, when `AutoFocus.off`, it won't and focus will lock as it was in the moment of change,\n * but it can be adjusted on some devices via `focusDepth` prop.\n * @default AutoFocus.on\n */\n autoFocus?: boolean | number | AutoFocus;\n /**\n * A value between `0` and `1` being a percentage of device's max zoom. `0` - not zoomed, `1` - maximum zoom.\n * @default 0\n */\n zoom?: number;\n /**\n * A string representing aspect ratio of the preview, eg. `4:3`, `16:9`, `1:1`. To check if a ratio is supported\n * by the device use [`getSupportedRatiosAsync`](#getsupportedratiosasync).\n * @default 4:3\n * @platform android\n */\n ratio?: string;\n /**\n * Distance to plane of the sharpest focus. A value between `0` and `1` where: `0` - infinity focus, `1` - focus as close as possible.\n * For Android this is available only for some devices and when `useCamera2Api` is set to `true`.\n * @default 0\n */\n focusDepth?: number;\n /**\n * Callback invoked when camera preview has been set.\n */\n onCameraReady?: () => void;\n /**\n * Whether to use Android's Camera2 API. See `Note` at the top of this page.\n * @platform android\n */\n useCamera2Api?: boolean;\n /**\n * A string representing the size of pictures [`takePictureAsync`](#takepictureasync) will take.\n * Available sizes can be fetched with [`getAvailablePictureSizesAsync`](#getavailablepicturesizesasync).\n */\n pictureSize?: string;\n /**\n * The video stabilization mode used for a video recording. Use one of [`VideoStabilization.<value>`](#videostabilization).\n * You can read more about each stabilization type in [Apple Documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideostabilizationmode).\n * @platform ios\n */\n videoStabilizationMode?: number;\n /**\n * Callback invoked when camera preview could not been started.\n * @param event Error object that contains a `message`.\n */\n onMountError?: (event: CameraMountError) => void;\n /**\n * Settings exposed by [`BarCodeScanner`](bar-code-scanner) module. Supported settings: **barCodeTypes**.\n * @example\n * ```tsx\n * <Camera\n * barCodeScannerSettings={{\n * barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr],\n * }}\n * />\n * ```\n */\n barCodeScannerSettings?: BarCodeSettings;\n /**\n * Callback that is invoked when a bar code has been successfully scanned. The callback is provided with\n * an object of the [`BarCodeScanningResult`](#barcodescanningresult) shape, where the `type`\n * refers to the bar code type that was scanned and the `data` is the information encoded in the bar code\n * (in this case of QR codes, this is often a URL). See [`BarCodeScanner.Constants.BarCodeType`](bar-code-scanner#supported-formats)\n * for supported values.\n * @param scanningResult\n */\n onBarCodeScanned?: (scanningResult: BarCodeScanningResult) => void;\n /**\n * A settings object passed directly to an underlying module providing face detection features.\n * See [`DetectionOptions`](facedetector/#detectionoptions) in FaceDetector documentation for details.\n */\n faceDetectorSettings?: object;\n /**\n * Callback invoked with results of face detection on the preview. See [FaceDetector documentation](facedetector/#detectionresult) for details.\n * @param faces\n */\n onFacesDetected?: (faces: FaceDetectionResult) => void;\n /**\n * A URL for an image to be shown while the camera is loading.\n * @platform web\n */\n poster?: string;\n};\n\nexport type CameraNativeProps = {\n pointerEvents?: any;\n style?: any;\n ref?: Function;\n onCameraReady?: CameraReadyListener;\n onMountError?: MountErrorListener;\n onBarCodeScanned?: (event: { nativeEvent: BarCodeScanningResult }) => void;\n onFacesDetected?: (event: { nativeEvent: FaceDetectionResult }) => void;\n onFaceDetectionError?: (event: { nativeEvent: Error }) => void;\n onPictureSaved?: PictureSavedListener;\n type?: number | string;\n flashMode?: number | string;\n autoFocus?: string | boolean | number;\n focusDepth?: number;\n zoom?: number;\n whiteBalance?: number | string;\n pictureSize?: string;\n barCodeScannerSettings?: BarCodeSettings;\n faceDetectorSettings?: object;\n barCodeScannerEnabled?: boolean;\n faceDetectorEnabled?: boolean;\n ratio?: string;\n useCamera2Api?: boolean;\n poster?: string;\n};\n\nexport type BarCodeSettings = {\n barCodeTypes: string[];\n interval?: number;\n};\n\nexport { PermissionResponse, PermissionStatus, PermissionExpiration, PermissionHookOptions };\n"]}
|
|
1
|
+
{"version":3,"file":"Camera.types.js","sourceRoot":"","sources":["../src/Camera.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;AACf,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX,0BAAa,CAAA;IACb,4BAAe,CAAA;AACjB,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB;AAED,MAAM,CAAN,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX;;OAEG;IACH,0BAAa,CAAA;IACb;;OAEG;IACH,sCAAyB,CAAA;AAC3B,CAAC,EAXW,SAAS,KAAT,SAAS,QAWpB;AAED,MAAM,CAAN,IAAY,YAmCX;AAnCD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb;;;OAGG;IACH,+BAAe,CAAA;IACf;;;OAGG;IACH,iCAAiB,CAAA;IACjB;;;OAGG;IACH,iCAAiB,CAAA;IACjB;;;OAGG;IACH,6CAA6B,CAAA;IAC7B;;;OAGG;IACH,2CAA2B,CAAA;IAC3B;;OAEG;IACH,yCAAyB,CAAA;IACzB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EAnCW,YAAY,KAAZ,YAAY,QAmCvB;AAED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,wBAAW,CAAA;AACb,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,qCAAuB,CAAA;IACvB,sCAAwB,CAAA;AAC1B,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,6CAAuB,CAAA;IACvB,mCAAa,CAAA;AACf,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED,eAAe;AACf,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,6BAAe,CAAA;IACf,6BAAe,CAAA;IACf,2BAAa,CAAA;AACf,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB;AAoZD,OAAO,EAAsB,gBAAgB,EAA+C,CAAC","sourcesContent":["import {\n PermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n} from 'expo-modules-core';\nimport type { ViewProps } from 'react-native';\n\nexport enum CameraType {\n front = 'front',\n back = 'back',\n}\n\nexport enum FlashMode {\n on = 'on',\n off = 'off',\n auto = 'auto',\n torch = 'torch',\n}\n\nexport enum AutoFocus {\n on = 'on',\n off = 'off',\n /**\n * @platform web\n */\n auto = 'auto',\n /**\n * @platform web\n */\n singleShot = 'singleShot',\n}\n\nexport enum WhiteBalance {\n auto = 'auto',\n /**\n * @platform android\n * @platform ios\n */\n sunny = 'sunny',\n /**\n * @platform android\n * @platform ios\n */\n cloudy = 'cloudy',\n /**\n * @platform android\n * @platform ios\n */\n shadow = 'shadow',\n /**\n * @platform android\n * @platform ios\n */\n incandescent = 'incandescent',\n /**\n * @platform android\n * @platform ios\n */\n fluorescent = 'fluorescent',\n /**\n * @platform web\n */\n continuous = 'continuous',\n /**\n * @platform web\n */\n manual = 'manual',\n}\n\nexport enum ImageType {\n png = 'png',\n jpg = 'jpg',\n}\n\n/**\n * This option specifies what codec to use when recording a video.\n * @platform ios\n */\nexport enum VideoCodec {\n H264 = 'avc1',\n HEVC = 'hvc1',\n JPEG = 'jpeg',\n AppleProRes422 = 'apcn',\n AppleProRes4444 = 'ap4h',\n}\n\n/**\n * This option specifies the stabilization mode to use when recording a video.\n * @platform ios\n */\nexport enum VideoStabilization {\n off = 'off',\n standard = 'standard',\n cinematic = 'cinematic',\n auto = 'auto',\n}\n\n// @docsMissing\nexport enum VideoQuality {\n '2160p' = '2160p',\n '1080p' = '1080p',\n '720p' = '720p',\n '480p' = '480p',\n '4:3' = '4:3',\n}\n\n// @docsMissing\n/**\n * @hidden We do not expose related web methods in docs.\n * @platform web\n */\nexport type ImageSize = {\n width: number;\n height: number;\n};\n\n// @docsMissing\n/**\n * @hidden We do not expose related web methods in docs.\n * @platform web\n */\nexport type WebCameraSettings = {\n autoFocus?: string;\n flashMode?: string;\n whiteBalance?: string;\n exposureCompensation?: number;\n colorTemperature?: number;\n iso?: number;\n brightness?: number;\n contrast?: number;\n saturation?: number;\n sharpness?: number;\n focusDistance?: number;\n zoom?: number;\n};\n\n// @needsAudit\nexport type CameraCapturedPicture = {\n /**\n * Captured image width.\n */\n width: number;\n /**\n * Captured image height.\n */\n height: number;\n /**\n * On web, the value of `uri` is the same as `base64` because file system URLs are not supported in the browser.\n */\n uri: string;\n /**\n * A Base64 representation of the image.\n */\n base64?: string;\n /**\n * On Android and iOS this object may include various fields based on the device and operating system.\n * On web, it is a partial representation of the [`MediaTrackSettings`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings) dictionary.\n */\n exif?: Partial<MediaTrackSettings> | any;\n};\n\n// @needsAudit\nexport type CameraPictureOptions = {\n /**\n * Specify the quality of compression, from 0 to 1. 0 means compress for small size, 1 means compress for maximum quality.\n */\n quality?: number;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64?: boolean;\n /**\n * Whether to also include the EXIF data for the image.\n */\n exif?: boolean;\n /**\n * Additional EXIF data to be included for the image. Only useful when `exif` option is set to `true`.\n * @platform android\n * @platform ios\n */\n additionalExif?: { [name: string]: any };\n /**\n * A callback invoked when picture is saved. If set, the promise of this method will resolve immediately with no data after picture is captured.\n * The data that it should contain will be passed to this callback. If displaying or processing a captured photo right after taking it\n * is not your case, this callback lets you skip waiting for it to be saved.\n * @param picture\n */\n onPictureSaved?: (picture: CameraCapturedPicture) => void;\n // TODO(Bacon): Is it possible to implement this in the browser?\n /**\n * If set to `true`, camera skips orientation adjustment and returns an image straight from the device's camera.\n * If enabled, `quality` option is discarded (processing pipeline is skipped as a whole).\n * Although enabling this option reduces image delivery time significantly, it may cause the image to appear in a wrong orientation\n * in the `Image` component (at the time of writing, it does not respect EXIF orientation of the images).\n * > **Note**: Enabling `skipProcessing` would cause orientation uncertainty. `Image` component does not respect EXIF\n * > stored orientation information, that means obtained image would be displayed wrongly (rotated by 90°, 180° or 270°).\n * > Different devices provide different orientations. For example some Sony Xperia or Samsung devices don't provide\n * > correctly oriented images by default. To always obtain correctly oriented image disable `skipProcessing` option.\n */\n skipProcessing?: boolean;\n /**\n * @platform web\n */\n scale?: number;\n /**\n * @platform web\n */\n imageType?: ImageType;\n /**\n * @platform web\n */\n isImageMirror?: boolean;\n /**\n * @hidden\n */\n id?: number;\n /**\n * @hidden\n */\n fastMode?: boolean;\n /**\n * @hidden\n */\n maxDownsampling?: number;\n};\n\n// @needsAudit\nexport type CameraRecordingOptions = {\n /**\n * Maximum video duration in seconds.\n */\n maxDuration?: number;\n /**\n * Maximum video file size in bytes.\n */\n maxFileSize?: number;\n /**\n * Specify the quality of recorded video. Use one of [`VideoQuality.<value>`](#videoquality).\n * Possible values: for 16:9 resolution `2160p`, `1080p`, `720p`, `480p` : `Android only` and for 4:3 `4:3` (the size is 640x480).\n * If the chosen quality is not available for a device, the highest available is chosen.\n */\n quality?: number | string;\n /**\n * If present, video will be recorded with no sound.\n */\n mute?: boolean;\n /**\n * If `true`, the recorded video will be flipped along the vertical axis. iOS flips videos recorded with the front camera by default,\n * but you can reverse that back by setting this to `true`. On Android, this is handled in the user's device settings.\n * @platform ios\n */\n mirror?: boolean;\n /**\n * Only works if `useCamera2Api` is set to `true`. This option specifies a desired video bitrate. For example, `5*1000*1000` would be 5Mbps.\n * @platform android\n */\n videoBitrate?: number;\n /**\n * This option specifies what codec to use when recording the video. See [`VideoCodec`](#videocodec) for the possible values.\n * @platform ios\n */\n codec?: VideoCodec;\n};\n\n/**\n * @hidden\n */\nexport type PictureSavedListener = (event: {\n nativeEvent: { data: CameraCapturedPicture; id: number };\n}) => void;\n\n/**\n * @hidden\n */\nexport type CameraReadyListener = () => void;\n\n/**\n * @hidden\n */\nexport type MountErrorListener = (event: { nativeEvent: CameraMountError }) => void;\n\n// @docsMissing\nexport type CameraMountError = { message: string };\n\n// @docsMissing\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport type BarCodeSize = {\n /**\n * The height value.\n */\n height: number;\n /**\n * The width value.\n */\n width: number;\n};\n\n/**\n * These coordinates are represented in the coordinate space of the camera source (e.g. when you\n * are using the camera view, these values are adjusted to the dimensions of the view).\n */\nexport type BarCodePoint = Point;\n\nexport type BarCodeBounds = {\n /**\n * The origin point of the bounding box.\n */\n origin: BarCodePoint;\n /**\n * The size of the bounding box.\n */\n size: BarCodeSize;\n};\n\n// @needsAudit\nexport type BarCodeScanningResult = {\n /**\n * The barcode type.\n */\n type: string;\n /**\n * The information encoded in the bar code.\n */\n data: string;\n /**\n * Corner points of the bounding box.\n * `cornerPoints` is not always available and may be empty. On iOS, for `code39` and `pdf417`\n * you don't get this value.\n */\n cornerPoints: BarCodePoint[];\n /**\n * The [BarCodeBounds](#barcodebounds) object.\n * `bounds` in some case will be representing an empty rectangle.\n * Moreover, `bounds` doesn't have to bound the whole barcode.\n * For some types, they will represent the area used by the scanner.\n */\n bounds: BarCodeBounds;\n};\n\nexport type FaceDetectionResult = {\n /**\n * Array of objects representing results of face detection.\n * See [`FaceFeature`](facedetector/#facefeature) in FaceDetector documentation for more details.\n */\n faces: object[];\n};\n\n/**\n * @hidden\n */\nexport type ConstantsType = {\n Type: CameraType;\n FlashMode: FlashMode;\n AutoFocus: AutoFocus;\n WhiteBalance: WhiteBalance;\n VideoQuality: VideoQuality;\n VideoStabilization: VideoStabilization;\n VideoCodec: VideoCodec;\n};\n\n// @needsAudit\nexport type CameraProps = ViewProps & {\n /**\n * Camera facing. Use one of `CameraType`. When `CameraType.front`, use the front-facing camera.\n * When `CameraType.back`, use the back-facing camera.\n * @default CameraType.back\n */\n type?: number | CameraType;\n /**\n * Camera flash mode. Use one of [`FlashMode.<value>`](#flashmode-1). When `FlashMode.on`, the flash on your device will\n * turn on when taking a picture, when `FlashMode.off`, it won't. Setting to `FlashMode.auto` will fire flash if required,\n * `FlashMode.torch` turns on flash during the preview.\n * @default FlashMode.off\n */\n flashMode?: number | FlashMode;\n /**\n * Camera white balance. Use one of [`WhiteBalance.<value>`](#whitebalance). If a device does not support any of these values previous one is used.\n * @default WhiteBalance.auto\n */\n whiteBalance?: number | WhiteBalance;\n /**\n * State of camera auto focus. Use one of [`AutoFocus.<value>`](#autofocus-1). When `AutoFocus.on`,\n * auto focus will be enabled, when `AutoFocus.off`, it won't and focus will lock as it was in the moment of change,\n * but it can be adjusted on some devices via `focusDepth` prop.\n * @default AutoFocus.on\n */\n autoFocus?: boolean | number | AutoFocus;\n /**\n * A value between `0` and `1` being a percentage of device's max zoom. `0` - not zoomed, `1` - maximum zoom.\n * @default 0\n */\n zoom?: number;\n /**\n * A string representing aspect ratio of the preview, eg. `4:3`, `16:9`, `1:1`. To check if a ratio is supported\n * by the device use [`getSupportedRatiosAsync`](#getsupportedratiosasync).\n * @default 4:3\n * @platform android\n */\n ratio?: string;\n /**\n * Distance to plane of the sharpest focus. A value between `0` and `1` where: `0` - infinity focus, `1` - focus as close as possible.\n * For Android this is available only for some devices and when `useCamera2Api` is set to `true`.\n * @default 0\n */\n focusDepth?: number;\n /**\n * Callback invoked when camera preview has been set.\n */\n onCameraReady?: () => void;\n /**\n * Whether to use Android's Camera2 API. See `Note` at the top of this page.\n * @platform android\n */\n useCamera2Api?: boolean;\n /**\n * A string representing the size of pictures [`takePictureAsync`](#takepictureasync) will take.\n * Available sizes can be fetched with [`getAvailablePictureSizesAsync`](#getavailablepicturesizesasync).\n */\n pictureSize?: string;\n /**\n * The video stabilization mode used for a video recording. Use one of [`VideoStabilization.<value>`](#videostabilization).\n * You can read more about each stabilization type in [Apple Documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideostabilizationmode).\n * @platform ios\n */\n videoStabilizationMode?: VideoStabilization;\n /**\n * Callback invoked when camera preview could not been started.\n * @param event Error object that contains a `message`.\n */\n onMountError?: (event: CameraMountError) => void;\n /**\n * Settings exposed by [`BarCodeScanner`](bar-code-scanner) module. Supported settings: **barCodeTypes**.\n * @example\n * ```tsx\n * <Camera\n * barCodeScannerSettings={{\n * barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr],\n * }}\n * />\n * ```\n */\n barCodeScannerSettings?: BarCodeSettings;\n /**\n * Callback that is invoked when a bar code has been successfully scanned. The callback is provided with\n * an object of the [`BarCodeScanningResult`](#barcodescanningresult) shape, where the `type`\n * refers to the bar code type that was scanned and the `data` is the information encoded in the bar code\n * (in this case of QR codes, this is often a URL). See [`BarCodeScanner.Constants.BarCodeType`](bar-code-scanner#supported-formats)\n * for supported values.\n * @param scanningResult\n */\n onBarCodeScanned?: (scanningResult: BarCodeScanningResult) => void;\n /**\n * A settings object passed directly to an underlying module providing face detection features.\n * See [`DetectionOptions`](facedetector/#detectionoptions) in FaceDetector documentation for details.\n */\n faceDetectorSettings?: object;\n /**\n * Callback invoked with results of face detection on the preview.\n * See [`DetectionResult`](facedetector/#detectionresult) in FaceDetector documentation for more details.\n * @param faces\n */\n onFacesDetected?: (faces: FaceDetectionResult) => void;\n /**\n * A URL for an image to be shown while the camera is loading.\n * @platform web\n */\n poster?: string;\n};\n\n/**\n * @hidden\n */\nexport type CameraNativeProps = {\n pointerEvents?: any;\n style?: any;\n ref?: Function;\n onCameraReady?: CameraReadyListener;\n onMountError?: MountErrorListener;\n onBarCodeScanned?: (event: { nativeEvent: BarCodeScanningResult }) => void;\n onFacesDetected?: (event: { nativeEvent: FaceDetectionResult }) => void;\n onFaceDetectionError?: (event: { nativeEvent: Error }) => void;\n onPictureSaved?: PictureSavedListener;\n type?: number | string;\n flashMode?: number | string;\n autoFocus?: string | boolean | number;\n focusDepth?: number;\n zoom?: number;\n whiteBalance?: number | string;\n pictureSize?: string;\n barCodeScannerSettings?: BarCodeSettings;\n faceDetectorSettings?: object;\n barCodeScannerEnabled?: boolean;\n faceDetectorEnabled?: boolean;\n ratio?: string;\n useCamera2Api?: boolean;\n poster?: string;\n};\n\n// @docsMissing\nexport type BarCodeSettings = {\n barCodeTypes: string[];\n interval?: number;\n};\n\nexport { PermissionResponse, PermissionStatus, PermissionExpiration, PermissionHookOptions };\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as Camera } from './Camera';
|
|
2
2
|
export { Constants, getPermissionsAsync, requestPermissionsAsync, getCameraPermissionsAsync, requestCameraPermissionsAsync, getMicrophonePermissionsAsync, requestMicrophonePermissionsAsync, } from './Camera';
|
|
3
|
-
export
|
|
3
|
+
export * from './Camera.types';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,UAAU,CAAC;AAElB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,UAAU,CAAC;AAElB,cAAc,gBAAgB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as Camera } from './Camera';
|
|
2
2
|
export { Constants, getPermissionsAsync, requestPermissionsAsync, getCameraPermissionsAsync, requestCameraPermissionsAsync, getMicrophonePermissionsAsync, requestMicrophonePermissionsAsync, } from './Camera';
|
|
3
|
-
export
|
|
3
|
+
export * from './Camera.types';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,UAAU,CAAC;AAElB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,UAAU,CAAC;AAElB,cAAc,gBAAgB,CAAC","sourcesContent":["export { default as Camera } from './Camera';\nexport {\n Constants,\n getPermissionsAsync,\n requestPermissionsAsync,\n getCameraPermissionsAsync,\n requestCameraPermissionsAsync,\n getMicrophonePermissionsAsync,\n requestMicrophonePermissionsAsync,\n} from './Camera';\n\nexport * from './Camera.types';\n"]}
|
|
@@ -283,7 +283,7 @@ private func generatePictureForSimulator(appContext: AppContext?, options: TakeP
|
|
|
283
283
|
guard let fs = appContext?.fileSystem else {
|
|
284
284
|
throw Exceptions.FileSystemModuleNotFound()
|
|
285
285
|
}
|
|
286
|
-
let path = fs.generatePath(inDirectory: fs.cachesDirectory.appending("Camera"), withExtension: ".jpg")
|
|
286
|
+
let path = fs.generatePath(inDirectory: fs.cachesDirectory.appending("/Camera"), withExtension: ".jpg")
|
|
287
287
|
let generatedPhoto = EXCameraUtils.generatePhoto(of: CGSize(width: 200, height: 200))
|
|
288
288
|
let photoData = generatedPhoto.jpegData(compressionQuality: options.quality)
|
|
289
289
|
|
package/ios/EXCamera/EXCamera.m
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#import <AVFoundation/AVFoundation.h>
|
|
2
2
|
|
|
3
|
-
#import <ExpoModulesCore/
|
|
3
|
+
#import <ExpoModulesCore/EXBarcodeScannerProviderInterface.h>
|
|
4
4
|
#import <EXCamera/EXCamera.h>
|
|
5
5
|
#import <EXCamera/EXCameraUtils.h>
|
|
6
6
|
#import <EXCamera/EXCameraCameraPermissionRequester.h>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-camera",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"description": "A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to the app's cache. Morever, the component is also capable of detecting faces and bar codes appearing on the preview.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"expo": "*"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "1815e2eaad8c753588c7b1eb74420174a28e01f4"
|
|
47
47
|
}
|
package/src/Camera.tsx
CHANGED
|
@@ -243,10 +243,6 @@ export default class Camera extends React.Component<CameraProps> {
|
|
|
243
243
|
*
|
|
244
244
|
* > On native platforms, the local image URI is temporary. Use [`FileSystem.copyAsync`](filesystem.md#filesystemcopyasyncoptions)
|
|
245
245
|
* > to make a permanent copy of the image.
|
|
246
|
-
*
|
|
247
|
-
* > On web, the `uri` is a base64 representation of the image because file system URLs are not supported in the browser.
|
|
248
|
-
* > The `exif` data returned on web is a partial representation of the [`MediaTrackSettings`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings),
|
|
249
|
-
* > if available.
|
|
250
246
|
*/
|
|
251
247
|
async takePictureAsync(options?: CameraPictureOptions): Promise<CameraCapturedPicture> {
|
|
252
248
|
const pictureOptions = ensurePictureOptions(options);
|
package/src/Camera.types.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
PermissionExpiration,
|
|
5
5
|
PermissionHookOptions,
|
|
6
6
|
} from 'expo-modules-core';
|
|
7
|
-
import { ViewProps } from 'react-native';
|
|
7
|
+
import type { ViewProps } from 'react-native';
|
|
8
8
|
|
|
9
9
|
export enum CameraType {
|
|
10
10
|
front = 'front',
|
|
@@ -85,7 +85,10 @@ export enum VideoCodec {
|
|
|
85
85
|
AppleProRes4444 = 'ap4h',
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
/**
|
|
89
|
+
* This option specifies the stabilization mode to use when recording a video.
|
|
90
|
+
* @platform ios
|
|
91
|
+
*/
|
|
89
92
|
export enum VideoStabilization {
|
|
90
93
|
off = 'off',
|
|
91
94
|
standard = 'standard',
|
|
@@ -93,7 +96,7 @@ export enum VideoStabilization {
|
|
|
93
96
|
auto = 'auto',
|
|
94
97
|
}
|
|
95
98
|
|
|
96
|
-
// @
|
|
99
|
+
// @docsMissing
|
|
97
100
|
export enum VideoQuality {
|
|
98
101
|
'2160p' = '2160p',
|
|
99
102
|
'1080p' = '1080p',
|
|
@@ -102,41 +105,62 @@ export enum VideoQuality {
|
|
|
102
105
|
'4:3' = '4:3',
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
// @
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
// @docsMissing
|
|
109
|
+
/**
|
|
110
|
+
* @hidden We do not expose related web methods in docs.
|
|
111
|
+
* @platform web
|
|
112
|
+
*/
|
|
111
113
|
export type ImageSize = {
|
|
112
114
|
width: number;
|
|
113
115
|
height: number;
|
|
114
116
|
};
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
118
|
+
// @docsMissing
|
|
119
|
+
/**
|
|
120
|
+
* @hidden We do not expose related web methods in docs.
|
|
121
|
+
* @platform web
|
|
122
|
+
*/
|
|
123
|
+
export type WebCameraSettings = {
|
|
124
|
+
autoFocus?: string;
|
|
125
|
+
flashMode?: string;
|
|
126
|
+
whiteBalance?: string;
|
|
127
|
+
exposureCompensation?: number;
|
|
128
|
+
colorTemperature?: number;
|
|
129
|
+
iso?: number;
|
|
130
|
+
brightness?: number;
|
|
131
|
+
contrast?: number;
|
|
132
|
+
saturation?: number;
|
|
133
|
+
sharpness?: number;
|
|
134
|
+
focusDistance?: number;
|
|
135
|
+
zoom?: number;
|
|
136
|
+
};
|
|
130
137
|
|
|
138
|
+
// @needsAudit
|
|
131
139
|
export type CameraCapturedPicture = {
|
|
140
|
+
/**
|
|
141
|
+
* Captured image width.
|
|
142
|
+
*/
|
|
132
143
|
width: number;
|
|
144
|
+
/**
|
|
145
|
+
* Captured image height.
|
|
146
|
+
*/
|
|
133
147
|
height: number;
|
|
148
|
+
/**
|
|
149
|
+
* On web, the value of `uri` is the same as `base64` because file system URLs are not supported in the browser.
|
|
150
|
+
*/
|
|
134
151
|
uri: string;
|
|
152
|
+
/**
|
|
153
|
+
* A Base64 representation of the image.
|
|
154
|
+
*/
|
|
135
155
|
base64?: string;
|
|
156
|
+
/**
|
|
157
|
+
* On Android and iOS this object may include various fields based on the device and operating system.
|
|
158
|
+
* On web, it is a partial representation of the [`MediaTrackSettings`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings) dictionary.
|
|
159
|
+
*/
|
|
136
160
|
exif?: Partial<MediaTrackSettings> | any;
|
|
137
161
|
};
|
|
138
162
|
|
|
139
|
-
// @needsAudit
|
|
163
|
+
// @needsAudit
|
|
140
164
|
export type CameraPictureOptions = {
|
|
141
165
|
/**
|
|
142
166
|
* Specify the quality of compression, from 0 to 1. 0 means compress for small size, 1 means compress for maximum quality.
|
|
@@ -195,6 +219,10 @@ export type CameraPictureOptions = {
|
|
|
195
219
|
* @hidden
|
|
196
220
|
*/
|
|
197
221
|
fastMode?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* @hidden
|
|
224
|
+
*/
|
|
225
|
+
maxDownsampling?: number;
|
|
198
226
|
};
|
|
199
227
|
|
|
200
228
|
// @needsAudit
|
|
@@ -235,16 +263,27 @@ export type CameraRecordingOptions = {
|
|
|
235
263
|
codec?: VideoCodec;
|
|
236
264
|
};
|
|
237
265
|
|
|
266
|
+
/**
|
|
267
|
+
* @hidden
|
|
268
|
+
*/
|
|
238
269
|
export type PictureSavedListener = (event: {
|
|
239
270
|
nativeEvent: { data: CameraCapturedPicture; id: number };
|
|
240
271
|
}) => void;
|
|
241
272
|
|
|
273
|
+
/**
|
|
274
|
+
* @hidden
|
|
275
|
+
*/
|
|
242
276
|
export type CameraReadyListener = () => void;
|
|
243
277
|
|
|
278
|
+
/**
|
|
279
|
+
* @hidden
|
|
280
|
+
*/
|
|
244
281
|
export type MountErrorListener = (event: { nativeEvent: CameraMountError }) => void;
|
|
245
282
|
|
|
283
|
+
// @docsMissing
|
|
246
284
|
export type CameraMountError = { message: string };
|
|
247
285
|
|
|
286
|
+
// @docsMissing
|
|
248
287
|
export type Point = {
|
|
249
288
|
x: number;
|
|
250
289
|
y: number;
|
|
@@ -303,34 +342,17 @@ export type BarCodeScanningResult = {
|
|
|
303
342
|
bounds: BarCodeBounds;
|
|
304
343
|
};
|
|
305
344
|
|
|
306
|
-
export type
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
width: number;
|
|
313
|
-
};
|
|
314
|
-
};
|
|
315
|
-
rollAngle: number;
|
|
316
|
-
yawAngle: number;
|
|
317
|
-
smilingProbability: number;
|
|
318
|
-
leftEarPosition: Point;
|
|
319
|
-
rightEarPosition: Point;
|
|
320
|
-
leftEyePosition: Point;
|
|
321
|
-
leftEyeOpenProbability: number;
|
|
322
|
-
rightEyePosition: Point;
|
|
323
|
-
rightEyeOpenProbability: number;
|
|
324
|
-
leftCheekPosition: Point;
|
|
325
|
-
rightCheekPosition: Point;
|
|
326
|
-
mouthPosition: Point;
|
|
327
|
-
leftMouthPosition: Point;
|
|
328
|
-
rightMouthPosition: Point;
|
|
329
|
-
noseBasePosition: Point;
|
|
345
|
+
export type FaceDetectionResult = {
|
|
346
|
+
/**
|
|
347
|
+
* Array of objects representing results of face detection.
|
|
348
|
+
* See [`FaceFeature`](facedetector/#facefeature) in FaceDetector documentation for more details.
|
|
349
|
+
*/
|
|
350
|
+
faces: object[];
|
|
330
351
|
};
|
|
331
352
|
|
|
332
|
-
|
|
333
|
-
|
|
353
|
+
/**
|
|
354
|
+
* @hidden
|
|
355
|
+
*/
|
|
334
356
|
export type ConstantsType = {
|
|
335
357
|
Type: CameraType;
|
|
336
358
|
FlashMode: FlashMode;
|
|
@@ -405,7 +427,7 @@ export type CameraProps = ViewProps & {
|
|
|
405
427
|
* You can read more about each stabilization type in [Apple Documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideostabilizationmode).
|
|
406
428
|
* @platform ios
|
|
407
429
|
*/
|
|
408
|
-
videoStabilizationMode?:
|
|
430
|
+
videoStabilizationMode?: VideoStabilization;
|
|
409
431
|
/**
|
|
410
432
|
* Callback invoked when camera preview could not been started.
|
|
411
433
|
* @param event Error object that contains a `message`.
|
|
@@ -438,7 +460,8 @@ export type CameraProps = ViewProps & {
|
|
|
438
460
|
*/
|
|
439
461
|
faceDetectorSettings?: object;
|
|
440
462
|
/**
|
|
441
|
-
* Callback invoked with results of face detection on the preview.
|
|
463
|
+
* Callback invoked with results of face detection on the preview.
|
|
464
|
+
* See [`DetectionResult`](facedetector/#detectionresult) in FaceDetector documentation for more details.
|
|
442
465
|
* @param faces
|
|
443
466
|
*/
|
|
444
467
|
onFacesDetected?: (faces: FaceDetectionResult) => void;
|
|
@@ -449,6 +472,9 @@ export type CameraProps = ViewProps & {
|
|
|
449
472
|
poster?: string;
|
|
450
473
|
};
|
|
451
474
|
|
|
475
|
+
/**
|
|
476
|
+
* @hidden
|
|
477
|
+
*/
|
|
452
478
|
export type CameraNativeProps = {
|
|
453
479
|
pointerEvents?: any;
|
|
454
480
|
style?: any;
|
|
@@ -475,6 +501,7 @@ export type CameraNativeProps = {
|
|
|
475
501
|
poster?: string;
|
|
476
502
|
};
|
|
477
503
|
|
|
504
|
+
// @docsMissing
|
|
478
505
|
export type BarCodeSettings = {
|
|
479
506
|
barCodeTypes: string[];
|
|
480
507
|
interval?: number;
|
package/src/index.ts
CHANGED
|
@@ -9,26 +9,4 @@ export {
|
|
|
9
9
|
requestMicrophonePermissionsAsync,
|
|
10
10
|
} from './Camera';
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
BarCodePoint,
|
|
14
|
-
BarCodeScanningResult,
|
|
15
|
-
CameraCapturedPicture,
|
|
16
|
-
CameraMountError,
|
|
17
|
-
CameraNativeProps,
|
|
18
|
-
CameraPictureOptions,
|
|
19
|
-
CameraProps,
|
|
20
|
-
CameraRecordingOptions,
|
|
21
|
-
ConstantsType,
|
|
22
|
-
FaceDetectionResult,
|
|
23
|
-
PermissionResponse,
|
|
24
|
-
PermissionStatus,
|
|
25
|
-
PermissionExpiration,
|
|
26
|
-
Point,
|
|
27
|
-
AutoFocus,
|
|
28
|
-
FlashMode,
|
|
29
|
-
CameraType,
|
|
30
|
-
VideoCodec,
|
|
31
|
-
VideoQuality,
|
|
32
|
-
VideoStabilization,
|
|
33
|
-
WhiteBalance,
|
|
34
|
-
} from './Camera.types';
|
|
12
|
+
export * from './Camera.types';
|