React Native Android Text Top Speech
A react native android wrapper for Text To speech
Purpose
Currently , React Native doesn't have inbuilt support for TextToSpeech library for Android.
But with help of exposing module in react-native , this wrapper will solve the problem for TTS.
Setup
- Install Module
npm install --save-dev react-native-android-speech
android/settings.gradle
...include ':react-native-android-speech'project(':react-native-android-speech').projectDir = new File(settingsDir, '../node_modules/react-native-android-speech')
android/app/build.gradle
dependencies { ... compile project(':react-native-android-speech')}
- register module (in MainActivity.java)
... // Import package
Usage
Currently there following functionality available. All below functions return Promise , with proper error codes.
- getLocales
- speak(args)
- isSpeaking
- shutDown
- stop
Importing module
var tts =
getLocales()
Returns all avialbale langauges from TTS make sure that exists in device also.
Example
tts;
speak()
Example
tts;
isSpeaking()
This method will help to figure out wheter TTS engine is currently speaking or not.
Example
tts;
Stop()
Stop currently processing speech. Return True/False
Example
tts;
shutDown()
Shutdown TTS Engine
Example
tts;
Changes
PR's are welcome
Todo
- providing UternceId and callback
- Differnt Voices
- Custome Engines
- Support Speech To Text
LICENSE
MIT