Interface: CameraProps
Hierarchy
-
ViewProps
↳
CameraProps
Properties
audio
• Optional
audio: boolean
Enables audio capture for video recordings (see "Recording Videos")
Defined in
CameraProps.ts:60
codeScanner
• Optional
codeScanner: CodeScanner
A CodeScanner that can detect QR-Codes or Barcodes using platform-native APIs.
See the Code Scanner documentation for more information
Example
const codeScanner = useCodeScanner({
codeTypes: ['qr', 'ean-13'],
onCodeScanned: (codes) => {
console.log(`Scanned ${codes.length} codes!`)
}
})
return <Camera {...props} codeScanner={codeScanner} />
#### Defined in
CameraProps.ts:285
___
### device
• **device**: [`CameraDevice`](CameraDevice.md)
The Camera Device to use.
See the [Camera Devices](https://react-native-vision-camera.com/docs/guides/devices) section in the documentation for more information about Camera Devices.
**`Example`**
```tsx
const device = useCameraDevice('back')
if (device == null) return <NoCameraErrorView />
return (
<Camera
device={device}
isActive={true}
style={StyleSheet.absoluteFill}
/>
)
Defined in
CameraProps.ts:38
enableBufferCompression
• Optional
enableBufferCompression: boolean
Enables or disables lossless buffer compression for the video stream.
If you only use video
or a frameProcessor
, this
can increase the efficiency and lower memory usage of the Camera.
If buffer compression is enabled, the video pipeline will try to use a lossless-compressed pixel format instead of the normal one.
If you use a frameProcessor
, you might need to change how pixels
are read inside your native frame processor function as this is different
from the usual yuv
or rgb
layout.
If buffer compression is not available but this property is enabled, the normal pixel formats will be used and no error will be thrown.
Platform
iOS
Default
- true // if video={true} and frameProcessor={undefined}
- false // otherwise
Defined in
CameraProps.ts:187
enableDepthData
• Optional
enableDepthData: boolean
Enables or disables depth data delivery for photo capture.
Make sure the given format
supports depth data (see format.supportsDepthCapture
).
Default
false
Defined in
CameraProps.ts:209
enableFpsGraph
• Optional
enableFpsGraph: boolean
If true
, show a debug view to display the FPS of the Camera session.
This is useful for debugging your Frame Processor's speed.
Default
false
Defined in
CameraProps.ts:237
enableHighQualityPhotos
• Optional
enableHighQualityPhotos: boolean
Indicates whether the Camera should prepare the photo pipeline to provide maximum quality photos.
This enables:
- High Resolution Capture (
isHighResolutionCaptureEnabled
) - Virtual Device fusion for greater detail (
isVirtualDeviceConstituentPhotoDeliveryEnabled
) - Dual Device fusion for greater detail (
isDualCameraDualPhotoDeliveryEnabled
) - Sets the maximum quality prioritization to
.quality
(maxPhotoQualityPrioritization
)
Default
false
Defined in
CameraProps.ts:230
enablePortraitEffectsMatteDelivery
• Optional
enablePortraitEffectsMatteDelivery: boolean
A boolean specifying whether the photo render pipeline is prepared for portrait effects matte delivery.
When enabling this, you must also set enableDepthData
to true
.
Platform
iOS 12.0+
Default
false
Defined in
CameraProps.ts:218
enableZoomGesture
• Optional
enableZoomGesture: boolean
Enables or disables the native pinch to zoom gesture.
If you want to implement a custom zoom gesture, see the Zooming with Reanimated documentation.
Default
false
Defined in
CameraProps.ts:110
exposure
• Optional
exposure: number
Specifies the Exposure bias of the current camera. A lower value means darker images, a higher value means brighter images.
The Camera will still continue to auto-adjust exposure and focus, but will premultiply the exposure setting with the provided value here.
This values ranges from format.minExposure
to format.maxExposure
.
The value between min- and max supported exposure is considered the default, neutral value.
Defined in
CameraProps.ts:123
format
• Optional
format: CameraDeviceFormat
Selects a given format. By default, the best matching format is chosen. See CameraDeviceFormat
The format defines the possible values for properties like:
fps
:format.minFps
...format.maxFps
videoHdr
:format.supportsVideoHdr
photoHdr
:format.supportsPhotoHdr
pixelFormat
: `format.pixelFormats``- {@linkcode enableDepthData}: `format.supportsDepthCapture``
- {@linkcode videoStabilizationMode}: `format.videoStabilizationModes``
In other words; enableDepthData
can only be set to true if format.supportsDepthCapture
is true.
Defined in
CameraProps.ts:140
fps
• Optional
fps: number
Specify the frames per second this camera should stream frames at.
Make sure the given format
can stream at the target fps
value (see format.minFps
and format.maxFps
).
Defined in
CameraProps.ts:154
frameProcessor
• Optional
frameProcessor: FrameProcessor
A worklet which will be called for every frame the Camera "sees".
See the Frame Processors documentation for more information
Example
const frameProcessor = useFrameProcessor((frame) => {
'worklet'
const faces = scanFaces(frame)
console.log(`Faces: ${faces}`)
}, [])
return <Camera {...cameraProps} frameProcessor={frameProcessor} />
Defined in
CameraProps.ts:268
isActive
• isActive: boolean
Whether the Camera should actively stream video frames, or not. See the documentation about the isActive
prop for more information.
This can be compared to a Video component, where isActive
specifies whether the video is paused or not.
Note: If you fully unmount the
<Camera>
component instead of usingisActive={false}
, the Camera will take a bit longer to start again. In return, it will use less resources since the Camera will be completely destroyed when unmounted.
Defined in
CameraProps.ts:46
lowLightBoost
• Optional
lowLightBoost: boolean
Enables or disables low-light boost on this camera device.
Make sure the given device
supports low-light-boost (see device.supportsLowLightBoost
).
Defined in
CameraProps.ts:193
onError
• Optional
onError: (error
: CameraRuntimeError
) => void
Type declaration
▸ (error
): void
Called when any kind of runtime error occured.
Parameters
Name | Type |
---|---|
error | CameraRuntimeError |
Returns
void
Defined in
CameraProps.ts:247
onInitialized
• Optional
onInitialized: () => void
Type declaration
▸ (): void
Called when the camera was successfully initialized.
Returns
void
Defined in
CameraProps.ts:251