@appcitor/react-native-voice-to-text
Version:
This can use to convert voice to text real time in device
71 lines (70 loc) • 2.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.VoiceToTextEvents = void 0;
exports.addEventListener = addEventListener;
exports.default = void 0;
exports.destroy = destroy;
exports.getRecognitionLanguage = getRecognitionLanguage;
exports.getSupportedLanguages = getSupportedLanguages;
exports.isRecognitionAvailable = isRecognitionAvailable;
exports.removeAllListeners = removeAllListeners;
exports.setRecognitionLanguage = setRecognitionLanguage;
exports.startListening = startListening;
exports.stopListening = stopListening;
var _reactNative = require("react-native");
var _NativeVoiceToText = _interopRequireDefault(require("./NativeVoiceToText.js"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const VoiceToTextEvents = exports.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 _reactNative.NativeEventEmitter(_NativeVoiceToText.default);
function startListening() {
return _NativeVoiceToText.default.startListening();
}
function stopListening() {
return _NativeVoiceToText.default.stopListening();
}
function destroy() {
return _NativeVoiceToText.default.destroy();
}
function getRecognitionLanguage() {
return _NativeVoiceToText.default.getRecognitionLanguage();
}
function setRecognitionLanguage(languageTag) {
return _NativeVoiceToText.default.setRecognitionLanguage(languageTag);
}
function isRecognitionAvailable() {
return _NativeVoiceToText.default.isRecognitionAvailable();
}
function getSupportedLanguages() {
return _NativeVoiceToText.default.getSupportedLanguages();
}
function addEventListener(eventName, handler) {
return voiceToTextEmitter.addListener(eventName, handler);
}
function removeAllListeners(eventName) {
voiceToTextEmitter.removeAllListeners(eventName);
}
var _default = exports.default = {
startListening,
stopListening,
destroy,
getRecognitionLanguage,
setRecognitionLanguage,
isRecognitionAvailable,
getSupportedLanguages,
addEventListener,
removeAllListeners,
...VoiceToTextEvents
};
//# sourceMappingURL=index.js.map