AudioRecorder
A native recorder the scope that made it owns (docs/audio.md).
Verwendung
Configure a component-owned voice recorder.
Dieser Typ wird verwendet von 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().Typdeklaration
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>;
};Mitglieder 8
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
idschreibgeschützt | number | Ja | — |
recordingschreibgeschützt | ReadonlySignal<boolean> | Ja | — |
timeschreibgeschützt | Motion<number> | Ja | Seconds recorded so far, moved by the UI thread while recording. |
levelschreibgeschützt | Motion<number> | Ja | The input level in dBFS, -160 (silence) to 0, when metering is on. |
errorschreibgeschützt | ReadonlySignal<string> | Ja | — |
start | () => Promise<void> | Ja | Starts a new file, asking for the microphone first, or resumes a paused one. |
pause | () => Promise<void> | Ja | — |
stop | () => Promise<Recording> | Ja | Finishes the file and resolves its file:// URI, in the cache directory. |
start — Methodensignaturen
Signaturen
(): Promise<void>Parameter
Keine Parameter.
Rückgabe
Promise<void>
pause — Methodensignaturen
Signaturen
(): Promise<void>Parameter
Keine Parameter.
Rückgabe
Promise<void>
stop — Methodensignaturen
Signaturen
(): Promise<Recording>Parameter
Keine Parameter.
Rückgabe
Promise<AudioRecording>
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.