react-native-voice / voice

:microphone: React Native Voice Recognition library for iOS and Android (Online and Offline Support)
MIT License
1.84k stars 495 forks source link

In iOS, onSpeechEnd never called #217

Open Reactongraph opened 5 years ago

Reactongraph commented 5 years ago

I am having issue with iOS, Android is working perfect issue is onSpeechEnd never called. How can i call a function when its end

horstleung commented 4 years ago

In iOS, it won't stop when user stop. You need to add a timeout function to stop it.

vishaljadav24 commented 4 years ago

@fattomhk Can you give the exact code?

horstleung commented 4 years ago

Something like this, unknown side effect to Android.

let timeout;
const InitDelay = 3000;
const ContinueDelay = 150;
const handleTimeout = ()=> {
     Voice.stop();
}

Voice.start(locale).then(()=>{
    timeout = setTimeout(handleTimeout, InitDelay);
)

Voice.onSpeechPartialResults = (event) => {
    if(timeout) { 
        clearTimeout(timeout);
    }
    timeout = setTimeout(handleTimeout, ContinueDelay);
}

remember to clear timeout when finish / error .....

MicahSteinbrecher commented 4 years ago

I am running into this .issue. voice recognition does seem to stop after several minutes of silence on iOS

lfoliveir4 commented 4 years ago

@fattomhk In the simulator this lib can have problems. Does this happen on your physical device or simulator?

horstleung commented 4 years ago

@lfoliveir4 My problem is that iOS won't end the speech when user stop speaking but android does. So, I set timeouts for that. Not related to simulator / real device.

tejachundru commented 4 years ago

iOS speech services do not end on its own when there is silence, but the framework stops speech recognition tasks that last longer than one minute, as per documentation here SFSpeechRecognizer

So you need to manage that by writing Platform-specific conditions for ios.

whereas for android speech services stop recognition on its own when there is silence or it is running for too long.

maysolanki commented 4 years ago

I have one issue on ios. when speech end then auto recognition doesn’t work on Ios. we have to stop manually at time.please give response for auto voice end detection.

roots-ai commented 3 years ago

Any updates here? This repo seems to be not managed well. There are several issues open around iOS

amitkumar144 commented 2 months ago

Hey! did you find any workaround on this