View as Markdown

API reference: @salmonui/inputs/speech-to-text

SpeechRecognitionApiinterface

import type { SpeechRecognitionApi } from '@salmonui/inputs/speech-to-text';
interface SpeechRecognitionApi {
    readonly state: SpeechRecognitionState;
    readonly transcript: string;
    readonly supported: boolean;
    readonly start: () => void;
    readonly stop: () => void;
    readonly abort: () => void;
}
SpeechRecognitionApi members (6)
NameSignatureDescription
statereadonly state: SpeechRecognitionState;

'idle', 'listening' or 'stopped'.

transcriptreadonly transcript: string;

Text of the current session: final results, then interim ones.

supportedreadonly supported: boolean;

False on the server, during hydration and in browsers without the Web Speech API; true with a recognizer.

startreadonly start: () => void;

Starts a new session with an empty transcript. Without a recognizer it calls onError({ code: 'unsupported' }).

stopreadonly stop: () => void;

Stops listening; the last results still arrive, then the session ends.

abortreadonly abort: () => void;

Ends the session without further results.