CameraRef
A Camera's ref that also holds its state: ready while the preview
runs and the camera can take pictures and record, and the last error.
Called while a component sets up, which owns it, like ref().
Utilização
Configure video capture.
Este tipo é usado por cameraRef
// Configure video capture.
import { Button, Camera, cameraRef, type RecordingOptions } from 'kuito';
// A clip stops on its own after 15 seconds.
const clip: RecordingOptions = { maxDuration: 15 };
function Clip() {
const camera = cameraRef();
const record = async () => {
const video = await camera.current?.startRecording(clip);
console.log(video?.uri, video?.duration);
};
return (
<>
<Camera ref={camera} mode="video" flex={1} />
<Button onPress={record}>Record</Button>
</>
);
}Declaração do tipo
export type CameraRef = ElementRef<CameraHandle> & {
readonly ready: ReadonlySignal<boolean>;
readonly error: ReadonlySignal<{ code: string; message: string } | null>;
};Membros 3
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
current | CameraHandle | Sim | — |
readysó de leitura | ReadonlySignal<boolean> | Sim | — |
errorsó de leitura | ReadonlySignal<{ code: string; message: string;}> | Sim | — |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.