mihirsoni / react-native-android-speech

This simple React Native module for Android Text To Speech functionality.
https://www.npmjs.com/package/react-native-android-speech
48 stars 14 forks source link

Emit events upon utterance progress #4

Closed slycoder closed 7 years ago

slycoder commented 7 years ago

This change adds a UtteranceProgressListener onto the tts object. These just pass the event along via the device event emitter so that javascript listeners can detect these events.

In order for this to work, you need to set the utterance id (otherwise it the progress listener will not be called. I’m creating them by just generating UUIDs for each utterance.

mihirsoni commented 7 years ago

@slycoder Thanks a lot for PR.

Did you test this changes, generating UUID for each utterance wouldn't be expensive ?

slycoder commented 7 years ago

@mihirsoni I didn't notice any speed degradation when I tried. I suspect that the amount of time needed to construct the speech is much larger than the amount of time required to generate a UUID. But to be fair, I didn't rigorously test this assumption with any benchmarks. If it's a concern I can change this to just use nanotime instead. How does that sound?

mihirsoni commented 7 years ago

@slycoder Cool , I will test this and merge this, once again thanks for the PR \m/