Skip to content

✨ Expose photo capture format capabilities (RAW / Apple ProRAW support) to JS #4017

Description

@stevengoldberg

Prerequisites

What problem are you trying to solve?

I need a way to query, from JS, whether the current camera device/photo output supports RAW capture before attempting it — ideally distinguishing Apple ProRAW from Bayer RAW on iOS. For example:

CameraDevice.supportedPhotoContainerFormats: PhotoContainerFormat[], and/or
readonly properties on CameraPhotoOutput, e.g. supportsProRawCapture / supportsRawCapture, valid once the output is connected to a session

In V5, containerFormat must be configured upfront when creating a photo output via usePhotoOutput(...). There is currently no API to know whether 'dng' will actually work on the current device — capture simply rejects at runtime with:

"This PhotoOutput does not support raw capture ("dng" format)! Select a Format that contains dng in its supportedPhotoContainerFormats to capture raw photos."

Notably, the error message already refers to a supportedPhotoContainerFormats API that doesn't exist yet, and src/specs/outputs/CameraPhotoOutput.nitro.ts contains a TODO acknowledging the gap:

// TODO: I think there is no way to get 'containerFormat' upfront - we dont know what formats are supported! We need to expose that probably via 'CameraDevice.supportedPhotoContainerFormats'

Without this, apps that offer a RAW/JPEG toggle in their UI cannot decide whether to show the toggle at all. This matters because RAW availability varies significantly by hardware: Apple ProRAW is only available on Pro-model iPhones, and Bayer RAW is unavailable on virtual multi-cam devices (e.g. the dual/triple back camera) and the front camera. The only current workarounds are device-model heuristics or capturing and catching the error.

Proposed API / solution

On iOS the implementation appears straightforward — once the AVCapturePhotoOutput is connected to the session, the information is available natively:

  • ProRAW: AVCapturePhotoOutput.isAppleProRAWSupported
  • Bayer RAW: availableRawPhotoPixelFormatTypes filtered with AVCapturePhotoOutput.isBayerRAWPixelFormat(_:)

Alternatives considered

device-model heuristics via the device name (fragile across new models), a separate native module that spins up a throwaway AVCaptureSession just to read isAppleProRAWSupported (works, but duplicates session setup), and patching the library (requires regenerating Nitro bridges on every upgrade).

Platforms this should target

iOS

Would you be willing to contribute this?

Maybe, with guidance.

Additional context

I already implemented this functionality in my own fork of vision-camera v4, but would prefer not to fork the library again.

Submission

  • I described the problem, not just the solution.
  • I wrote this request in my own words. I did not paste AI-generated proposals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✨ featureProposes a new feature or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions