@aurally/speech-control
Version:
A class to handle microphone permissions, start and observe speech input
29 lines (28 loc) • 1.04 kB
TypeScript
import { Observable, Subscriber } from 'rxjs';
import { INotification } from './components/notification';
export declare enum SpeechControlErrors {
NoSpeechRecognition = "no-speech-recognition",
Disabled = "disabled"
}
export { INotification };
export interface IOptions {
recLanguage?: string;
}
export declare class SpeechControl {
_recognition?: SpeechRecognition;
_observable?: Observable<SpeechRecognitionEvent>;
_stopped: boolean;
_notificationShown: boolean;
notification?: INotification;
recLanguage?: string;
constructor(options?: IOptions);
_record(subscriber: Subscriber<SpeechRecognitionEvent>): void;
_disableRec(): void;
askForPermission(): Observable<any>;
whenPermissionGranted(): Observable<any>;
isEnabled(): boolean;
setNotification(notification: INotification): void;
on(term: string): Observable<SpeechRecognitionEvent>;
start(notificationOptions?: INotification): Observable<SpeechRecognitionEvent>;
stop(): void;
}