expo-camera 13.2.1 → 13.4.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 +12 -0
- package/README.md +2 -2
- package/android/build.gradle +8 -10
- package/android/src/main/AndroidManifest.xml +1 -1
- package/build/Camera.d.ts +6 -1
- package/build/Camera.d.ts.map +1 -1
- package/build/Camera.js +6 -1
- package/build/Camera.js.map +1 -1
- package/build/Camera.types.d.ts +29 -0
- package/build/Camera.types.d.ts.map +1 -1
- package/build/Camera.types.js +7 -0
- package/build/Camera.types.js.map +1 -1
- package/build/ExponentCamera.web.d.ts +1 -1
- package/build/ExponentCamera.web.d.ts.map +1 -1
- package/ios/EXCamera/CameraViewModule.swift +9 -1
- package/ios/EXCamera/EXCamera.h +4 -0
- package/ios/EXCamera/EXCamera.m +37 -2
- package/ios/EXCamera/Utilities/EXCameraUtils.h +2 -0
- package/ios/EXCamera/Utilities/EXCameraUtils.m +20 -0
- package/package.json +2 -2
- package/src/Camera.tsx +12 -0
- package/src/Camera.types.ts +30 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 13.4.0 — 2023-06-13
|
|
14
|
+
|
|
15
|
+
- Fixed `Expo camera - Cannot take landscape photos if screen orientation is locked'` on iOS. ([#21938](https://github.com/expo/expo/issues/21938) by [@chalenascholl](https://github.com/chalenascholl)) ([#21956](https://github.com/expo/expo/pull/21956) by [@chalenascholl](https://github.com/chalenascholl))
|
|
16
|
+
|
|
17
|
+
### 🐛 Bug fixes
|
|
18
|
+
|
|
19
|
+
- Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
|
|
20
|
+
|
|
21
|
+
## 13.3.0 — 2023-05-08
|
|
22
|
+
|
|
23
|
+
_This version does not introduce any user-facing changes._
|
|
24
|
+
|
|
13
25
|
## 13.2.1 — 2023-02-09
|
|
14
26
|
|
|
15
27
|
_This version does not introduce any user-facing changes._
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ A React component that renders a preview for the device's either front or back c
|
|
|
16
16
|
|
|
17
17
|
# Installation in managed Expo projects
|
|
18
18
|
|
|
19
|
-
For [managed](https://docs.expo.dev/
|
|
19
|
+
For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/camera/).
|
|
20
20
|
|
|
21
21
|
# Installation in bare React Native projects
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ For bare React Native projects, you must ensure that you have [installed and con
|
|
|
25
25
|
### Add the package to your npm dependencies
|
|
26
26
|
|
|
27
27
|
```
|
|
28
|
-
expo install expo-camera
|
|
28
|
+
npx expo install expo-camera
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
### Configure for iOS
|
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.4.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -35,19 +35,11 @@ buildscript {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// Creating sources with comments
|
|
39
|
-
task androidSourcesJar(type: Jar) {
|
|
40
|
-
classifier = 'sources'
|
|
41
|
-
from android.sourceSets.main.java.srcDirs
|
|
42
|
-
}
|
|
43
|
-
|
|
44
38
|
afterEvaluate {
|
|
45
39
|
publishing {
|
|
46
40
|
publications {
|
|
47
41
|
release(MavenPublication) {
|
|
48
42
|
from components.release
|
|
49
|
-
// Add additional sourcesJar to artifacts
|
|
50
|
-
artifact(androidSourcesJar)
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
45
|
repositories {
|
|
@@ -70,16 +62,22 @@ android {
|
|
|
70
62
|
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
71
63
|
}
|
|
72
64
|
|
|
65
|
+
namespace "expo.modules.camera"
|
|
73
66
|
defaultConfig {
|
|
74
67
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
75
68
|
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
76
69
|
versionCode 32
|
|
77
|
-
versionName "13.
|
|
70
|
+
versionName "13.4.0"
|
|
78
71
|
}
|
|
79
72
|
|
|
80
73
|
lintOptions {
|
|
81
74
|
abortOnError false
|
|
82
75
|
}
|
|
76
|
+
publishing {
|
|
77
|
+
singleVariant("release") {
|
|
78
|
+
withSourcesJar()
|
|
79
|
+
}
|
|
80
|
+
}
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
repositories {
|
package/build/Camera.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { CameraCapturedPicture, CameraPictureOptions, CameraProps, CameraRecordingOptions, CameraType, ConstantsType, PermissionResponse, VideoCodec } from './Camera.types';
|
|
2
|
+
import { CameraCapturedPicture, CameraOrientation, CameraPictureOptions, CameraProps, CameraRecordingOptions, CameraType, ConstantsType, PermissionResponse, VideoCodec } from './Camera.types';
|
|
3
3
|
export default class Camera extends React.Component<CameraProps> {
|
|
4
4
|
/**
|
|
5
5
|
* Check whether the current device has a camera. This is useful for web and simulators cases.
|
|
@@ -149,6 +149,11 @@ export default class Camera extends React.Component<CameraProps> {
|
|
|
149
149
|
message: string;
|
|
150
150
|
};
|
|
151
151
|
}) => void;
|
|
152
|
+
_onResponsiveOrientationChanged: ({ nativeEvent, }: {
|
|
153
|
+
nativeEvent: {
|
|
154
|
+
orientation: CameraOrientation;
|
|
155
|
+
};
|
|
156
|
+
}) => void;
|
|
152
157
|
_onObjectDetected: (callback?: Function) => ({ nativeEvent }: {
|
|
153
158
|
nativeEvent: any;
|
|
154
159
|
}) => void;
|
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,IAAI,OAAO,CAAC,OAAO,CAAC;IAQjD;;;OAGG;WACU,4BAA4B,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IASlE;;;;OAIG;WACU,4BAA4B,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAQlE,MAAM,CAAC,SAAS,EAAE,aAAa,CAQ7B;IAGF,MAAM,CAAC,gBAAgB;;;;;MAAoB;IAE3C,MAAM,CAAC,YAAY,EAAE,WAAW,CAS9B;IAGF;;;OAGG;WACU,mBAAmB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAQ/D;;;;;OAKG;WACU,uBAAuB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAQnE;;;OAGG;WACU,yBAAyB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAKrE;;;;OAIG;WACU,6BAA6B,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAKzE;;;;;;;;OAQG;IACH,MAAM,CAAC,oBAAoB,yLAGxB;IAGH;;;OAGG;WACU,6BAA6B,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAKzE;;;;OAIG;WACU,iCAAiC,IAAI,OAAO,CAA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AC,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,+BAA+B;qBAGhB;YAAE,aAAa,iBAAiB,CAAA;SAAE;eAK/C;IAEF,iBAAiB,cACH,QAAQ;qBACa,GAAG;eAgBlC;IAEJ,aAAa,SAAU,MAAM,SAAS,UAapC;IAEF,MAAM;CAsBP;AAED,eAAO,MACL,SAAS,iBACT,mBAAmB,qCACnB,uBAAuB,yCACvB,yBAAyB,2CACzB,6BAA6B,+CAC7B,6BAA6B,+CAC7B,iCAAiC,iDACzB,CAAC"}
|
package/build/Camera.js
CHANGED
|
@@ -277,6 +277,11 @@ export default class Camera extends React.Component {
|
|
|
277
277
|
this.props.onMountError(nativeEvent);
|
|
278
278
|
}
|
|
279
279
|
};
|
|
280
|
+
_onResponsiveOrientationChanged = ({ nativeEvent, }) => {
|
|
281
|
+
if (this.props.onResponsiveOrientationChanged) {
|
|
282
|
+
this.props.onResponsiveOrientationChanged(nativeEvent);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
280
285
|
_onObjectDetected = (callback) => ({ nativeEvent }) => {
|
|
281
286
|
const { type } = nativeEvent;
|
|
282
287
|
if (this._lastEvents[type] &&
|
|
@@ -313,7 +318,7 @@ export default class Camera extends React.Component {
|
|
|
313
318
|
? this._onObjectDetected(this.props.onBarCodeScanned)
|
|
314
319
|
: undefined;
|
|
315
320
|
const onFacesDetected = this._onObjectDetected(this.props.onFacesDetected);
|
|
316
|
-
return (React.createElement(ExponentCamera, { ...nativeProps, ref: this._setReference, onCameraReady: this._onCameraReady, onMountError: this._onMountError, onBarCodeScanned: onBarCodeScanned, onFacesDetected: onFacesDetected, onPictureSaved: _onPictureSaved }));
|
|
321
|
+
return (React.createElement(ExponentCamera, { ...nativeProps, ref: this._setReference, onCameraReady: this._onCameraReady, onMountError: this._onMountError, onBarCodeScanned: onBarCodeScanned, onFacesDetected: onFacesDetected, onPictureSaved: _onPictureSaved, onResponsiveOrientationChanged: this._onResponsiveOrientationChanged }));
|
|
317
322
|
}
|
|
318
323
|
}
|
|
319
324
|
export const { Constants, getPermissionsAsync, requestPermissionsAsync, getCameraPermissionsAsync, requestCameraPermissionsAsync, getMicrophonePermissionsAsync, requestMicrophonePermissionsAsync, } = Camera;
|
package/build/Camera.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.js","sourceRoot":"","sources":["../src/Camera.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAY9C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAEpC,IAAI,kBAAkB,GAAG,CAAC,CAAC;AAE3B,SAAS,oBAAoB,CAAC,OAA8B;IAC1D,MAAM,cAAc,GAClB,CAAC,OA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,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"]}
|
|
1
|
+
{"version":3,"file":"Camera.js","sourceRoot":"","sources":["../src/Camera.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAa9C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAEpC,IAAI,kBAAkB,GAAG,CAAC,CAAC;AAE3B,SAAS,oBAAoB,CAAC,OAA8B;IAC1D,MAAM,cAAc,GAClB,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IAEzD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAC3B,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC;KAC5B;IACD,IAAI,cAAc,CAAC,cAAc,EAAE;QACjC,MAA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,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,EAC/B,8BAA8B,EAAE,IAAI,CAAC,+BAA+B,GACpE,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 CameraOrientation,\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 _onResponsiveOrientationChanged = ({\n nativeEvent,\n }: {\n nativeEvent: { orientation: CameraOrientation };\n }) => {\n if (this.props.onResponsiveOrientationChanged) {\n this.props.onResponsiveOrientationChanged(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 onResponsiveOrientationChanged={this._onResponsiveOrientationChanged}\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
|
@@ -90,6 +90,12 @@ export declare enum VideoQuality {
|
|
|
90
90
|
'480p' = "480p",
|
|
91
91
|
'4:3' = "4:3"
|
|
92
92
|
}
|
|
93
|
+
export declare enum CameraOrientation {
|
|
94
|
+
portrait = 1,
|
|
95
|
+
portraitUpsideDown = 2,
|
|
96
|
+
landscapeLeft = 3,
|
|
97
|
+
landscapeRight = 4
|
|
98
|
+
}
|
|
93
99
|
/**
|
|
94
100
|
* @hidden We do not expose related web methods in docs.
|
|
95
101
|
* @platform web
|
|
@@ -252,6 +258,15 @@ export type PictureSavedListener = (event: {
|
|
|
252
258
|
* @hidden
|
|
253
259
|
*/
|
|
254
260
|
export type CameraReadyListener = () => void;
|
|
261
|
+
/**
|
|
262
|
+
* @hidden
|
|
263
|
+
*/
|
|
264
|
+
export type ResponsiveOrientationChangedListener = (event: {
|
|
265
|
+
nativeEvent: ResponsiveOrientationChanged;
|
|
266
|
+
}) => void;
|
|
267
|
+
export type ResponsiveOrientationChanged = {
|
|
268
|
+
orientation: CameraOrientation;
|
|
269
|
+
};
|
|
255
270
|
/**
|
|
256
271
|
* @hidden
|
|
257
272
|
*/
|
|
@@ -438,6 +453,18 @@ export type CameraProps = ViewProps & {
|
|
|
438
453
|
* @platform web
|
|
439
454
|
*/
|
|
440
455
|
poster?: string;
|
|
456
|
+
/**
|
|
457
|
+
* Whether to allow responsive orientation of the camera when the screen orientation is locked (i.e. when set to `true`
|
|
458
|
+
* landscape photos will be taken if the device is turned that way, even if the app or device orientation is locked to portrait)
|
|
459
|
+
* @platform ios
|
|
460
|
+
*/
|
|
461
|
+
responsiveOrientationWhenOrientationLocked?: boolean;
|
|
462
|
+
/**
|
|
463
|
+
* Callback invoked when responsive orientation changes. Only applicable if `responsiveOrientationWhenOrientationLocked` is `true`
|
|
464
|
+
* @param event result object that contains updated orientation of camera
|
|
465
|
+
* @platform ios
|
|
466
|
+
*/
|
|
467
|
+
onResponsiveOrientationChanged?: (event: ResponsiveOrientationChanged) => void;
|
|
441
468
|
};
|
|
442
469
|
/**
|
|
443
470
|
* @hidden
|
|
@@ -458,6 +485,7 @@ export type CameraNativeProps = {
|
|
|
458
485
|
nativeEvent: Error;
|
|
459
486
|
}) => void;
|
|
460
487
|
onPictureSaved?: PictureSavedListener;
|
|
488
|
+
onResponsiveOrientationChanged?: ResponsiveOrientationChangedListener;
|
|
461
489
|
type?: number | string;
|
|
462
490
|
flashMode?: number | string;
|
|
463
491
|
autoFocus?: string | boolean | number;
|
|
@@ -472,6 +500,7 @@ export type CameraNativeProps = {
|
|
|
472
500
|
ratio?: string;
|
|
473
501
|
useCamera2Api?: boolean;
|
|
474
502
|
poster?: string;
|
|
503
|
+
responsiveOrientationWhenOrientationLocked?: boolean;
|
|
475
504
|
};
|
|
476
505
|
export type BarCodeSettings = {
|
|
477
506
|
barCodeTypes: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.types.d.ts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,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,KAAK,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/D,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,8BAA8B,CAAC,EAAE,oCAAoC,CAAC;IACtE,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;IAChB,0CAA0C,CAAC,EAAE,OAAO,CAAC;CACtD,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
|
@@ -98,5 +98,12 @@ export var VideoQuality;
|
|
|
98
98
|
VideoQuality["480p"] = "480p";
|
|
99
99
|
VideoQuality["4:3"] = "4:3";
|
|
100
100
|
})(VideoQuality || (VideoQuality = {}));
|
|
101
|
+
export var CameraOrientation;
|
|
102
|
+
(function (CameraOrientation) {
|
|
103
|
+
CameraOrientation[CameraOrientation["portrait"] = 1] = "portrait";
|
|
104
|
+
CameraOrientation[CameraOrientation["portraitUpsideDown"] = 2] = "portraitUpsideDown";
|
|
105
|
+
CameraOrientation[CameraOrientation["landscapeLeft"] = 3] = "landscapeLeft";
|
|
106
|
+
CameraOrientation[CameraOrientation["landscapeRight"] = 4] = "landscapeRight";
|
|
107
|
+
})(CameraOrientation || (CameraOrientation = {}));
|
|
101
108
|
export { PermissionStatus };
|
|
102
109
|
//# sourceMappingURL=Camera.types.js.map
|
|
@@ -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;;;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"]}
|
|
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,S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AAY,KAAZ,YAAY,QAMvB;AAED,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,iEAAY,CAAA;IACZ,qFAAsB,CAAA;IACtB,2EAAiB,CAAA;IACjB,6EAAkB,CAAA;AACpB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AA2aD,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\nexport enum CameraOrientation {\n portrait = 1,\n portraitUpsideDown = 2,\n landscapeLeft = 3,\n landscapeRight = 4,\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 ResponsiveOrientationChangedListener = (event: {\n nativeEvent: ResponsiveOrientationChanged;\n}) => void;\n\nexport type ResponsiveOrientationChanged = { orientation: CameraOrientation };\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 * Whether to allow responsive orientation of the camera when the screen orientation is locked (i.e. when set to `true`\n * landscape photos will be taken if the device is turned that way, even if the app or device orientation is locked to portrait)\n * @platform ios\n */\n responsiveOrientationWhenOrientationLocked?: boolean;\n /**\n * Callback invoked when responsive orientation changes. Only applicable if `responsiveOrientationWhenOrientationLocked` is `true`\n * @param event result object that contains updated orientation of camera\n * @platform ios\n */\n onResponsiveOrientationChanged?: (event: ResponsiveOrientationChanged) => void;\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 onResponsiveOrientationChanged?: ResponsiveOrientationChangedListener;\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 responsiveOrientationWhenOrientationLocked?: boolean;\n};\n\n// @docsMissing\nexport type BarCodeSettings = {\n barCodeTypes: string[];\n interval?: number;\n};\n\nexport { PermissionResponse, PermissionStatus, PermissionExpiration, PermissionHookOptions };\n"]}
|
|
@@ -8,6 +8,6 @@ export interface ExponentCameraRef {
|
|
|
8
8
|
}
|
|
9
9
|
declare const ExponentCamera: React.ForwardRefExoticComponent<Pick<CameraNativeProps & {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
|
-
}, "type" | "flashMode" | "autoFocus" | "whiteBalance" | "children" | "pointerEvents" | "style" | "zoom" | "ratio" | "focusDepth" | "onCameraReady" | "useCamera2Api" | "pictureSize" | "onMountError" | "barCodeScannerSettings" | "onBarCodeScanned" | "faceDetectorSettings" | "onFacesDetected" | "poster" | "onFaceDetectionError" | "onPictureSaved" | "barCodeScannerEnabled" | "faceDetectorEnabled"> & React.RefAttributes<ExponentCameraRef>>;
|
|
11
|
+
}, "type" | "flashMode" | "autoFocus" | "whiteBalance" | "children" | "pointerEvents" | "style" | "zoom" | "ratio" | "focusDepth" | "onCameraReady" | "useCamera2Api" | "pictureSize" | "onMountError" | "barCodeScannerSettings" | "onBarCodeScanned" | "faceDetectorSettings" | "onFacesDetected" | "poster" | "responsiveOrientationWhenOrientationLocked" | "onResponsiveOrientationChanged" | "onFaceDetectionError" | "onPictureSaved" | "barCodeScannerEnabled" | "faceDetectorEnabled"> & React.RefAttributes<ExponentCameraRef>>;
|
|
12
12
|
export default ExponentCamera;
|
|
13
13
|
//# sourceMappingURL=ExponentCamera.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExponentCamera.web.d.ts","sourceRoot":"","sources":["../src/ExponentCamera.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,gBAAgB,CAAC;AAOxB,MAAM,WAAW,iBAAiB;IAChC,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/D,WAAW,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC/E,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,QAAA,MAAM,cAAc;eAE0D,MAAM,SAAS;
|
|
1
|
+
{"version":3,"file":"ExponentCamera.web.d.ts","sourceRoot":"","sources":["../src/ExponentCamera.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,gBAAgB,CAAC;AAOxB,MAAM,WAAW,iBAAiB;IAChC,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/D,WAAW,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC/E,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,QAAA,MAAM,cAAc;eAE0D,MAAM,SAAS;ygBA+G5F,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -67,7 +67,8 @@ public final class CameraViewModule: Module {
|
|
|
67
67
|
"onMountError",
|
|
68
68
|
"onPictureSaved",
|
|
69
69
|
"onBarCodeScanned",
|
|
70
|
-
"onFacesDetected"
|
|
70
|
+
"onFacesDetected",
|
|
71
|
+
"onResponsiveOrientationChanged"
|
|
71
72
|
)
|
|
72
73
|
|
|
73
74
|
Prop("type") { (view, type: Int) in
|
|
@@ -136,6 +137,13 @@ public final class CameraViewModule: Module {
|
|
|
136
137
|
view.isScanningBarCodes = scanBarCodes
|
|
137
138
|
}
|
|
138
139
|
}
|
|
140
|
+
|
|
141
|
+
Prop("responsiveOrientationWhenOrientationLocked") { (view, responsiveOrientation: Bool) in
|
|
142
|
+
if view.responsiveOrientationWhenOrientationLocked != responsiveOrientation {
|
|
143
|
+
view.responsiveOrientationWhenOrientationLocked = responsiveOrientation
|
|
144
|
+
view.updateResponsiveOrientationWhenOrientationLocked()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
139
147
|
}
|
|
140
148
|
|
|
141
149
|
AsyncFunction("takePicture") { (options: TakePictureOptions, viewTag: Int, promise: Promise) in
|
package/ios/EXCamera/EXCamera.h
CHANGED
|
@@ -80,6 +80,8 @@ typedef NS_ENUM(NSInteger, EXCameraVideoCodec) {
|
|
|
80
80
|
@property (nonatomic, assign) NSInteger whiteBalance;
|
|
81
81
|
@property (assign, nonatomic) AVCaptureSessionPreset pictureSize;
|
|
82
82
|
@property (nonatomic, assign) AVCaptureVideoStabilizationMode videoStabilizationMode;
|
|
83
|
+
@property (nonatomic, assign) BOOL responsiveOrientationWhenOrientationLocked;
|
|
84
|
+
|
|
83
85
|
|
|
84
86
|
@property (nonatomic, assign) BOOL isScanningBarCodes;
|
|
85
87
|
@property (nonatomic, assign) BOOL isDetectingFaces;
|
|
@@ -93,6 +95,7 @@ typedef NS_ENUM(NSInteger, EXCameraVideoCodec) {
|
|
|
93
95
|
- (void)updateZoom;
|
|
94
96
|
- (void)updateWhiteBalance;
|
|
95
97
|
- (void)updatePictureSize;
|
|
98
|
+
- (void)updateResponsiveOrientationWhenOrientationLocked;
|
|
96
99
|
- (void)updateFaceDetectorSettings:(NSDictionary *)settings;
|
|
97
100
|
- (void)setBarCodeScannerSettings:(NSDictionary *)settings;
|
|
98
101
|
- (void)takePicture:(NSDictionary *)options resolve:(EXPromiseResolveBlock)resolve reject:(EXPromiseRejectBlock)reject;
|
|
@@ -102,6 +105,7 @@ typedef NS_ENUM(NSInteger, EXCameraVideoCodec) {
|
|
|
102
105
|
- (void)pausePreview;
|
|
103
106
|
- (void)onReady:(NSDictionary *)event;
|
|
104
107
|
- (void)onMountingError:(NSDictionary *)event;
|
|
108
|
+
- (void)onResponsiveOrientationChanged:(NSDictionary *)event;
|
|
105
109
|
- (void)onPictureSaved:(NSDictionary *)event;
|
|
106
110
|
|
|
107
111
|
@end
|
package/ios/EXCamera/EXCamera.m
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import <AVFoundation/AVFoundation.h>
|
|
2
|
+
#import <CoreMotion/CoreMotion.h>
|
|
2
3
|
|
|
3
4
|
#import <ExpoModulesCore/EXBarcodeScannerProviderInterface.h>
|
|
4
5
|
#import <EXCamera/EXCamera.h>
|
|
@@ -19,9 +20,11 @@
|
|
|
19
20
|
@property (nonatomic, strong) id<EXBarCodeScannerInterface> barCodeScanner;
|
|
20
21
|
@property (nonatomic, weak) id<EXPermissionsInterface> permissionsManager;
|
|
21
22
|
@property (nonatomic, weak) id<EXAppLifecycleService> lifecycleManager;
|
|
23
|
+
@property (nonatomic, strong) CMMotionManager * motionManager;
|
|
22
24
|
|
|
23
25
|
@property (nonatomic, assign, getter=isSessionPaused) BOOL paused;
|
|
24
26
|
@property (nonatomic, assign) BOOL isValidVideoOptions;
|
|
27
|
+
@property (nonatomic, assign) UIDeviceOrientation physicalOrientation;
|
|
25
28
|
|
|
26
29
|
@property (nonatomic, strong) NSDictionary *photoCaptureOptions;
|
|
27
30
|
@property (nonatomic, strong) EXPromiseResolveBlock photoCapturedResolve;
|
|
@@ -33,6 +36,7 @@
|
|
|
33
36
|
@property (nonatomic, copy) EXDirectEventBlock onCameraReady;
|
|
34
37
|
@property (nonatomic, copy) EXDirectEventBlock onMountError;
|
|
35
38
|
@property (nonatomic, copy) EXDirectEventBlock onPictureSaved;
|
|
39
|
+
@property (nonatomic, copy) EXDirectEventBlock onResponsiveOrientationChanged;
|
|
36
40
|
|
|
37
41
|
@property (nonatomic, copy) EXDirectEventBlock onBarCodeScanned;
|
|
38
42
|
@property (nonatomic, copy) EXDirectEventBlock onFacesDetected;
|
|
@@ -70,6 +74,9 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
|
|
|
70
74
|
name:UIDeviceOrientationDidChangeNotification
|
|
71
75
|
object:nil];
|
|
72
76
|
[_lifecycleManager registerAppLifecycleListener:self];
|
|
77
|
+
_motionManager = [[CMMotionManager alloc] init];
|
|
78
|
+
_motionManager.accelerometerUpdateInterval = 0.2;
|
|
79
|
+
_motionManager.gyroUpdateInterval = 0.2;
|
|
73
80
|
}
|
|
74
81
|
return self;
|
|
75
82
|
}
|
|
@@ -114,6 +121,13 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
|
|
|
114
121
|
}
|
|
115
122
|
}
|
|
116
123
|
|
|
124
|
+
- (void)onResponsiveOrientationChanged:(NSDictionary *)event
|
|
125
|
+
{
|
|
126
|
+
if (_onResponsiveOrientationChanged) {
|
|
127
|
+
_onResponsiveOrientationChanged(event);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
117
131
|
- (void)layoutSubviews
|
|
118
132
|
{
|
|
119
133
|
[super layoutSubviews];
|
|
@@ -311,6 +325,24 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
|
|
|
311
325
|
[self updateSessionPreset:_pictureSize];
|
|
312
326
|
}
|
|
313
327
|
|
|
328
|
+
- (void)updateResponsiveOrientationWhenOrientationLocked
|
|
329
|
+
{
|
|
330
|
+
if (self.responsiveOrientationWhenOrientationLocked) {
|
|
331
|
+
[self.motionManager startAccelerometerUpdatesToQueue:[NSOperationQueue new]
|
|
332
|
+
withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) {
|
|
333
|
+
if (!error) {
|
|
334
|
+
UIDeviceOrientation deviceOrientation = [EXCameraUtils deviceOrientationForAccelerometerData:self.motionManager.accelerometerData defaultOrientation:self.physicalOrientation];
|
|
335
|
+
if (deviceOrientation != self.physicalOrientation) {
|
|
336
|
+
self.physicalOrientation = deviceOrientation;
|
|
337
|
+
[self onResponsiveOrientationChanged:@{@"orientation": [[NSNumber alloc] initWithInteger:deviceOrientation]}];
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}];
|
|
341
|
+
} else {
|
|
342
|
+
[self.motionManager stopAccelerometerUpdates];
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
314
346
|
- (void)setIsScanningBarCodes:(BOOL)barCodeScanning
|
|
315
347
|
{
|
|
316
348
|
if (_barCodeScanner) {
|
|
@@ -354,7 +386,8 @@ static NSDictionary *defaultFaceDetectorOptions = nil;
|
|
|
354
386
|
return;
|
|
355
387
|
}
|
|
356
388
|
AVCaptureConnection *connection = [_photoOutput connectionWithMediaType:AVMediaTypeVideo];
|
|
357
|
-
|
|
389
|
+
UIDeviceOrientation deviceOrientation = self.responsiveOrientationWhenOrientationLocked ? self.physicalOrientation : [[UIDevice currentDevice] orientation];
|
|
390
|
+
[connection setVideoOrientation:[EXCameraUtils videoOrientationForDeviceOrientation:deviceOrientation]];
|
|
358
391
|
|
|
359
392
|
_photoCapturedReject = reject;
|
|
360
393
|
_photoCapturedResolve = resolve;
|
|
@@ -549,7 +582,8 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
|
|
|
549
582
|
} else {
|
|
550
583
|
[connection setPreferredVideoStabilizationMode:self.videoStabilizationMode];
|
|
551
584
|
}
|
|
552
|
-
|
|
585
|
+
UIDeviceOrientation deviceOrientation = self.responsiveOrientationWhenOrientationLocked ? self.physicalOrientation : [[UIDevice currentDevice] orientation];
|
|
586
|
+
[connection setVideoOrientation:[EXCameraUtils videoOrientationForDeviceOrientation:deviceOrientation]];
|
|
553
587
|
|
|
554
588
|
AVCaptureSessionPreset preset;
|
|
555
589
|
if (options[@"quality"]) {
|
|
@@ -741,6 +775,7 @@ previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer
|
|
|
741
775
|
if (self.barCodeScanner) {
|
|
742
776
|
[self.barCodeScanner stopBarCodeScanning];
|
|
743
777
|
}
|
|
778
|
+
[self.motionManager stopAccelerometerUpdates];
|
|
744
779
|
[self.previewLayer removeFromSuperlayer];
|
|
745
780
|
[self.session commitConfiguration];
|
|
746
781
|
[self.session stopRunning];
|
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
#import <UIKit/UIKit.h>
|
|
10
10
|
#import <AVFoundation/AVFoundation.h>
|
|
11
|
+
#import <CoreMotion/CoreMotion.h>
|
|
11
12
|
#import <EXCamera/EXCamera.h>
|
|
12
13
|
|
|
13
14
|
@interface EXCameraUtils : NSObject
|
|
14
15
|
|
|
15
16
|
// Camera utilities
|
|
16
17
|
+ (AVCaptureDevice *)deviceWithMediaType:(NSString *)mediaType preferringPosition:(AVCaptureDevicePosition)position;
|
|
18
|
+
+ (UIDeviceOrientation)deviceOrientationForAccelerometerData:(CMAccelerometerData*)accelerometerData defaultOrientation:(UIDeviceOrientation)orientation;
|
|
17
19
|
|
|
18
20
|
// Enum conversions
|
|
19
21
|
+ (float)temperatureForWhiteBalance:(EXCameraWhiteBalance)whiteBalance;
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
#import <EXCamera/EXCameraUtils.h>
|
|
10
10
|
|
|
11
|
+
#import <CoreMotion/CoreMotion.h>
|
|
12
|
+
|
|
11
13
|
@implementation EXCameraUtils
|
|
12
14
|
|
|
13
15
|
# pragma mark - Camera utilities
|
|
@@ -17,6 +19,24 @@
|
|
|
17
19
|
return [AVCaptureDevice defaultDeviceWithDeviceType:AVCaptureDeviceTypeBuiltInWideAngleCamera mediaType:mediaType position:position];
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
+ (UIDeviceOrientation)deviceOrientationForAccelerometerData:(CMAccelerometerData*)accelerometerData defaultOrientation:(UIDeviceOrientation)orientation
|
|
23
|
+
{
|
|
24
|
+
if (accelerometerData.acceleration.x >= 0.75) {
|
|
25
|
+
return UIDeviceOrientationLandscapeRight;
|
|
26
|
+
}
|
|
27
|
+
if(accelerometerData.acceleration.x <= -0.75) {
|
|
28
|
+
return UIDeviceOrientationLandscapeLeft;
|
|
29
|
+
}
|
|
30
|
+
if(accelerometerData.acceleration.y <= -0.75) {
|
|
31
|
+
return UIDeviceOrientationPortrait;
|
|
32
|
+
}
|
|
33
|
+
if(accelerometerData.acceleration.y >= 0.75) {
|
|
34
|
+
return UIDeviceOrientationPortraitUpsideDown;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return orientation;
|
|
38
|
+
}
|
|
39
|
+
|
|
20
40
|
# pragma mark - Enum conversion
|
|
21
41
|
|
|
22
42
|
+ (AVCaptureVideoOrientation)videoOrientationForInterfaceOrientation:(UIInterfaceOrientation)orientation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-camera",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.4.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": "3ccd2edee9cbfed217557675cb50f0ba5e55a9e4"
|
|
47
47
|
}
|
package/src/Camera.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { findNodeHandle } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
CameraCapturedPicture,
|
|
7
|
+
CameraOrientation,
|
|
7
8
|
CameraPictureOptions,
|
|
8
9
|
CameraProps,
|
|
9
10
|
CameraRecordingOptions,
|
|
@@ -339,6 +340,16 @@ export default class Camera extends React.Component<CameraProps> {
|
|
|
339
340
|
}
|
|
340
341
|
};
|
|
341
342
|
|
|
343
|
+
_onResponsiveOrientationChanged = ({
|
|
344
|
+
nativeEvent,
|
|
345
|
+
}: {
|
|
346
|
+
nativeEvent: { orientation: CameraOrientation };
|
|
347
|
+
}) => {
|
|
348
|
+
if (this.props.onResponsiveOrientationChanged) {
|
|
349
|
+
this.props.onResponsiveOrientationChanged(nativeEvent);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
|
|
342
353
|
_onObjectDetected =
|
|
343
354
|
(callback?: Function) =>
|
|
344
355
|
({ nativeEvent }: { nativeEvent: any }) => {
|
|
@@ -392,6 +403,7 @@ export default class Camera extends React.Component<CameraProps> {
|
|
|
392
403
|
onBarCodeScanned={onBarCodeScanned}
|
|
393
404
|
onFacesDetected={onFacesDetected}
|
|
394
405
|
onPictureSaved={_onPictureSaved}
|
|
406
|
+
onResponsiveOrientationChanged={this._onResponsiveOrientationChanged}
|
|
395
407
|
/>
|
|
396
408
|
);
|
|
397
409
|
}
|
package/src/Camera.types.ts
CHANGED
|
@@ -105,6 +105,13 @@ export enum VideoQuality {
|
|
|
105
105
|
'4:3' = '4:3',
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
export enum CameraOrientation {
|
|
109
|
+
portrait = 1,
|
|
110
|
+
portraitUpsideDown = 2,
|
|
111
|
+
landscapeLeft = 3,
|
|
112
|
+
landscapeRight = 4,
|
|
113
|
+
}
|
|
114
|
+
|
|
108
115
|
// @docsMissing
|
|
109
116
|
/**
|
|
110
117
|
* @hidden We do not expose related web methods in docs.
|
|
@@ -275,6 +282,15 @@ export type PictureSavedListener = (event: {
|
|
|
275
282
|
*/
|
|
276
283
|
export type CameraReadyListener = () => void;
|
|
277
284
|
|
|
285
|
+
/**
|
|
286
|
+
* @hidden
|
|
287
|
+
*/
|
|
288
|
+
export type ResponsiveOrientationChangedListener = (event: {
|
|
289
|
+
nativeEvent: ResponsiveOrientationChanged;
|
|
290
|
+
}) => void;
|
|
291
|
+
|
|
292
|
+
export type ResponsiveOrientationChanged = { orientation: CameraOrientation };
|
|
293
|
+
|
|
278
294
|
/**
|
|
279
295
|
* @hidden
|
|
280
296
|
*/
|
|
@@ -470,6 +486,18 @@ export type CameraProps = ViewProps & {
|
|
|
470
486
|
* @platform web
|
|
471
487
|
*/
|
|
472
488
|
poster?: string;
|
|
489
|
+
/**
|
|
490
|
+
* Whether to allow responsive orientation of the camera when the screen orientation is locked (i.e. when set to `true`
|
|
491
|
+
* landscape photos will be taken if the device is turned that way, even if the app or device orientation is locked to portrait)
|
|
492
|
+
* @platform ios
|
|
493
|
+
*/
|
|
494
|
+
responsiveOrientationWhenOrientationLocked?: boolean;
|
|
495
|
+
/**
|
|
496
|
+
* Callback invoked when responsive orientation changes. Only applicable if `responsiveOrientationWhenOrientationLocked` is `true`
|
|
497
|
+
* @param event result object that contains updated orientation of camera
|
|
498
|
+
* @platform ios
|
|
499
|
+
*/
|
|
500
|
+
onResponsiveOrientationChanged?: (event: ResponsiveOrientationChanged) => void;
|
|
473
501
|
};
|
|
474
502
|
|
|
475
503
|
/**
|
|
@@ -485,6 +513,7 @@ export type CameraNativeProps = {
|
|
|
485
513
|
onFacesDetected?: (event: { nativeEvent: FaceDetectionResult }) => void;
|
|
486
514
|
onFaceDetectionError?: (event: { nativeEvent: Error }) => void;
|
|
487
515
|
onPictureSaved?: PictureSavedListener;
|
|
516
|
+
onResponsiveOrientationChanged?: ResponsiveOrientationChangedListener;
|
|
488
517
|
type?: number | string;
|
|
489
518
|
flashMode?: number | string;
|
|
490
519
|
autoFocus?: string | boolean | number;
|
|
@@ -499,6 +528,7 @@ export type CameraNativeProps = {
|
|
|
499
528
|
ratio?: string;
|
|
500
529
|
useCamera2Api?: boolean;
|
|
501
530
|
poster?: string;
|
|
531
|
+
responsiveOrientationWhenOrientationLocked?: boolean;
|
|
502
532
|
};
|
|
503
533
|
|
|
504
534
|
// @docsMissing
|