Utilização

Pause and resume a camera preview.

Este tipo é usado por Camera

tsx
// 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

ts
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

NomeTipoObrigatórioDescrição
takePicture(options?: PictureOptions) => Promise<CameraPicture>SimTakes a picture with the current flash; the view must be ready.
startRecording(options?: RecordingOptions) => Promise<CameraRecording>SimStarts 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>SimEnds the recording, and resolves with the same video startRecording does.
pausePreview() => Promise<void>SimFreezes the preview and stops the camera, keeping the view.
resumePreview() => Promise<void>Sim—
takePicture — assinaturas de método

Assinaturas

ts
(options?: PictureOptions): Promise<CameraPicture>

Parâmetros

NomeTipoObrigatórioDescrição
optionsSpecPictureOptionsNão—

Devolve

Promise<SpecCameraPicture>

startRecording — assinaturas de método

Assinaturas

ts
(options?: RecordingOptions): Promise<CameraRecording>

Parâmetros

NomeTipoObrigatórioDescrição
optionsSpecRecordingOptionsNão—

Devolve

Promise<SpecCameraRecording>

stopRecording — assinaturas de método

Assinaturas

ts
(): Promise<CameraRecording>

Parâmetros

Sem parâmetros.

Devolve

Promise<SpecCameraRecording>

pausePreview — assinaturas de método

Assinaturas

ts
(): Promise<void>

Parâmetros

Sem parâmetros.

Devolve

Promise<void>

resumePreview — assinaturas de método

Assinaturas

ts
(): 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.