CameraRecording
A video a Camera recorded, as an MPEG-4 file in the cache with its length.
Utilização
Save the result of recording a video.
// 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>
</>
);
}Declaração do tipo
export type CameraRecording = SpecCameraRecording;Membros 2
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
uri | string | Sim | An MPEG-4 video in the app's cache directory (file://). |
duration | number | Sim | Seconds. |
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.