Usage

Save the result of recording a video.

tsx
// Save the result of recording a video.
import { Button, Camera, cameraRef, fileSystem, type CameraRecording } from 'kuito';

async function keep(video: CameraRecording) {
  // Recordings land in the cache, which the system may clear: move the keepers.
  const to = `${fileSystem.documents}clip-${Date.now()}.mp4`;

  await fileSystem.move(video.uri, to);

  return to;
}

function Recorder() {
  const camera = cameraRef();

  return (
    <>
      <Camera ref={camera} mode="video" flex={1} />
      <Button onPress={() => void camera.current?.startRecording().then(keep)}>Record</Button>
      <Button onPress={() => void camera.current?.stopRecording()}>Stop</Button>
    </>
  );
}

Type declaration

ts
export type CameraRecording = SpecCameraRecording;

Members 2

NameTypeRequiredDescription
uristringYesAn MPEG-4 video in the app's cache directory (file://).
durationnumberYesSeconds.
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.