AudioRecorder
A native recorder the scope that made it owns (docs/audio.md).
Utilização
Configure a component-owned voice recorder.
Este tipo é usado por 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().Declaração do tipo
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>;
};Membros 8
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
idsó de leitura | number | Sim | — |
recordingsó de leitura | ReadonlySignal<boolean> | Sim | — |
timesó de leitura | Motion<number> | Sim | Seconds recorded so far, moved by the UI thread while recording. |
levelsó de leitura | Motion<number> | Sim | The input level in dBFS, -160 (silence) to 0, when metering is on. |
errorsó de leitura | ReadonlySignal<string> | Sim | — |
start | () => Promise<void> | Sim | Starts a new file, asking for the microphone first, or resumes a paused one. |
pause | () => Promise<void> | Sim | — |
stop | () => Promise<Recording> | Sim | Finishes the file and resolves its file:// URI, in the cache directory. |
start — assinaturas de método
Assinaturas
(): Promise<void>Parâmetros
Sem parâmetros.
Devolve
Promise<void>
pause — assinaturas de método
Assinaturas
(): Promise<void>Parâmetros
Sem parâmetros.
Devolve
Promise<void>
stop — assinaturas de método
Assinaturas
(): Promise<Recording>Parâmetros
Sem parâmetros.
Devolve
Promise<AudioRecording>
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.