Voice: On iOS simulator, speech capture never ends

Created on 16 Aug 2018  路  7Comments  路  Source: react-native-voice/voice

I have a simple app that listens to what the user says and repeats it using react-native-tts.

On Android, the event sequence is simple:
onSpeechStart is called after I call Voice.start()
onSpeechEnd then onSpeechResults is called after I say something then pause
I need to call onSpeechStart to listen again.

On iOS, the sequence is very different:
onSpeechStart is called after I call Voice.start()
onSpeechRecognized is called after I say something then pause
onSpeechEnd and onSpeechResults are never called
Speech capture continues and any additional words spoken are added to the buffer instead of the buffer being cleared.

Is there any way of ensuring voice capture finishes when I pause on iOS just like on Android?

Most helpful comment

We solved it by using the lodash debounce function and initialising onSpeechResults as follows:

Voice.onSpeechResults = _.debounce(this.onSpeechResults.bind(this), 1000)

Now when there is a 1000ms pause in the recording, onSpeechResults is called.

All 7 comments

i met same issues, it link to network connection error with siri apple server of my mac. But siri on Mac still working ... i will send log late

same here, I think there should be way to manually stop recording. Like Voice.stop()

We solved it by using the lodash debounce function and initialising onSpeechResults as follows:

Voice.onSpeechResults = _.debounce(this.onSpeechResults.bind(this), 1000)

Now when there is a 1000ms pause in the recording, onSpeechResults is called.

For me, this is happening even when testing on device. Will try @Grekain1's solution a bit later.

Debouncing fixed the issue with onSpeechResults handler being triggered multiple times.
Still had to handle turning off voice recognition. The onSpeechEnd is never called even if I call Voice.stop() or Voice.cancel().

did u anyone get any solution for this?
i am having same issue in ios, onSpeechEnd never calls.

@Fistynuts Did your solved your problem?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlkanV picture AlkanV  路  7Comments

blackcoudpm picture blackcoudpm  路  8Comments

vaibhgupta09 picture vaibhgupta09  路  4Comments

alvaro1728 picture alvaro1728  路  3Comments

inglesuniversal picture inglesuniversal  路  8Comments