CameraRecording
A video a Camera recorded, as an MPEG-4 file in the cache with its length.
Utilisation
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>
</>
);
}Déclaration du type
export type CameraRecording = SpecCameraRecording;Membres 2
| Nom | Type | Requis | Description |
|---|---|---|---|
uri | string | Oui | An MPEG-4 video in the app's cache directory (file://). |
duration | number | Oui | Seconds. |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.