Skip to main content

CameraProps

Hierarchy​

  • ViewProps

    ↳ CameraProps

Properties​

audio​

• Optional audio: boolean

Enables audio capture for video recordings (see "Recording Videos")

Defined in​

CameraProps.ts:56


colorSpace​

• Optional colorSpace: ColorSpace

Specifies the color space to use for this camera device. Make sure the given format contains the given colorSpace.

Requires format to be set.

Defined in​

CameraProps.ts:122


device​

• device: CameraDevice

The Camera Device to use.

See the Camera Devices section in the documentation for more information about Camera Devices.

Example

const devices = useCameraDevices('wide-angle-camera')
const device = devices.back

return (
<Camera
device={device}
isActive={true}
style={StyleSheet.absoluteFill}
/>
)

Defined in​

CameraProps.ts:32


enableDepthData​

• Optional enableDepthData: boolean

Also captures data from depth-perception sensors. (e.g. disparity maps)

Default

false

Defined in​

CameraProps.ts:137


enableHighQualityPhotos​

• Optional enableHighQualityPhotos: boolean

Indicates whether the Camera should prepare the photo pipeline to provide maximum quality photos.

This enables:

Default

false

Defined in​

CameraProps.ts:158


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:146


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:87


format​

• Optional format: CameraDeviceFormat

Selects a given format. Must be undefined when preset is set!

Defined in​

CameraProps.ts:98


fps​

• Optional fps: number

Specify the frames per second this camera should use. Make sure the given format includes a frame rate range with the given fps.

Requires format to be set.

Defined in​

CameraProps.ts:104


frameProcessor​

• Optional frameProcessor: (frame: Frame) => void

Type declaration​

â–¸ (frame): void

A worklet which will be called for every frame the Camera "sees". Throttle the Frame Processor's frame rate with frameProcessorFps.

See the Frame Processors documentation for more information

Note: If you want to use video and frameProcessor simultaneously, make sure supportsParallelVideoProcessing is true.

Example

const frameProcessor = useFrameProcessor((frame) => {
'worklet'
const qrCodes = scanQRCodes(frame)
console.log(`Detected QR Codes: ${qrCodes}`)
}, [])

return <Camera {...cameraProps} frameProcessor={frameProcessor} />
Parameters​
NameType
frameFrame
Returns​

void

Defined in​

CameraProps.ts:195


frameProcessorFps​

• Optional frameProcessorFps: number | "auto"

Specifies the maximum frame rate the frame processor can use, independent of the Camera's frame rate (fps property).

  • A value of 'auto' (default) indicates that the frame processor should execute as fast as it can, without dropping frames. This is achieved by collecting historical data for previous frame processor calls and adjusting frame rate accordingly.
  • A value of 1 indicates that the frame processor gets executed once per second, perfect for code scanning.
  • A value of 10 indicates that the frame processor gets executed 10 times per second, perfect for more realtime use-cases.
  • A value of 25 indicates that the frame processor gets executed 25 times per second, perfect for high-speed realtime use-cases.
  • ...and so on

If you're using higher values, always check your Xcode/Android Studio Logs to make sure your frame processors are executing fast enough without blocking the video recording queue.

Default

'auto'

Defined in​

CameraProps.ts:210


hdr​

• Optional hdr: boolean

Enables or disables HDR on this camera device. Make sure the given format supports HDR mode.

Requires format to be set.

Defined in​

CameraProps.ts:110


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 using isActive={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:40


lowLightBoost​

• Optional lowLightBoost: boolean

Enables or disables low-light boost on this camera device. Make sure the given format supports low-light boost.

Requires format to be set.

Defined in​

CameraProps.ts:116


onError​

• Optional onError: (error: CameraRuntimeError) => void

Type declaration​

â–¸ (error): void

Called when any kind of runtime error occured.

Parameters​
NameType
errorCameraRuntimeError
Returns​

void

Defined in​

CameraProps.ts:168


onFrameProcessorPerformanceSuggestionAvailable​

• Optional onFrameProcessorPerformanceSuggestionAvailable: (suggestion: FrameProcessorPerformanceSuggestion) => void

Type declaration​

â–¸ (suggestion): void

Called when a new performance suggestion for a Frame Processor is available - either if your Frame Processor is running too fast and frames are being dropped, or because it is able to run faster. Optionally, you can adjust your frameProcessorFps accordingly.

Parameters​
NameType
suggestionFrameProcessorPerformanceSuggestion
Returns​

void

Defined in​

CameraProps.ts:176


onInitialized​

• Optional onInitialized: () => void

Type declaration​

â–¸ (): void

Called when the camera was successfully initialized.

Returns​

void

Defined in​

CameraProps.ts:172


orientation​

• Optional orientation: "portrait" | "portraitUpsideDown" | "landscapeLeft" | "landscapeRight"

Represents the orientation of all Camera Outputs (Photo, Video, and Frame Processor). If this value is not set, the device orientation is used.

Defined in​

CameraProps.ts:162


photo​

• Optional photo: boolean

Enables photo capture with the takePhoto function (see "Taking Photos")

Defined in​

CameraProps.ts:46


preset​

• Optional preset: CameraPreset

Automatically selects a camera format which best matches the given preset. Must be undefined when format is set!

Defined in​

CameraProps.ts:94


torch​

• Optional torch: "off" | "on"

Set the current torch mode.

Note: The torch is only available on "back" cameras, and isn't supported by every phone.

Default

"off"

Defined in​

CameraProps.ts:67


video​

• Optional video: boolean

Enables video capture with the startRecording function (see "Recording Videos")

Note: If you want to use video and frameProcessor simultaneously, make sure supportsParallelVideoProcessing is true.

Defined in​

CameraProps.ts:52


videoStabilizationMode​

• Optional videoStabilizationMode: VideoStabilizationMode

Specifies the video stabilization mode to use for this camera device. Make sure the given format contains the given videoStabilizationMode.

Requires format to be set.

Platform

iOS

Defined in​

CameraProps.ts:129


zoom​

• Optional zoom: number

Specifies the zoom factor of the current camera, in "factor"/scale.

This value ranges from minZoom (e.g. 1) to maxZoom (e.g. 128). It is recommended to set this value to the CameraDevice's neutralZoom per default and let the user zoom out to the fish-eye (ultra-wide) camera on demand (if available)

Note: Linearly increasing this value always appears logarithmic to the user.

Default

1.0

Defined in​

CameraProps.ts:79