expo-camera 16.0.0 → 16.0.2
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 +10 -0
- package/android/build.gradle +2 -2
- package/build/Camera.types.d.ts +1 -1
- package/build/Camera.types.d.ts.map +1 -1
- package/build/Camera.types.js.map +1 -1
- package/build/CameraView.d.ts +3 -3
- package/build/CameraView.d.ts.map +1 -1
- package/build/CameraView.js.map +1 -1
- package/build/utils/props.d.ts +3 -3
- package/build/utils/props.d.ts.map +1 -1
- package/build/utils/props.js.map +1 -1
- package/ios/CameraViewModule.swift +0 -1
- package/ios/Current/BarcodeScanner.swift +22 -95
- package/ios/Current/CameraView.swift +14 -16
- package/ios/Current/MetatDataDelegate.swift +112 -0
- package/package.json +2 -2
- package/src/Camera.types.ts +1 -1
- package/src/CameraView.tsx +3 -3
- package/src/utils/props.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 16.0.2 — 2024-10-25
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 16.0.1 — 2024-10-24
|
|
18
|
+
|
|
19
|
+
_This version does not introduce any user-facing changes._
|
|
20
|
+
|
|
13
21
|
## 16.0.0 — 2024-10-22
|
|
14
22
|
|
|
15
23
|
### 🛠 Breaking changes
|
|
@@ -29,6 +37,8 @@
|
|
|
29
37
|
- Fixed issue regarding using the "back"-facing on mobile web browswer. ([#30811](https://github.com/expo/expo/pull/30811) by [@entiendoNull](https://github.com/entiendoNull))
|
|
30
38
|
- Fix `takePictureAsync` `quality` option when set to 0. ([#31587](https://github.com/expo/expo/pull/31587) by [@davidavz](https://github.com/davidavz))
|
|
31
39
|
- [iOS] Fix crash related to `sublayers` on 0.75 and above on the new architecture. ([#32194](https://github.com/expo/expo/pull/32194) by [@alanjhughes](https://github.com/alanjhughes))
|
|
40
|
+
- [iOS] Fix regression in running the cameras cleanup function. ([#32333](https://github.com/expo/expo/pull/32333) by [@alanjhughes](https://github.com/alanjhughes))
|
|
41
|
+
- [iOS] Use an `Actor` to ensure correct order of changes to the barcode scanners outputs. ([#32353](https://github.com/expo/expo/pull/32353) by [@alanjhughes](https://github.com/alanjhughes))
|
|
32
42
|
|
|
33
43
|
### 💡 Others
|
|
34
44
|
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'host.exp.exponent'
|
|
4
|
-
version = '16.0.
|
|
4
|
+
version = '16.0.2'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -14,7 +14,7 @@ android {
|
|
|
14
14
|
namespace "expo.modules.camera"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 32
|
|
17
|
-
versionName "16.0.
|
|
17
|
+
versionName "16.0.2"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
package/build/Camera.types.d.ts
CHANGED
|
@@ -261,7 +261,7 @@ export type BarcodeScanningResult = {
|
|
|
261
261
|
bounds: BarcodeBounds;
|
|
262
262
|
};
|
|
263
263
|
export type ScanningResult = Omit<BarcodeScanningResult, 'bounds'>;
|
|
264
|
-
export type
|
|
264
|
+
export type CameraViewProps = ViewProps & {
|
|
265
265
|
/**
|
|
266
266
|
* Camera facing. Use one of `CameraType`. When `front`, use the front-facing camera.
|
|
267
267
|
* When `back`, use the back-facing camera.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.types.d.ts","sourceRoot":"","sources":["../src/Camera.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,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CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C,CAAC,EAAE,OAAO,CAAC;CACtD,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,OAAO,GACP,MAAM,GACN,IAAI,GACJ,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAEZ,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,IAAI,YAAY,GAClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.types.js","sourceRoot":"","sources":["../src/Camera.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,GAIjB,MAAM,mBAAmB,CAAC;AAggB3B,OAAO,EAEL,gBAAgB,GAIjB,CAAC","sourcesContent":["import {\n PermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n EventSubscription,\n} from 'expo-modules-core';\nimport type { Ref } from 'react';\nimport type { ViewProps } from 'react-native';\n\nexport type CameraType = 'front' | 'back';\n\nexport type FlashMode = 'off' | 'on' | 'auto';\n\nexport type ImageType = 'png' | 'jpg';\n\nexport type CameraMode = 'picture' | 'video';\n\nexport type CameraRatio = '4:3' | '16:9' | '1:1';\n\n/**\n * This option specifies the mode of focus on the device.\n * - `on` - Indicates that the device should autofocus once and then lock the focus.\n * - `off` - Indicates that the device should automatically focus when needed.\n * @default off\n */\nexport type FocusMode = 'on' | 'off';\n\n/**\n * This option specifies what codec to use when recording a video.\n * @platform ios\n */\nexport type VideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';\n\n/**\n * This option specifies the stabilization mode to use when recording a video.\n * @platform ios\n */\nexport type VideoStabilization = 'off' | 'standard' | 'cinematic' | 'auto';\n\n// @docsMissing\nexport type VideoQuality = '2160p' | '1080p' | '720p' | '480p' | '4:3';\n\nexport type CameraOrientation =\n | 'portrait'\n | 'portraitUpsideDown'\n | 'landscapeLeft'\n | 'landscapeRight';\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 compression quality from `0` to `1`. `0` means compress for small size, and `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?: Record<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 * When set to `true`, the output image will be flipped along the vertical axis when using the front camera.\n * @default false\n * @platform ios\n * @platform android\n * @deprecated Use `mirror` prop on `CameraView` instead.\n */\n mirror?: boolean;\n /**\n * @hidden\n */\n id?: number;\n /**\n * @hidden\n */\n fastMode?: boolean;\n /**\n * @hidden\n */\n maxDownsampling?: number;\n /**\n * To programmatically disable the camera shutter sound\n * @default true\n */\n shutterSound?: boolean;\n};\n\n// @needsAudit\nexport type CameraRecordingOptions = {\n /**\n * Maximum video duration in seconds.\n */\n maxDuration?: number;\n /**\n * Maximum video file size in bytes.\n */\n maxFileSize?: number;\n /**\n * 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 * @deprecated Use `mirror` prop on `CameraView` instead.\n */\n mirror?: boolean;\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 parsed information encoded in the barcode.\n */\n data: string;\n /**\n * The raw information encoded in the barcode.\n * May be different from `data` depending on the barcode type.\n * @platform android\n * @hidden\n */\n raw?: 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 ScanningResult = Omit<BarcodeScanningResult, 'bounds'>;\n\n// @needsAudit\nexport type CameraProps = ViewProps & {\n /**\n * Camera facing. Use one of `CameraType`. When `front`, use the front-facing camera.\n * When `back`, use the back-facing camera.\n * @default 'back'\n */\n facing?: CameraType;\n /**\n * Camera flash mode. Use one of `FlashMode` values. When `on`, the flash on your device will\n * turn on when taking a picture. When `off`, it won't. Setting it to `auto` will fire flash if required.\n * @default 'off'\n */\n flash?: FlashMode;\n /**\n * A value between `0` and `1` being a percentage of device's max zoom, where `0` means not zoomed and `1` means maximum zoom.\n * @default 0\n */\n zoom?: number;\n /**\n * Used to select image or video output.\n * @default 'picture'\n */\n mode?: CameraMode;\n /**\n * If present, video will be recorded with no sound.\n * @default false\n */\n mute?: boolean;\n /**\n * A boolean that determines whether the camera should mirror the image when using the front camera.\n * @default false\n */\n mirror?: boolean;\n /**\n * Indicates the focus mode to use.\n * @default off\n * @platform ios\n */\n autofocus?: FocusMode;\n /**\n * A boolean that determines whether the camera should be active.\n * Useful in situations where the camera may not have unmounted but you still want to stop the camera session.\n * @default true\n * @platform ios\n */\n active?: boolean;\n /**\n * Specify the quality of the recorded video. Use one of `VideoQuality` possible values:\n * 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 videoQuality?: VideoQuality;\n /**\n * A boolean that determines whether the camera shutter animation should be enabled.\n * @default true\n */\n animateShutter?: boolean;\n /**\n * A string representing the size of pictures [`takePictureAsync`](#takepictureasyncoptions) will take.\n * Available sizes can be fetched with [`getAvailablePictureSizesAsync`](#getavailablepicturesizesasync).\n * Setting this prop will cause the `ratio` prop to be ignored as the aspect ratio is determined by the selected size.\n */\n pictureSize?: string;\n /**\n * A boolean to enable or disable the torch.\n * @default false\n */\n enableTorch?: boolean;\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 * @example\n * ```tsx\n * <CameraView\n * barcodeScannerSettings={{\n * barcodeTypes: [\"qr\"],\n * }}\n * />\n * ```\n */\n barcodeScannerSettings?: BarcodeSettings;\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 (that is, 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 * A string representing the aspect ratio of the preview. For example, `4:3` and `16:9`.\n * Note: Setting the aspect ratio here will change the scaleType of the camera preview from `FILL` to `FIT`.\n * Also, when using 1:1, devices only support certain sizes. If you specify an unsupported size, the closest supported ratio will be used.\n * @platform android\n */\n ratio?: CameraRatio;\n /**\n * Callback invoked when camera preview has been set.\n */\n onCameraReady?: () => void;\n /**\n * Callback invoked when camera preview could not start.\n * @param event Error object that contains a `message`.\n */\n onMountError?: (event: CameraMountError) => void;\n /**\n * Callback that is invoked when a barcode has been successfully scanned. The callback is provided with\n * an object of the [`BarcodeScanningResult`](#barcodescanningresult) shape, where the `type`\n * refers to the barcode type that was scanned, and the `data` is the information encoded in the barcode\n * (in this case of QR codes, this is often a URL). See [`BarcodeType`](#barcodetype) for supported values.\n * @param scanningResult\n */\n onBarcodeScanned?: (scanningResult: BarcodeScanningResult) => void;\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 interface CameraViewRef {\n readonly takePicture: (options: CameraPictureOptions) => Promise<CameraCapturedPicture>;\n readonly getAvailablePictureSizes: () => Promise<string[]>;\n readonly record: (options?: CameraRecordingOptions) => Promise<{ uri: string }>;\n readonly stopRecording: () => Promise<void>;\n readonly launchModernScanner: () => Promise<void>;\n readonly resumePreview: () => Promise<void>;\n readonly pausePreview: () => Promise<void>;\n}\n\n/**\n * @hidden\n */\nexport type CameraNativeProps = {\n pointerEvents?: any;\n style?: any;\n ref?: Ref<CameraViewRef>;\n onCameraReady?: CameraReadyListener;\n onMountError?: MountErrorListener;\n onBarcodeScanned?: (event: { nativeEvent: BarcodeScanningResult }) => void;\n onPictureSaved?: PictureSavedListener;\n onResponsiveOrientationChanged?: ResponsiveOrientationChangedListener;\n facing?: string;\n flashMode?: string;\n enableTorch?: boolean;\n animateShutter?: boolean;\n autoFocus?: FocusMode;\n mute?: boolean;\n zoom?: number;\n ratio?: CameraRatio;\n barcodeScannerSettings?: BarcodeSettings;\n barcodeScannerEnabled?: boolean;\n poster?: string;\n responsiveOrientationWhenOrientationLocked?: boolean;\n};\n\n// @docsMissing\nexport type BarcodeSettings = {\n barcodeTypes: BarcodeType[];\n};\n\n/**\n * @platform ios\n */\nexport type ScanningOptions = {\n /**\n * The type of codes to scan for.\n */\n barcodeTypes: BarcodeType[];\n /**\n * Indicates whether people can use a two-finger pinch-to-zoom gesture.\n * @default true\n */\n isPinchToZoomEnabled?: boolean;\n /**\n * Guidance text, such as “Slow Down,” appears over the live video.\n * @default true\n */\n isGuidanceEnabled?: boolean;\n /**\n * Indicates whether the scanner displays highlights around recognized items.\n * @default false\n */\n isHighlightingEnabled?: boolean;\n};\n\n/**\n * The available barcode types that can be scanned.\n */\nexport type BarcodeType =\n | 'aztec'\n | 'ean13'\n | 'ean8'\n | 'qr'\n | 'pdf417'\n | 'upc_e'\n | 'datamatrix'\n | 'code39'\n | 'code93'\n | 'itf14'\n | 'codabar'\n | 'code128'\n | 'upc_a';\n\nexport {\n PermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n EventSubscription as Subscription,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Camera.types.js","sourceRoot":"","sources":["../src/Camera.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,GAIjB,MAAM,mBAAmB,CAAC;AAggB3B,OAAO,EAEL,gBAAgB,GAIjB,CAAC","sourcesContent":["import {\n PermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n EventSubscription,\n} from 'expo-modules-core';\nimport type { Ref } from 'react';\nimport type { ViewProps } from 'react-native';\n\nexport type CameraType = 'front' | 'back';\n\nexport type FlashMode = 'off' | 'on' | 'auto';\n\nexport type ImageType = 'png' | 'jpg';\n\nexport type CameraMode = 'picture' | 'video';\n\nexport type CameraRatio = '4:3' | '16:9' | '1:1';\n\n/**\n * This option specifies the mode of focus on the device.\n * - `on` - Indicates that the device should autofocus once and then lock the focus.\n * - `off` - Indicates that the device should automatically focus when needed.\n * @default off\n */\nexport type FocusMode = 'on' | 'off';\n\n/**\n * This option specifies what codec to use when recording a video.\n * @platform ios\n */\nexport type VideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';\n\n/**\n * This option specifies the stabilization mode to use when recording a video.\n * @platform ios\n */\nexport type VideoStabilization = 'off' | 'standard' | 'cinematic' | 'auto';\n\n// @docsMissing\nexport type VideoQuality = '2160p' | '1080p' | '720p' | '480p' | '4:3';\n\nexport type CameraOrientation =\n | 'portrait'\n | 'portraitUpsideDown'\n | 'landscapeLeft'\n | 'landscapeRight';\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 compression quality from `0` to `1`. `0` means compress for small size, and `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?: Record<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 * When set to `true`, the output image will be flipped along the vertical axis when using the front camera.\n * @default false\n * @platform ios\n * @platform android\n * @deprecated Use `mirror` prop on `CameraView` instead.\n */\n mirror?: boolean;\n /**\n * @hidden\n */\n id?: number;\n /**\n * @hidden\n */\n fastMode?: boolean;\n /**\n * @hidden\n */\n maxDownsampling?: number;\n /**\n * To programmatically disable the camera shutter sound\n * @default true\n */\n shutterSound?: boolean;\n};\n\n// @needsAudit\nexport type CameraRecordingOptions = {\n /**\n * Maximum video duration in seconds.\n */\n maxDuration?: number;\n /**\n * Maximum video file size in bytes.\n */\n maxFileSize?: number;\n /**\n * 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 * @deprecated Use `mirror` prop on `CameraView` instead.\n */\n mirror?: boolean;\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 parsed information encoded in the barcode.\n */\n data: string;\n /**\n * The raw information encoded in the barcode.\n * May be different from `data` depending on the barcode type.\n * @platform android\n * @hidden\n */\n raw?: 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 ScanningResult = Omit<BarcodeScanningResult, 'bounds'>;\n\n// @needsAudit\nexport type CameraViewProps = ViewProps & {\n /**\n * Camera facing. Use one of `CameraType`. When `front`, use the front-facing camera.\n * When `back`, use the back-facing camera.\n * @default 'back'\n */\n facing?: CameraType;\n /**\n * Camera flash mode. Use one of `FlashMode` values. When `on`, the flash on your device will\n * turn on when taking a picture. When `off`, it won't. Setting it to `auto` will fire flash if required.\n * @default 'off'\n */\n flash?: FlashMode;\n /**\n * A value between `0` and `1` being a percentage of device's max zoom, where `0` means not zoomed and `1` means maximum zoom.\n * @default 0\n */\n zoom?: number;\n /**\n * Used to select image or video output.\n * @default 'picture'\n */\n mode?: CameraMode;\n /**\n * If present, video will be recorded with no sound.\n * @default false\n */\n mute?: boolean;\n /**\n * A boolean that determines whether the camera should mirror the image when using the front camera.\n * @default false\n */\n mirror?: boolean;\n /**\n * Indicates the focus mode to use.\n * @default off\n * @platform ios\n */\n autofocus?: FocusMode;\n /**\n * A boolean that determines whether the camera should be active.\n * Useful in situations where the camera may not have unmounted but you still want to stop the camera session.\n * @default true\n * @platform ios\n */\n active?: boolean;\n /**\n * Specify the quality of the recorded video. Use one of `VideoQuality` possible values:\n * 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 videoQuality?: VideoQuality;\n /**\n * A boolean that determines whether the camera shutter animation should be enabled.\n * @default true\n */\n animateShutter?: boolean;\n /**\n * A string representing the size of pictures [`takePictureAsync`](#takepictureasyncoptions) will take.\n * Available sizes can be fetched with [`getAvailablePictureSizesAsync`](#getavailablepicturesizesasync).\n * Setting this prop will cause the `ratio` prop to be ignored as the aspect ratio is determined by the selected size.\n */\n pictureSize?: string;\n /**\n * A boolean to enable or disable the torch.\n * @default false\n */\n enableTorch?: boolean;\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 * @example\n * ```tsx\n * <CameraView\n * barcodeScannerSettings={{\n * barcodeTypes: [\"qr\"],\n * }}\n * />\n * ```\n */\n barcodeScannerSettings?: BarcodeSettings;\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 (that is, 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 * A string representing the aspect ratio of the preview. For example, `4:3` and `16:9`.\n * Note: Setting the aspect ratio here will change the scaleType of the camera preview from `FILL` to `FIT`.\n * Also, when using 1:1, devices only support certain sizes. If you specify an unsupported size, the closest supported ratio will be used.\n * @platform android\n */\n ratio?: CameraRatio;\n /**\n * Callback invoked when camera preview has been set.\n */\n onCameraReady?: () => void;\n /**\n * Callback invoked when camera preview could not start.\n * @param event Error object that contains a `message`.\n */\n onMountError?: (event: CameraMountError) => void;\n /**\n * Callback that is invoked when a barcode has been successfully scanned. The callback is provided with\n * an object of the [`BarcodeScanningResult`](#barcodescanningresult) shape, where the `type`\n * refers to the barcode type that was scanned, and the `data` is the information encoded in the barcode\n * (in this case of QR codes, this is often a URL). See [`BarcodeType`](#barcodetype) for supported values.\n * @param scanningResult\n */\n onBarcodeScanned?: (scanningResult: BarcodeScanningResult) => void;\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 interface CameraViewRef {\n readonly takePicture: (options: CameraPictureOptions) => Promise<CameraCapturedPicture>;\n readonly getAvailablePictureSizes: () => Promise<string[]>;\n readonly record: (options?: CameraRecordingOptions) => Promise<{ uri: string }>;\n readonly stopRecording: () => Promise<void>;\n readonly launchModernScanner: () => Promise<void>;\n readonly resumePreview: () => Promise<void>;\n readonly pausePreview: () => Promise<void>;\n}\n\n/**\n * @hidden\n */\nexport type CameraNativeProps = {\n pointerEvents?: any;\n style?: any;\n ref?: Ref<CameraViewRef>;\n onCameraReady?: CameraReadyListener;\n onMountError?: MountErrorListener;\n onBarcodeScanned?: (event: { nativeEvent: BarcodeScanningResult }) => void;\n onPictureSaved?: PictureSavedListener;\n onResponsiveOrientationChanged?: ResponsiveOrientationChangedListener;\n facing?: string;\n flashMode?: string;\n enableTorch?: boolean;\n animateShutter?: boolean;\n autoFocus?: FocusMode;\n mute?: boolean;\n zoom?: number;\n ratio?: CameraRatio;\n barcodeScannerSettings?: BarcodeSettings;\n barcodeScannerEnabled?: boolean;\n poster?: string;\n responsiveOrientationWhenOrientationLocked?: boolean;\n};\n\n// @docsMissing\nexport type BarcodeSettings = {\n barcodeTypes: BarcodeType[];\n};\n\n/**\n * @platform ios\n */\nexport type ScanningOptions = {\n /**\n * The type of codes to scan for.\n */\n barcodeTypes: BarcodeType[];\n /**\n * Indicates whether people can use a two-finger pinch-to-zoom gesture.\n * @default true\n */\n isPinchToZoomEnabled?: boolean;\n /**\n * Guidance text, such as “Slow Down,” appears over the live video.\n * @default true\n */\n isGuidanceEnabled?: boolean;\n /**\n * Indicates whether the scanner displays highlights around recognized items.\n * @default false\n */\n isHighlightingEnabled?: boolean;\n};\n\n/**\n * The available barcode types that can be scanned.\n */\nexport type BarcodeType =\n | 'aztec'\n | 'ean13'\n | 'ean8'\n | 'qr'\n | 'pdf417'\n | 'upc_e'\n | 'datamatrix'\n | 'code39'\n | 'code93'\n | 'itf14'\n | 'codabar'\n | 'code128'\n | 'upc_a';\n\nexport {\n PermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n EventSubscription as Subscription,\n};\n"]}
|
package/build/CameraView.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type EventSubscription } from 'expo-modules-core';
|
|
2
2
|
import { type Ref, Component } from 'react';
|
|
3
|
-
import { CameraCapturedPicture, CameraOrientation, CameraPictureOptions,
|
|
4
|
-
export default class CameraView extends Component<
|
|
3
|
+
import { CameraCapturedPicture, CameraOrientation, CameraPictureOptions, CameraViewProps, CameraRecordingOptions, CameraViewRef, ScanningOptions, ScanningResult, VideoCodec } from './Camera.types';
|
|
4
|
+
export default class CameraView extends Component<CameraViewProps> {
|
|
5
5
|
/**
|
|
6
6
|
* Property that determines if the current device has the ability to use `DataScannerViewController` (iOS 16+).
|
|
7
7
|
*/
|
|
@@ -37,7 +37,7 @@ export default class CameraView extends Component<CameraProps> {
|
|
|
37
37
|
type: Record<number | typeof Symbol.iterator | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | "codePointAt" | "includes" | "endsWith" | "normalize" | "repeat" | "startsWith" | "anchor" | "big" | "blink" | "bold" | "fixed" | "fontcolor" | "fontsize" | "italics" | "link" | "small" | "strike" | "sub" | "sup" | "padStart" | "padEnd" | "trimEnd" | "trimStart" | "trimLeft" | "trimRight" | "matchAll" | "replaceAll" | "at", string | undefined>;
|
|
38
38
|
flash: Record<number | typeof Symbol.iterator | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | "codePointAt" | "includes" | "endsWith" | "normalize" | "repeat" | "startsWith" | "anchor" | "big" | "blink" | "bold" | "fixed" | "fontcolor" | "fontsize" | "italics" | "link" | "small" | "strike" | "sub" | "sup" | "padStart" | "padEnd" | "trimEnd" | "trimStart" | "trimLeft" | "trimRight" | "matchAll" | "replaceAll" | "at", string | undefined>;
|
|
39
39
|
};
|
|
40
|
-
static defaultProps:
|
|
40
|
+
static defaultProps: CameraViewProps;
|
|
41
41
|
_cameraHandle?: number | null;
|
|
42
42
|
_cameraRef: import("react").RefObject<CameraViewRef>;
|
|
43
43
|
_lastEvents: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraView.d.ts","sourceRoot":"","sources":["../src/CameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,KAAK,GAAG,EAAE,SAAS,EAAa,MAAM,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CAAC,CAAC;IAEF,MAAM;QACJ,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB;YAClD,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACrD,CAAC,CAAC,SAAS,CAAC;QAEd,OAAO,CACL,CAAC,UAAU,CACT,IAAI,WAAW,CAAC,CAChB,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CACrB,aAAa,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CACnC,YAAY,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CACjC,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,cAAc,CAAC,CAAC,eAAe,CAAC,CAChC,8BAA8B,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,EACrE,CACH,CAAC;IACJ,CAAC","sourcesContent":["import { Platform, UnavailabilityError, type EventSubscription } from 'expo-modules-core';\nimport { type Ref, Component, createRef } from 'react';\n\nimport {\n CameraCapturedPicture,\n CameraOrientation,\n CameraPictureOptions,\n CameraProps,\n CameraRecordingOptions,\n CameraViewRef,\n ScanningOptions,\n ScanningResult,\n VideoCodec,\n} from './Camera.types';\nimport ExpoCamera from './ExpoCamera';\nimport CameraManager from './ExpoCameraManager';\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 if (!options || typeof options !== 'object') {\n return {};\n }\n\n if (options.quality === undefined) {\n options.quality = 1;\n }\n\n if (options.mirror) {\n console.warn(\n 'The `mirror` option is deprecated. Please use the `mirror` prop on the `CameraView` instead.'\n );\n }\n\n if (options.onPictureSaved) {\n const id = _GLOBAL_PICTURE_ID++;\n _PICTURE_SAVED_CALLBACKS[id] = options.onPictureSaved;\n options.id = id;\n options.fastMode = true;\n }\n\n return options;\n}\n\nfunction ensureRecordingOptions(options: CameraRecordingOptions = {}): CameraRecordingOptions {\n if (!options || typeof options !== 'object') {\n return {};\n }\n\n if (options.mirror) {\n console.warn(\n 'The `mirror` option is deprecated. Please use the `mirror` prop on the `CameraView` instead.'\n );\n }\n\n return options;\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 CameraView extends Component<CameraProps> {\n /**\n * Property that determines if the current device has the ability to use `DataScannerViewController` (iOS 16+).\n */\n static isModernBarcodeScannerAvailable: boolean = CameraManager.isModernBarcodeScannerAvailable;\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 // @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 /**\n * Get picture sizes that are supported by the device.\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(): Promise<string[]> {\n return (await this._cameraRef.current?.getAvailablePictureSizes()) ?? [];\n }\n\n /**\n * Resumes the camera preview.\n */\n async resumePreview(): Promise<void> {\n return this._cameraRef.current?.resumePreview();\n }\n\n /**\n * Pauses the camera preview. It is not recommended to use `takePictureAsync` when preview is paused.\n */\n async pausePreview(): Promise<void> {\n return this._cameraRef.current?.pausePreview();\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 facing: 'back',\n enableTorch: false,\n mode: 'picture',\n flash: 'off',\n };\n\n _cameraHandle?: number | null;\n _cameraRef = createRef<CameraViewRef>();\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.\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 Android,\n * iOS, 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.\n *\n * `base64` is included if the `base64` option was truthy, and is a string containing the JPEG data\n * of the image in Base64. Prepend it with `'data:image/jpg;base64,'` to get a data URI, which you can use as the source\n * for an `Image` element for example.\n *\n * `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/#filesystemcopyasyncoptions)\n * > to make a permanent copy of the image.\n *\n * > **Note:** Avoid calling this method while the preview is paused. On Android, this will throw an error. On iOS, this will take a picture of the last frame that is currently on screen.\n */\n async takePictureAsync(options?: CameraPictureOptions) {\n const pictureOptions = ensurePictureOptions(options);\n\n return this._cameraRef.current?.takePicture(pictureOptions);\n }\n\n /**\n * Presents a modal view controller that uses the [`DataScannerViewController`](https://developer.apple.com/documentation/visionkit/scanning_data_with_the_camera) available on iOS 16+.\n * @platform ios\n */\n static async launchScanner(options?: ScanningOptions): Promise<void> {\n if (!options) {\n options = { barcodeTypes: [] };\n }\n if (Platform.OS === 'ios' && CameraView.isModernBarcodeScannerAvailable) {\n await CameraManager.launchScanner(options);\n }\n }\n\n /**\n * Dismiss the scanner presented by `launchScanner`.\n * @platform ios\n */\n static async dismissScanner(): Promise<void> {\n if (Platform.OS === 'ios' && CameraView.isModernBarcodeScannerAvailable) {\n await CameraManager.dismissScanner();\n }\n }\n\n /**\n * Invokes the `listener` function when a bar code has been successfully scanned. The callback is provided with\n * an object of the `ScanningResult` shape, where the `type` 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 [`BarcodeType`](#barcodetype) for supported values.\n * @param listener Invoked with the [ScanningResult](#scanningresult) when a bar code has been successfully scanned.\n *\n * @platform ios\n */\n static onModernBarcodeScanned(listener: (event: ScanningResult) => void): EventSubscription {\n return CameraManager.addListener('onModernBarcodeScanned', listener);\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) {\n const recordingOptions = ensureRecordingOptions(options);\n return this._cameraRef.current?.record(recordingOptions);\n }\n\n /**\n * Stops recording if any is in progress.\n */\n stopRecording() {\n this._cameraRef.current?.stopRecording();\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: Ref<CameraViewRef>) => {\n if (ref) {\n // TODO(Bacon): Unify these - perhaps with hooks?\n if (Platform.OS === 'web') {\n this._cameraHandle = ref as any;\n }\n }\n };\n\n render() {\n const nativeProps = ensureNativeProps(this.props);\n const onBarcodeScanned = this.props.onBarcodeScanned\n ? this._onObjectDetected(this.props.onBarcodeScanned)\n : undefined;\n\n return (\n <ExpoCamera\n {...nativeProps}\n ref={this._cameraRef}\n onCameraReady={this._onCameraReady}\n onMountError={this._onMountError}\n onBarcodeScanned={onBarcodeScanned}\n onPictureSaved={_onPictureSaved}\n onResponsiveOrientationChanged={this._onResponsiveOrientationChanged}\n />\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CameraView.js","sourceRoot":"","sources":["../src/CameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAA0B,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAY,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAavD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,eA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;IAEJ,aAAa,GAAG,CAAC,GAAuB,EAAE,EAAE;QAC1C,IAAI,GAAG,EAAE;YACP,iDAAiD;YACjD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;gBACzB,IAAI,CAAC,aAAa,GAAG,GAAU,CAAC;aACjC;SACF;IACH,CAAC,CAAC;IAEF,MAAM;QACJ,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB;YAClD,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACrD,CAAC,CAAC,SAAS,CAAC;QAEd,OAAO,CACL,CAAC,UAAU,CACT,IAAI,WAAW,CAAC,CAChB,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CACrB,aAAa,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CACnC,YAAY,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CACjC,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,cAAc,CAAC,CAAC,eAAe,CAAC,CAChC,8BAA8B,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,EACrE,CACH,CAAC;IACJ,CAAC","sourcesContent":["import { Platform, UnavailabilityError, type EventSubscription } from 'expo-modules-core';\nimport { type Ref, Component, createRef } from 'react';\n\nimport {\n CameraCapturedPicture,\n CameraOrientation,\n CameraPictureOptions,\n CameraViewProps,\n CameraRecordingOptions,\n CameraViewRef,\n ScanningOptions,\n ScanningResult,\n VideoCodec,\n} from './Camera.types';\nimport ExpoCamera from './ExpoCamera';\nimport CameraManager from './ExpoCameraManager';\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 if (!options || typeof options !== 'object') {\n return {};\n }\n\n if (options.quality === undefined) {\n options.quality = 1;\n }\n\n if (options.mirror) {\n console.warn(\n 'The `mirror` option is deprecated. Please use the `mirror` prop on the `CameraView` instead.'\n );\n }\n\n if (options.onPictureSaved) {\n const id = _GLOBAL_PICTURE_ID++;\n _PICTURE_SAVED_CALLBACKS[id] = options.onPictureSaved;\n options.id = id;\n options.fastMode = true;\n }\n\n return options;\n}\n\nfunction ensureRecordingOptions(options: CameraRecordingOptions = {}): CameraRecordingOptions {\n if (!options || typeof options !== 'object') {\n return {};\n }\n\n if (options.mirror) {\n console.warn(\n 'The `mirror` option is deprecated. Please use the `mirror` prop on the `CameraView` instead.'\n );\n }\n\n return options;\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 CameraView extends Component<CameraViewProps> {\n /**\n * Property that determines if the current device has the ability to use `DataScannerViewController` (iOS 16+).\n */\n static isModernBarcodeScannerAvailable: boolean = CameraManager.isModernBarcodeScannerAvailable;\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 // @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 /**\n * Get picture sizes that are supported by the device.\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(): Promise<string[]> {\n return (await this._cameraRef.current?.getAvailablePictureSizes()) ?? [];\n }\n\n /**\n * Resumes the camera preview.\n */\n async resumePreview(): Promise<void> {\n return this._cameraRef.current?.resumePreview();\n }\n\n /**\n * Pauses the camera preview. It is not recommended to use `takePictureAsync` when preview is paused.\n */\n async pausePreview(): Promise<void> {\n return this._cameraRef.current?.pausePreview();\n }\n\n // Values under keys from this object will be transformed to native options\n static ConversionTables = ConversionTables;\n\n static defaultProps: CameraViewProps = {\n zoom: 0,\n facing: 'back',\n enableTorch: false,\n mode: 'picture',\n flash: 'off',\n };\n\n _cameraHandle?: number | null;\n _cameraRef = createRef<CameraViewRef>();\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.\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 Android,\n * iOS, 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.\n *\n * `base64` is included if the `base64` option was truthy, and is a string containing the JPEG data\n * of the image in Base64. Prepend it with `'data:image/jpg;base64,'` to get a data URI, which you can use as the source\n * for an `Image` element for example.\n *\n * `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/#filesystemcopyasyncoptions)\n * > to make a permanent copy of the image.\n *\n * > **Note:** Avoid calling this method while the preview is paused. On Android, this will throw an error. On iOS, this will take a picture of the last frame that is currently on screen.\n */\n async takePictureAsync(options?: CameraPictureOptions) {\n const pictureOptions = ensurePictureOptions(options);\n\n return this._cameraRef.current?.takePicture(pictureOptions);\n }\n\n /**\n * Presents a modal view controller that uses the [`DataScannerViewController`](https://developer.apple.com/documentation/visionkit/scanning_data_with_the_camera) available on iOS 16+.\n * @platform ios\n */\n static async launchScanner(options?: ScanningOptions): Promise<void> {\n if (!options) {\n options = { barcodeTypes: [] };\n }\n if (Platform.OS === 'ios' && CameraView.isModernBarcodeScannerAvailable) {\n await CameraManager.launchScanner(options);\n }\n }\n\n /**\n * Dismiss the scanner presented by `launchScanner`.\n * @platform ios\n */\n static async dismissScanner(): Promise<void> {\n if (Platform.OS === 'ios' && CameraView.isModernBarcodeScannerAvailable) {\n await CameraManager.dismissScanner();\n }\n }\n\n /**\n * Invokes the `listener` function when a bar code has been successfully scanned. The callback is provided with\n * an object of the `ScanningResult` shape, where the `type` 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 [`BarcodeType`](#barcodetype) for supported values.\n * @param listener Invoked with the [ScanningResult](#scanningresult) when a bar code has been successfully scanned.\n *\n * @platform ios\n */\n static onModernBarcodeScanned(listener: (event: ScanningResult) => void): EventSubscription {\n return CameraManager.addListener('onModernBarcodeScanned', listener);\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) {\n const recordingOptions = ensureRecordingOptions(options);\n return this._cameraRef.current?.record(recordingOptions);\n }\n\n /**\n * Stops recording if any is in progress.\n */\n stopRecording() {\n this._cameraRef.current?.stopRecording();\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: Ref<CameraViewRef>) => {\n if (ref) {\n // TODO(Bacon): Unify these - perhaps with hooks?\n if (Platform.OS === 'web') {\n this._cameraHandle = ref as any;\n }\n }\n };\n\n render() {\n const nativeProps = ensureNativeProps(this.props);\n const onBarcodeScanned = this.props.onBarcodeScanned\n ? this._onObjectDetected(this.props.onBarcodeScanned)\n : undefined;\n\n return (\n <ExpoCamera\n {...nativeProps}\n ref={this._cameraRef}\n onCameraReady={this._onCameraReady}\n onMountError={this._onMountError}\n onBarcodeScanned={onBarcodeScanned}\n onPictureSaved={_onPictureSaved}\n onResponsiveOrientationChanged={this._onResponsiveOrientationChanged}\n />\n );\n }\n}\n"]}
|
package/build/utils/props.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CameraNativeProps, CameraType, FlashMode,
|
|
1
|
+
import { CameraNativeProps, CameraType, FlashMode, CameraViewProps } from '../Camera.types';
|
|
2
2
|
export declare const ConversionTables: {
|
|
3
3
|
type: Record<keyof CameraType, CameraNativeProps['facing']>;
|
|
4
4
|
flash: Record<keyof FlashMode, CameraNativeProps['flashMode']>;
|
|
5
5
|
};
|
|
6
|
-
export declare function convertNativeProps(props?:
|
|
7
|
-
export declare function ensureNativeProps(props?:
|
|
6
|
+
export declare function convertNativeProps(props?: CameraViewProps): CameraNativeProps;
|
|
7
|
+
export declare function ensureNativeProps(props?: CameraViewProps): CameraNativeProps;
|
|
8
8
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/utils/props.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/utils/props.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAI5F,eAAO,MAAM,gBAAgB,EAAE;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,UAAU,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5D,KAAK,EAAE,MAAM,CAAC,MAAM,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;CAIhE,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAgB7E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAa5E"}
|
package/build/utils/props.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../src/utils/props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,aAAa,MAAM,sBAAsB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,KAAK,IAAI,KAAK,CAAC;IAC3C,QAAQ,CAAC,IAAI,GAAG,KAAK,EAAE,IAAI,IAAI,KAAK,CAAC;IACrC,QAAQ,CAAC,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,KAAK,CAAC;IAE/C,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACzB,OAAO,QAAQ,CAAC,MAAM,CAAC;KACxB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\n\nimport { CameraNativeProps, CameraType, FlashMode, CameraViewProps } from '../Camera.types';\nimport CameraManager from '../ExpoCameraManager';\n\n// Values under keys from this object will be transformed to native options\nexport const ConversionTables: {\n type: Record<keyof CameraType, CameraNativeProps['facing']>;\n flash: Record<keyof FlashMode, CameraNativeProps['flashMode']>;\n} = {\n type: CameraManager.Type,\n flash: CameraManager.FlashMode,\n};\n\nexport function convertNativeProps(props?: CameraViewProps): CameraNativeProps {\n if (!props || typeof props !== 'object') {\n return {};\n }\n\n const nativeProps: CameraNativeProps = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (typeof value === 'string' && ConversionTables[key]) {\n nativeProps[key] = ConversionTables[key][value];\n } else {\n nativeProps[key] = value;\n }\n }\n\n return nativeProps;\n}\n\nexport function ensureNativeProps(props?: CameraViewProps): CameraNativeProps {\n const newProps = convertNativeProps(props);\n\n newProps.barcodeScannerEnabled = !!props?.onBarcodeScanned;\n newProps.flashMode = props?.flash ?? 'off';\n newProps.mute = props?.mute ?? false;\n newProps.autoFocus = props?.autofocus ?? 'off';\n\n if (Platform.OS !== 'web') {\n delete newProps.poster;\n }\n\n return newProps;\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import AVFoundation
|
|
|
3
3
|
|
|
4
4
|
let BARCODE_TYPES_KEY = "barcodeTypes"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
actor BarcodeScanner: NSObject, BarcodeScanningResponseHandler {
|
|
7
7
|
var onBarcodeScanned: (([String: Any]?) -> Void)?
|
|
8
8
|
var isScanningBarcodes = false
|
|
9
9
|
|
|
@@ -21,8 +21,8 @@ class BarcodeScanner: NSObject, AVCaptureMetadataOutputObjectsDelegate, AVCaptur
|
|
|
21
21
|
AVMetadataObject.ObjectType.code39: ZXCode39Reader()
|
|
22
22
|
]
|
|
23
23
|
private var previewLayer: AVCaptureVideoPreviewLayer?
|
|
24
|
-
private var zxingFPSProcessed = 6.0
|
|
25
24
|
private var zxingEnabled = true
|
|
25
|
+
private var delegate: MetatDataDelegate?
|
|
26
26
|
|
|
27
27
|
init(session: AVCaptureSession, sessionQueue: DispatchQueue) {
|
|
28
28
|
self.session = session
|
|
@@ -42,7 +42,7 @@ class BarcodeScanner: NSObject, AVCaptureMetadataOutputObjectsDelegate, AVCaptur
|
|
|
42
42
|
let zxingCoveredTypes = Set(zxingBarcodeReaders.keys)
|
|
43
43
|
zxingEnabled = !zxingCoveredTypes.isDisjoint(with: newTypes)
|
|
44
44
|
Task {
|
|
45
|
-
await
|
|
45
|
+
await maybeStartBarcodeScanning()
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -52,23 +52,21 @@ class BarcodeScanner: NSObject, AVCaptureMetadataOutputObjectsDelegate, AVCaptur
|
|
|
52
52
|
self.previewLayer = layer
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
func setIsEnabled(_ enabled: Bool) {
|
|
55
|
+
func setIsEnabled(_ enabled: Bool) async {
|
|
56
56
|
guard isScanningBarcodes != enabled else {
|
|
57
57
|
return
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
isScanningBarcodes = enabled
|
|
61
|
-
|
|
62
|
-
if
|
|
63
|
-
|
|
64
|
-
setConnection(enabled: true)
|
|
65
|
-
} else {
|
|
66
|
-
await maybeStartBarcodeScanning()
|
|
67
|
-
}
|
|
61
|
+
if isScanningBarcodes {
|
|
62
|
+
if metadataOutput != nil {
|
|
63
|
+
setConnection(enabled: true)
|
|
68
64
|
} else {
|
|
69
|
-
|
|
70
|
-
await stopBarcodeScanning()
|
|
65
|
+
await maybeStartBarcodeScanning()
|
|
71
66
|
}
|
|
67
|
+
} else {
|
|
68
|
+
setConnection(enabled: false)
|
|
69
|
+
await stopBarcodeScanning()
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
|
|
@@ -105,43 +103,20 @@ class BarcodeScanner: NSObject, AVCaptureMetadataOutputObjectsDelegate, AVCaptur
|
|
|
105
103
|
}
|
|
106
104
|
}
|
|
107
105
|
|
|
108
|
-
func scanBarcodes(from image: CGImage, completion: @escaping (ZXResult) -> Void) {
|
|
109
|
-
let source = ZXCGImageLuminanceSource(cgImage: image)
|
|
110
|
-
let binarizer = ZXHybridBinarizer(source: source)
|
|
111
|
-
let bitmap = ZXBinaryBitmap(binarizer: binarizer)
|
|
112
|
-
|
|
113
|
-
var result: ZXResult?
|
|
114
|
-
|
|
115
|
-
for reader in zxingBarcodeReaders.values {
|
|
116
|
-
result = try? reader.decode(bitmap, hints: nil)
|
|
117
|
-
if result != nil {
|
|
118
|
-
break
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if result == nil && bitmap?.rotateSupported == true {
|
|
123
|
-
if let rotatedBitmap = bitmap?.rotateCounterClockwise() {
|
|
124
|
-
for reader in zxingBarcodeReaders.values {
|
|
125
|
-
result = try? reader.decode(rotatedBitmap, hints: nil)
|
|
126
|
-
if result != nil {
|
|
127
|
-
break
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if let result {
|
|
134
|
-
completion(result)
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
106
|
private func addOutputs() async {
|
|
139
107
|
session.beginConfiguration()
|
|
140
108
|
defer { session.commitConfiguration() }
|
|
141
109
|
|
|
110
|
+
delegate = MetatDataDelegate(
|
|
111
|
+
settings: settings,
|
|
112
|
+
previewLayer: previewLayer,
|
|
113
|
+
zxingBarcodeReaders: zxingBarcodeReaders,
|
|
114
|
+
zxingEnabled: zxingEnabled,
|
|
115
|
+
metadataResultHandler: self)
|
|
116
|
+
|
|
142
117
|
if metadataOutput == nil {
|
|
143
118
|
let output = AVCaptureMetadataOutput()
|
|
144
|
-
output.setMetadataObjectsDelegate(
|
|
119
|
+
output.setMetadataObjectsDelegate(delegate, queue: sessionQueue)
|
|
145
120
|
if session.canAddOutput(output) {
|
|
146
121
|
session.addOutput(output)
|
|
147
122
|
metadataOutput = output
|
|
@@ -152,7 +127,7 @@ class BarcodeScanner: NSObject, AVCaptureMetadataOutputObjectsDelegate, AVCaptur
|
|
|
152
127
|
let output = AVCaptureVideoDataOutput()
|
|
153
128
|
output.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_32BGRA]
|
|
154
129
|
output.alwaysDiscardsLateVideoFrames = true
|
|
155
|
-
output.setSampleBufferDelegate(
|
|
130
|
+
output.setSampleBufferDelegate(delegate, queue: zxingCaptureQueue)
|
|
156
131
|
if session.canAddOutput(output) {
|
|
157
132
|
session.addOutput(output)
|
|
158
133
|
videoDataOutput = output
|
|
@@ -179,55 +154,7 @@ class BarcodeScanner: NSObject, AVCaptureMetadataOutputObjectsDelegate, AVCaptur
|
|
|
179
154
|
}
|
|
180
155
|
}
|
|
181
156
|
|
|
182
|
-
func
|
|
183
|
-
|
|
184
|
-
return
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
for metadata in metadataObjects {
|
|
188
|
-
var codeMetadata = metadata as? AVMetadataMachineReadableCodeObject
|
|
189
|
-
if let previewLayer {
|
|
190
|
-
codeMetadata = previewLayer.transformedMetadataObject(for: metadata) as? AVMetadataMachineReadableCodeObject
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
for barcodeType in settings {
|
|
194
|
-
if zxingBarcodeReaders[barcodeType] != nil {
|
|
195
|
-
continue
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if let codeMetadata {
|
|
199
|
-
if codeMetadata.stringValue != nil && codeMetadata.type == barcodeType {
|
|
200
|
-
onBarcodeScanned?(BarcodeScannerUtils.avMetadataCodeObjectToDictionary(codeMetadata))
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
|
|
208
|
-
guard let barcodeTypes = settings[BARCODE_TYPES_KEY],
|
|
209
|
-
let metadataOutput,
|
|
210
|
-
zxingEnabled else {
|
|
211
|
-
return
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
let kMinMargin = 1.0 / zxingFPSProcessed
|
|
215
|
-
let presentTimeStamp = CMSampleBufferGetPresentationTimeStamp(sampleBuffer)
|
|
216
|
-
|
|
217
|
-
var curFrameTimeStamp = 0.0
|
|
218
|
-
var lastFrameTimeStamp = 0.0
|
|
219
|
-
|
|
220
|
-
curFrameTimeStamp = Double(presentTimeStamp.value) / Double(presentTimeStamp.timescale)
|
|
221
|
-
|
|
222
|
-
if curFrameTimeStamp - lastFrameTimeStamp > Double(kMinMargin) {
|
|
223
|
-
lastFrameTimeStamp = curFrameTimeStamp
|
|
224
|
-
|
|
225
|
-
if let videoFrame = CMSampleBufferGetImageBuffer(sampleBuffer),
|
|
226
|
-
let videoFrameImage = ZXCGImageLuminanceSource.createImage(from: videoFrame) {
|
|
227
|
-
self.scanBarcodes(from: videoFrameImage) { barcodeScannerResult in
|
|
228
|
-
self.onBarcodeScanned?(BarcodeScannerUtils.zxResultToDictionary(barcodeScannerResult))
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
157
|
+
func onScanningResult(_ result: [String: Any]) {
|
|
158
|
+
self.onBarcodeScanned?(result)
|
|
232
159
|
}
|
|
233
160
|
}
|
|
@@ -49,7 +49,9 @@ public class CameraView: ExpoView, EXAppLifecycleListener,
|
|
|
49
49
|
|
|
50
50
|
var isScanningBarcodes = false {
|
|
51
51
|
didSet {
|
|
52
|
-
|
|
52
|
+
Task {
|
|
53
|
+
await barcodeScanner.setIsEnabled(isScanningBarcodes)
|
|
54
|
+
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
|
|
@@ -145,7 +147,7 @@ public class CameraView: ExpoView, EXAppLifecycleListener,
|
|
|
145
147
|
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
|
|
146
148
|
NotificationCenter.default.addObserver(
|
|
147
149
|
self,
|
|
148
|
-
selector: #selector(orientationChanged
|
|
150
|
+
selector: #selector(orientationChanged),
|
|
149
151
|
name: UIDevice.orientationDidChangeNotification,
|
|
150
152
|
object: nil)
|
|
151
153
|
lifecycleManager?.register(self)
|
|
@@ -303,7 +305,9 @@ public class CameraView: ExpoView, EXAppLifecycleListener,
|
|
|
303
305
|
}
|
|
304
306
|
|
|
305
307
|
func setBarcodeScannerSettings(settings: BarcodeSettings) {
|
|
306
|
-
|
|
308
|
+
Task {
|
|
309
|
+
await barcodeScanner.setSettings([BARCODE_TYPES_KEY: settings.toMetadataObjectType()])
|
|
310
|
+
}
|
|
307
311
|
}
|
|
308
312
|
|
|
309
313
|
func updateResponsiveOrientation() {
|
|
@@ -592,12 +596,6 @@ public class CameraView: ExpoView, EXAppLifecycleListener,
|
|
|
592
596
|
}
|
|
593
597
|
}
|
|
594
598
|
|
|
595
|
-
public override func didMoveToWindow() {
|
|
596
|
-
if window == nil {
|
|
597
|
-
cleanupCamera()
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
|
|
601
599
|
func updateSessionAudioIsMuted() async {
|
|
602
600
|
session.beginConfiguration()
|
|
603
601
|
defer { session.commitConfiguration() }
|
|
@@ -655,12 +653,12 @@ public class CameraView: ExpoView, EXAppLifecycleListener,
|
|
|
655
653
|
self.layer.insertSublayer(previewLayer, at: 0)
|
|
656
654
|
}
|
|
657
655
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
lifecycleManager?.unregisterAppLifecycleListener(self)
|
|
656
|
+
public override func removeFromSuperview() {
|
|
657
|
+
super.removeFromSuperview()
|
|
661
658
|
Task {
|
|
662
659
|
await stopSession()
|
|
663
660
|
}
|
|
661
|
+
lifecycleManager?.unregisterAppLifecycleListener(self)
|
|
664
662
|
UIDevice.current.endGeneratingDeviceOrientationNotifications()
|
|
665
663
|
NotificationCenter.default.removeObserver(self, name: UIDevice.orientationDidChangeNotification, object: nil)
|
|
666
664
|
}
|
|
@@ -751,8 +749,6 @@ public class CameraView: ExpoView, EXAppLifecycleListener,
|
|
|
751
749
|
#if targetEnvironment(simulator)
|
|
752
750
|
return
|
|
753
751
|
#endif
|
|
754
|
-
// self.previewLayer.layer.removeFromSuperlayer()
|
|
755
|
-
|
|
756
752
|
session.beginConfiguration()
|
|
757
753
|
for input in self.session.inputs {
|
|
758
754
|
session.removeInput(input)
|
|
@@ -778,8 +774,10 @@ public class CameraView: ExpoView, EXAppLifecycleListener,
|
|
|
778
774
|
previewLayer.connection?.isEnabled = false
|
|
779
775
|
}
|
|
780
776
|
|
|
781
|
-
@objc func orientationChanged(
|
|
782
|
-
|
|
777
|
+
@objc func orientationChanged() {
|
|
778
|
+
Task {
|
|
779
|
+
await changePreviewOrientation()
|
|
780
|
+
}
|
|
783
781
|
}
|
|
784
782
|
|
|
785
783
|
@MainActor
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import ZXingObjC
|
|
2
|
+
|
|
3
|
+
protocol BarcodeScanningResponseHandler {
|
|
4
|
+
func onScanningResult(_ result: [String: Any]) async
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
class MetatDataDelegate: NSObject, AVCaptureMetadataOutputObjectsDelegate, AVCaptureVideoDataOutputSampleBufferDelegate {
|
|
8
|
+
private var settings: [String: [AVMetadataObject.ObjectType]]
|
|
9
|
+
private var previewLayer: AVCaptureVideoPreviewLayer?
|
|
10
|
+
private var zxingBarcodeReaders: [AVMetadataObject.ObjectType: ZXReader]
|
|
11
|
+
private var zxingEnabled = true
|
|
12
|
+
private var zxingFPSProcessed = 6.0
|
|
13
|
+
private let responseHandler: BarcodeScanningResponseHandler
|
|
14
|
+
|
|
15
|
+
init(
|
|
16
|
+
settings: [String: [AVMetadataObject.ObjectType]],
|
|
17
|
+
previewLayer: AVCaptureVideoPreviewLayer?,
|
|
18
|
+
zxingBarcodeReaders: [AVMetadataObject.ObjectType: ZXReader],
|
|
19
|
+
zxingEnabled: Bool,
|
|
20
|
+
metadataResultHandler: BarcodeScanningResponseHandler
|
|
21
|
+
) {
|
|
22
|
+
self.settings = settings
|
|
23
|
+
self.previewLayer = previewLayer
|
|
24
|
+
self.zxingEnabled = zxingEnabled
|
|
25
|
+
self.responseHandler = metadataResultHandler
|
|
26
|
+
self.zxingBarcodeReaders = zxingBarcodeReaders
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) {
|
|
30
|
+
guard let settings = settings[BARCODE_TYPES_KEY] else {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
for metadata in metadataObjects {
|
|
35
|
+
var codeMetadata = metadata as? AVMetadataMachineReadableCodeObject
|
|
36
|
+
if let previewLayer {
|
|
37
|
+
codeMetadata = previewLayer.transformedMetadataObject(for: metadata) as? AVMetadataMachineReadableCodeObject
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for barcodeType in settings {
|
|
41
|
+
if zxingBarcodeReaders[barcodeType] != nil {
|
|
42
|
+
continue
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if let codeMetadata {
|
|
46
|
+
if codeMetadata.stringValue != nil && codeMetadata.type == barcodeType {
|
|
47
|
+
Task {
|
|
48
|
+
await responseHandler.onScanningResult(BarcodeScannerUtils.avMetadataCodeObjectToDictionary(codeMetadata))
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
|
|
57
|
+
guard zxingEnabled else {
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let kMinMargin = 1.0 / zxingFPSProcessed
|
|
62
|
+
let presentTimeStamp = CMSampleBufferGetPresentationTimeStamp(sampleBuffer)
|
|
63
|
+
|
|
64
|
+
var curFrameTimeStamp = 0.0
|
|
65
|
+
var lastFrameTimeStamp = 0.0
|
|
66
|
+
|
|
67
|
+
curFrameTimeStamp = Double(presentTimeStamp.value) / Double(presentTimeStamp.timescale)
|
|
68
|
+
|
|
69
|
+
if curFrameTimeStamp - lastFrameTimeStamp > Double(kMinMargin) {
|
|
70
|
+
lastFrameTimeStamp = curFrameTimeStamp
|
|
71
|
+
|
|
72
|
+
if let videoFrame = CMSampleBufferGetImageBuffer(sampleBuffer),
|
|
73
|
+
let videoFrameImage = ZXCGImageLuminanceSource.createImage(from: videoFrame) {
|
|
74
|
+
self.scanBarcodes(from: videoFrameImage) { barcodeScannerResult in
|
|
75
|
+
Task {
|
|
76
|
+
await self.responseHandler.onScanningResult(BarcodeScannerUtils.zxResultToDictionary(barcodeScannerResult))
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
func scanBarcodes(from image: CGImage, completion: @escaping (ZXResult) -> Void) {
|
|
84
|
+
let source = ZXCGImageLuminanceSource(cgImage: image)
|
|
85
|
+
let binarizer = ZXHybridBinarizer(source: source)
|
|
86
|
+
let bitmap = ZXBinaryBitmap(binarizer: binarizer)
|
|
87
|
+
|
|
88
|
+
var result: ZXResult?
|
|
89
|
+
|
|
90
|
+
for reader in zxingBarcodeReaders.values {
|
|
91
|
+
result = try? reader.decode(bitmap, hints: nil)
|
|
92
|
+
if result != nil {
|
|
93
|
+
break
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if result == nil && bitmap?.rotateSupported == true {
|
|
98
|
+
if let rotatedBitmap = bitmap?.rotateCounterClockwise() {
|
|
99
|
+
for reader in zxingBarcodeReaders.values {
|
|
100
|
+
result = try? reader.decode(rotatedBitmap, hints: nil)
|
|
101
|
+
if result != nil {
|
|
102
|
+
break
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if let result {
|
|
109
|
+
completion(result)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-camera",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.2",
|
|
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",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"optional": true
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "5ad642a63afa9190ceb4e57dd52c8bdf71d93dd8"
|
|
54
54
|
}
|
package/src/Camera.types.ts
CHANGED
|
@@ -301,7 +301,7 @@ export type BarcodeScanningResult = {
|
|
|
301
301
|
export type ScanningResult = Omit<BarcodeScanningResult, 'bounds'>;
|
|
302
302
|
|
|
303
303
|
// @needsAudit
|
|
304
|
-
export type
|
|
304
|
+
export type CameraViewProps = ViewProps & {
|
|
305
305
|
/**
|
|
306
306
|
* Camera facing. Use one of `CameraType`. When `front`, use the front-facing camera.
|
|
307
307
|
* When `back`, use the back-facing camera.
|
package/src/CameraView.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
CameraCapturedPicture,
|
|
6
6
|
CameraOrientation,
|
|
7
7
|
CameraPictureOptions,
|
|
8
|
-
|
|
8
|
+
CameraViewProps,
|
|
9
9
|
CameraRecordingOptions,
|
|
10
10
|
CameraViewRef,
|
|
11
11
|
ScanningOptions,
|
|
@@ -74,7 +74,7 @@ function _onPictureSaved({
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export default class CameraView extends Component<
|
|
77
|
+
export default class CameraView extends Component<CameraViewProps> {
|
|
78
78
|
/**
|
|
79
79
|
* Property that determines if the current device has the ability to use `DataScannerViewController` (iOS 16+).
|
|
80
80
|
*/
|
|
@@ -133,7 +133,7 @@ export default class CameraView extends Component<CameraProps> {
|
|
|
133
133
|
// Values under keys from this object will be transformed to native options
|
|
134
134
|
static ConversionTables = ConversionTables;
|
|
135
135
|
|
|
136
|
-
static defaultProps:
|
|
136
|
+
static defaultProps: CameraViewProps = {
|
|
137
137
|
zoom: 0,
|
|
138
138
|
facing: 'back',
|
|
139
139
|
enableTorch: false,
|
package/src/utils/props.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Platform } from 'expo-modules-core';
|
|
2
2
|
|
|
3
|
-
import { CameraNativeProps, CameraType, FlashMode,
|
|
3
|
+
import { CameraNativeProps, CameraType, FlashMode, CameraViewProps } from '../Camera.types';
|
|
4
4
|
import CameraManager from '../ExpoCameraManager';
|
|
5
5
|
|
|
6
6
|
// Values under keys from this object will be transformed to native options
|
|
@@ -12,7 +12,7 @@ export const ConversionTables: {
|
|
|
12
12
|
flash: CameraManager.FlashMode,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export function convertNativeProps(props?:
|
|
15
|
+
export function convertNativeProps(props?: CameraViewProps): CameraNativeProps {
|
|
16
16
|
if (!props || typeof props !== 'object') {
|
|
17
17
|
return {};
|
|
18
18
|
}
|
|
@@ -30,7 +30,7 @@ export function convertNativeProps(props?: CameraProps): CameraNativeProps {
|
|
|
30
30
|
return nativeProps;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export function ensureNativeProps(props?:
|
|
33
|
+
export function ensureNativeProps(props?: CameraViewProps): CameraNativeProps {
|
|
34
34
|
const newProps = convertNativeProps(props);
|
|
35
35
|
|
|
36
36
|
newProps.barcodeScannerEnabled = !!props?.onBarcodeScanned;
|