AudioRecorder
A native recorder the scope that made it owns (docs/audio.md).
Utilisation
Configure a component-owned voice recorder.
Ce type est utilisé par audio.recorder
// Configure a component-owned voice recorder.
import { Button, audio, type RecordingFormat, type RecordingQuality } from 'kuito';
export function Memo() {
const format: RecordingFormat = 'aac';
const quality: RecordingQuality = 'high';
const recorder = audio.recorder({ format, quality });
return <Button onPress={() => void recorder.start().catch(console.error)}>Record</Button>;
}
// Declare microphone permission; finish the file with recorder.stop().Déclaration du type
export type AudioRecorder = {
readonly id: number;
readonly recording: ReadonlySignal<boolean>;
/** Seconds recorded so far, moved by the UI thread while recording. */
readonly time: Motion<number>;
/** The input level in dBFS, -160 (silence) to 0, when `metering` is on. */
readonly level: Motion<number>;
readonly error: ReadonlySignal<string | null>;
/** Starts a new file, asking for the microphone first, or resumes a paused one. */
start(): Promise<void>;
pause(): Promise<void>;
/** Finishes the file and resolves its `file://` URI, in the cache directory. */
stop(): Promise<Recording>;
};Membres 8
| Nom | Type | Requis | Description |
|---|---|---|---|
idlecture seule | number | Oui | — |
recordinglecture seule | ReadonlySignal<boolean> | Oui | — |
timelecture seule | Motion<number> | Oui | Seconds recorded so far, moved by the UI thread while recording. |
levellecture seule | Motion<number> | Oui | The input level in dBFS, -160 (silence) to 0, when metering is on. |
errorlecture seule | ReadonlySignal<string> | Oui | — |
start | () => Promise<void> | Oui | Starts a new file, asking for the microphone first, or resumes a paused one. |
pause | () => Promise<void> | Oui | — |
stop | () => Promise<Recording> | Oui | Finishes the file and resolves its file:// URI, in the cache directory. |
start — signatures de méthode
Signatures
(): Promise<void>Paramètres
Aucun paramètre.
Retourne
Promise<void>
pause — signatures de méthode
Signatures
(): Promise<void>Paramètres
Aucun paramètre.
Retourne
Promise<void>
stop — signatures de méthode
Signatures
(): Promise<Recording>Paramètres
Aucun paramètre.
Retourne
Promise<AudioRecording>
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.