CameraPhotoOutput
interface CameraPhotoOutput extends CameraOutputThe CameraPhotoOutput allows capturing Photos
in-memory, as well as directly to a file.
In-memory Photos can be converted to Images for immediate
display, and/or saved to a file (or the media gallery) later on.
See
Example
const photoOutput = usePhotoOutput({})Properties
mediaType
readonly mediaType: MediaTypeThe media type of the content being streamed
by this CameraOutput.
Inherited from
outputOrientation
outputOrientation: CameraOrientationGets or sets the output orientation of this CameraOutput.
Individual implementations of CameraOutput
may choose different strategies for implementing
output orientation, for example:
- A Photo output might apply orientation via EXIF flags.
- A Video output might apply orientation via track transform metadata.
- A Preview output might apply orientation via view transforms.
- A Frame output might not apply orientation and only pass it as a
property via the
Frameobject, unless explicitly configured to physically rotate buffers.
Inherited from
CameraOutput.outputOrientation
supportsCameraCalibrationDataDelivery
readonly supportsCameraCalibrationDataDelivery: booleanget whether this CameraPhotoOutput supports
delivering camera calibration data, e.g. for reconstructing
lens-distortion or geometry.
See
CapturePhotoSettings.enableCameraCalibrationDataDelivery
supportsDepthDataDelivery
readonly supportsDepthDataDelivery: booleanGet whether this CameraPhotoOutput supports
capturing depth data alongside with a normal Photo,
e.g. for portrait effects matte.
See
CapturePhotoSettings.enableDepthData
Methods
capturePhoto()
capturePhoto(settings: CapturePhotoSettings, callbacks: CapturePhotoCallbacks): Promise<Photo>Captures a Photo using the given
CapturePhotoSettings.
Note
On Android, it is recommended to use
capturePhoto(...) only
for 'jpeg' images, and use
capturePhotoToFile(...)
for any other formats (such as RAW ('dng'),
as CameraX does not properly support in-memory Photos for formats like RAW yet.
See https://issuetracker.google.com/u/3/issues/482079661 for more information.
Note
The Photo has to be dispose()'d after it
is no longer used, as otherwise the JS Runtime might not
immediately delete it, possibly exhausting system resources.
Example
const photo = await photoOutput.capturePhoto(
{ flashMode: 'on' },
{}
)
// ...
photo.dispose()capturePhotoToFile()
capturePhotoToFile(settings: CapturePhotoSettings, callbacks: CapturePhotoCallbacks): Promise<PhotoFile>Captures a Photo and writes it to a temporary file
using the given CapturePhotoSettings.
Example
const photoFile = await photoOutput.capturePhotoToFile(
{ flashMode: 'on' },
{}
)