SkiaCameraProps

interface SkiaCameraProps extends CameraProps, Pick

Represents props for a SkiaCamera.

Properties

cameraExtension?

optional cameraExtension: CameraExtension

Inherited from

CameraProps.cameraExtension


colorSpace?

optional colorSpace: 
  | ColorSpace
  | "auto"

Inherited from

CameraProps.colorSpace


depthFormat?

optional depthFormat: 
  | CameraFormat
  | null

Inherited from

CameraProps.depthFormat


device

Inherited from

CameraProps.device


enableDistortionCorrection?

optional enableDistortionCorrection: boolean

Inherited from

CameraProps.enableDistortionCorrection


enableLowLightBoost?

optional enableLowLightBoost: boolean

Inherited from

CameraProps.enableLowLightBoost


enableMultiCamSupport?

optional enableMultiCamSupport: boolean

Inherited from

CameraProps.enableMultiCamSupport


enablePhysicalBufferRotation?

optional enablePhysicalBufferRotation: boolean

Physically rotates buffers to the desired target Orientation and MirrorMode.

By default, it is disabled as Skia rotates and mirrors the Frame via efficient GPU-based transforms. Enabling this results in the Frame always being upright and never mirrored.

Default

false

enablePreviewSizedOutputBuffers?

optional enablePreviewSizedOutputBuffers: boolean

Configures the underlying CameraVideoOutput to downscale Frames to a size suitable for preview, such as the screen size.

This may be more efficient if you chose a high-resolution CameraFormat as Skia doesn't have to operate on high-resolution Frames, but ideally you should choose a matching CameraFormat (possibly a preview-sized one) upfront, so no scaling would be necessary at any point in the pipeline.

Default

false

enableSmoothAutoFocus?

optional enableSmoothAutoFocus: boolean

Inherited from

CameraProps.enableSmoothAutoFocus


enableVideoHDR?

optional enableVideoHDR: boolean

Inherited from

CameraProps.enableVideoHDR


format?

optional format: CameraFormat

Inherited from

CameraProps.format


fps?

optional fps: Range

Inherited from

CameraProps.fps


getInitialExposureBias()?

optional getInitialExposureBias: () => number | undefined

Inherited from

CameraProps.getInitialExposureBias


getInitialZoom()?

optional getInitialZoom: () => number | undefined

Inherited from

CameraProps.getInitialZoom


isActive

isActive: boolean

Inherited from

CameraProps.isActive


mirrorMode?

optional mirrorMode: MirrorMode

Inherited from

CameraProps.mirrorMode


onConfigured()?

optional onConfigured: () => void

Called whenever the CameraSession has been configured with new connections via configure(...) and connections to the individual outputs are formed.

This is a good place to check output capabilities, such as CameraVideoOutput.getSupportedVideoCodecs()

Inherited from

CameraProps.onConfigured


onError()?

optional onError: (error: Error) => void

Called whenever the CameraSession has encountered an error.

Inherited from

CameraProps.onError


onFrame()

onFrame: (frame: Frame, render: (onDraw: (state: SkiaOnFrameState) => void) => void) => void

Called on every Frame with the current state.

Note

You must render the Frame to the Canvas yourself via render, otherwise it'll just be a black screen.

Worklet

Example

onFrame(frame, render) {
  'worklet'
  render(({ frameTexture, canvas }) => {
    canvas.drawImage(frameTexture, 0, 0)
  })
  frame.dispose()
}

onInterruptionEnded()?

optional onInterruptionEnded: () => void

Called when a previous interruption has ended and the CameraSession is running uninterrupted again.

Inherited from

CameraProps.onInterruptionEnded


onInterruptionStarted()?

optional onInterruptionStarted: (interruption: InterruptionReason) => void

Called whenever the CameraSession has encountered an interruption of the given InterruptionReason. Interruptions are temporarily.

Inherited from

CameraProps.onInterruptionStarted


onStarted()?

optional onStarted: () => void

Called when the CameraSession has been started.

Inherited from

CameraProps.onStarted


onStopped()?

optional onStopped: () => void

Called when the CameraSession has been stopped.

Inherited from

CameraProps.onStopped


orientationSource?

optional orientationSource: 
  | OrientationSource
  | "custom"

Set a desired OrientationSource for automatically applying Orientation to all outputs, or 'custom' if you prefer to manually specify Orientation yourself.

Inherited from

CameraProps.orientationSource


outputs?

optional outputs: CameraOutput[]

Inherited from

CameraProps.outputs


pixelFormat?

optional pixelFormat: TargetVideoPixelFormat

Selects the TargetVideoPixelFormat for the Frame Output using the Skia rendering pipeline.

It is recommended to use 'native' if your currently selected CameraFormat's nativePixelFormat is supported by Skia as this is a zero-copy GPU-only path.

Only resort back to 'yuv' (or possibly even 'rgb') if CPU-based Frame access is required.

Note

Use 'native' with caution, as the device's native format could be a format that is not supported by Skia - for example 'raw-bayer-packed96-12-bit'. The 'private' pixel format is the most efficient GPU-only pixel format supported by Skia.

Default

'native' or 'yuv'

ref?

optional ref: Ref<SkiaCameraRef>

A reference to a SkiaCamera.

See

SkiaCameraRef


videoStabilizationMode?

optional videoStabilizationMode: VideoStabilizationMode

Inherited from

CameraProps.videoStabilizationMode


warnIfRenderSkipped?

optional warnIfRenderSkipped: boolean

Warns the developer if the onFrame(...) callback did not call render(...).

Disable this if you intentionally want to skip a render.

Default

true