Closed sibelius closed 5 years ago
facing same problem here
I think it's an OS behavior. When you're using google assistant on android it automatically recognize if you're finished with speaking. If I remember correctly you have always hold a speech button if you're talking to Siri?!
we should debounce on iOS I think
check this https://github.com/wenkesj/react-native-voice/issues/21
gonna try to great a helper on react-native-voice soon to fix this
tks
@sibelius I was facing this problem earlier in iOS as well. Sadly I currently have no time to create a PR, but I hope you can use the following code somehow.
mRecognitionTask = mSpeechRecognizer.recognitionTask(with: mSpeechRequest) { [unowned self] result, _ in
// We got some results
if let transcription = result?.bestTranscription {
// Invalidate old timer if not nil
self.mEndOfSpeechTimer?.invalidate()
// Schedule new timer
self.mEndOfSpeechTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false) { _ in
self.stopRecognition()
completion(transcription.formattedString)
}
}
it'd be cool to have the same behavior of Android?
can we implement this in a bridge?
any thoughts on this?