CameraMethods
What an app can ask a mounted Camera to do through its ref: take pictures, record video and pause the preview.
Utilização
Pause and resume a camera preview.
Este tipo é usado por 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>
</>
);
}Declaração do tipo
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>;
};Membros 5
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
takePicture | (options?: PictureOptions) => Promise<CameraPicture> | Sim | Takes a picture with the current flash; the view must be ready. |
startRecording | (options?: RecordingOptions) => Promise<CameraRecording> | Sim | 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> | Sim | Ends the recording, and resolves with the same video startRecording does. |
pausePreview | () => Promise<void> | Sim | Freezes the preview and stops the camera, keeping the view. |
resumePreview | () => Promise<void> | Sim | — |
takePicture — assinaturas de método
Assinaturas
(options?: PictureOptions): Promise<CameraPicture>Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
options | SpecPictureOptions | Não | — |
Devolve
Promise<SpecCameraPicture>
startRecording — assinaturas de método
Assinaturas
(options?: RecordingOptions): Promise<CameraRecording>Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
options | SpecRecordingOptions | Não | — |
Devolve
Promise<SpecCameraRecording>
stopRecording — assinaturas de método
Assinaturas
(): Promise<CameraRecording>Parâmetros
Sem parâmetros.
Devolve
Promise<SpecCameraRecording>
pausePreview — assinaturas de método
Assinaturas
(): Promise<void>Parâmetros
Sem parâmetros.
Devolve
Promise<void>
resumePreview — assinaturas de método
Assinaturas
(): Promise<void>Parâmetros
Sem parâmetros.
Devolve
Promise<void>
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.