@appcitor/react-native-voice-to-text
Version:
This can use to convert voice to text real time in device
56 lines (55 loc) • 1.59 kB
JavaScript
;
import { NativeEventEmitter } from 'react-native';
import VoiceToText from "./NativeVoiceToText.js";
export const VoiceToTextEvents = {
START: 'onSpeechStart',
BEGIN: 'onSpeechBegin',
END: 'onSpeechEnd',
ERROR: 'onSpeechError',
RESULTS: 'onSpeechResults',
PARTIAL_RESULTS: 'onSpeechPartialResults',
VOLUME_CHANGED: 'onSpeechVolumeChanged',
AUDIO_BUFFER: 'onSpeechAudioBuffer',
EVENT: 'onSpeechEvent'
};
const voiceToTextEmitter = new NativeEventEmitter(VoiceToText);
export function startListening() {
return VoiceToText.startListening();
}
export function stopListening() {
return VoiceToText.stopListening();
}
export function destroy() {
return VoiceToText.destroy();
}
export function getRecognitionLanguage() {
return VoiceToText.getRecognitionLanguage();
}
export function setRecognitionLanguage(languageTag) {
return VoiceToText.setRecognitionLanguage(languageTag);
}
export function isRecognitionAvailable() {
return VoiceToText.isRecognitionAvailable();
}
export function getSupportedLanguages() {
return VoiceToText.getSupportedLanguages();
}
export function addEventListener(eventName, handler) {
return voiceToTextEmitter.addListener(eventName, handler);
}
export function removeAllListeners(eventName) {
voiceToTextEmitter.removeAllListeners(eventName);
}
export default {
startListening,
stopListening,
destroy,
getRecognitionLanguage,
setRecognitionLanguage,
isRecognitionAvailable,
getSupportedLanguages,
addEventListener,
removeAllListeners,
...VoiceToTextEvents
};
//# sourceMappingURL=index.js.map