CameraMethods
What an app can ask a mounted Camera to do through its ref: take pictures, record video and pause the preview.
Verwendung
Pause and resume a camera preview.
Dieser Typ wird verwendet von Camera
// Pause and resume a camera preview.
import { Button, Camera, ref, type CameraHandle } from 'kuito';
function Scanner() {
// A plain ref holds the handle; cameraRef() adds ready and error signals.
const camera = ref<CameraHandle>();
return (
<>
<Camera ref={camera} flex={1} />
<Button onPress={() => void camera.current?.pausePreview()}>Pause</Button>
<Button onPress={() => void camera.current?.resumePreview()}>Resume</Button>
</>
);
}Typdeklaration
export type CameraMethods = {
/** Takes a picture with the current flash; the view must be ready. */
takePicture(options?: PictureOptions): Promise<CameraPicture>;
/**
* Starts recording, in `video` mode. Resolves with the video once the
* recording ends: `stopRecording`, `maxDuration`, the app leaving the
* foreground, or the view unmounting.
*/
startRecording(options?: RecordingOptions): Promise<CameraRecording>;
/** Ends the recording, and resolves with the same video `startRecording` does. */
stopRecording(): Promise<CameraRecording>;
/** Freezes the preview and stops the camera, keeping the view. */
pausePreview(): Promise<void>;
resumePreview(): Promise<void>;
};Mitglieder 5
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
takePicture | (options?: PictureOptions) => Promise<CameraPicture> | Ja | Takes a picture with the current flash; the view must be ready. |
startRecording | (options?: RecordingOptions) => Promise<CameraRecording> | Ja | Starts recording, in video mode. Resolves with the video once the
recording ends: stopRecording, maxDuration, the app leaving the
foreground, or the view unmounting. |
stopRecording | () => Promise<CameraRecording> | Ja | Ends the recording, and resolves with the same video startRecording does. |
pausePreview | () => Promise<void> | Ja | Freezes the preview and stops the camera, keeping the view. |
resumePreview | () => Promise<void> | Ja | — |
takePicture — Methodensignaturen
Signaturen
(options?: PictureOptions): Promise<CameraPicture>Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
options | SpecPictureOptions | Nein | — |
Rückgabe
Promise<SpecCameraPicture>
startRecording — Methodensignaturen
Signaturen
(options?: RecordingOptions): Promise<CameraRecording>Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
options | SpecRecordingOptions | Nein | — |
Rückgabe
Promise<SpecCameraRecording>
stopRecording — Methodensignaturen
Signaturen
(): Promise<CameraRecording>Parameter
Keine Parameter.
Rückgabe
Promise<SpecCameraRecording>
pausePreview — Methodensignaturen
Signaturen
(): Promise<void>Parameter
Keine Parameter.
Rückgabe
Promise<void>
resumePreview — Methodensignaturen
Signaturen
(): Promise<void>Parameter
Keine Parameter.
Rückgabe
Promise<void>
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.