Skip to content

Commit

Permalink
updating README with proper APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihir Soni committed Nov 7, 2015
1 parent 9fc55c9 commit a6182ac
Showing 1 changed file with 35 additions and 17 deletions.
52 changes: 35 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand

## Usage

Currently there following functionality available.
Currently there following functionality available. All below functions return Promise , with proper error codes.

-getLocales
- getLocales
- speak(args)
- isSpeaking
- shutDown
Expand All @@ -84,31 +84,33 @@ var tts = require('react-native-android-speech')
```

### getLocales()
Returns all avialbale langauges in android TTS. Currently it returns Langugage Name , you might need to find code from https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

Returns all avialbale langauges from TTS make sure that exists in device also.

## Example

```js
tts.getLocales().then(locales=>{
console.log(locales)
});

```
## Example

### speak()

## Example

```js
tts.speak({
text:'Please provide some text to speak.',
pitch:1.5, //Optional Parameter to set the speed of Speech,
text:'Please provide some text to speak.', // Mandatory
pitch:1.5, // Optional Parameter to set the pitch of Speech,
forceStop : false , // Optional Parameter if true , it will stop TTS if it is already in process
language : 'en' // Default is EN you can provide any supported lang by TTS

language : 'en' // Optional Paramenter Default is en you can provide any supported lang by TTS
}).then(isSpeaking=>{
//Success Callback
console.log(isSpeaking);
}).catch(error=>{
//Errror Callback
console.log(error)
});

```
Expand All @@ -120,9 +122,14 @@ This method will help to figure out wheter TTS engine is currently speaking or n
## Example

```js
tts.isSpeaking().then(isSpeaking=>{
tts.isSpeaking()
.then(isSpeaking=>{
//Callback
console.log(isSpeaking);
})
.catch(error=>{
//if it fails
console.log(error)
});

```
Expand All @@ -134,9 +141,12 @@ Stop currently processing speech. Return True/False
## Example

```js
tts.shutDown().then(stop=>{
//Callback
console.log(stop);
tts.shutDown()
.then(isStopped=>{
console.log(isStopped);
})
.catch(error=>{
console.log(error);
});

```
Expand All @@ -148,19 +158,27 @@ Shutdown TTS Engine
## Example

```js
tts.shutDown().then(shutDown=>{
tts.shutDown()
.then(shutDown=>{
//Callback
console.log(shutDown);
})
.catch(error=>{
console.log(error)
});

```

## Changes
PR's are welcome

## Credits
* [React Native](https://facebook.github.io/react-native/) - Awesome software.
* [React Native Android Badge](https://github.com/jhen0409/react-native-android-badge) - For showing me the light with regards to the gradle build system, as applied to react native
## Todo

* [ ] providing UternceId and callback
* [ ] Differnt Voices
* [ ] Custome Engines
* [ ] Support Speech To Text


## LICENSE

Expand Down

0 comments on commit a6182ac

Please sign in to comment.