voice icon indicating copy to clipboard operation
voice copied to clipboard

Voice Recognition not working well in iOS , fetch only first word

Open gaurav92-gs opened this issue 6 years ago • 32 comments

Question Voice Recognition not working well in iOS , fetch only first word after that gives result , fine in android.

gaurav92-gs avatar Oct 10 '19 06:10 gaurav92-gs

Same problem.

MediaByte avatar Oct 10 '19 12:10 MediaByte

Same problem, i upgrade my react-native to 0.61.1, to work with fast reload, but now voice recognition not working

conext18 avatar Oct 10 '19 22:10 conext18

I'm also having this problem in iOS, while in Android works fine.

OscarSaro avatar Oct 31 '19 12:10 OscarSaro

Me too, Voice.stop() doesn't call onSpeechEnd !!

rpf5573 avatar Nov 05 '19 02:11 rpf5573

We use cancel method to finish recognition but it fails. In order to make the library work, we filtered the throwed error

onSpeechError = e => {
        console.log(e);
        if(e.error.code != 'recognition_fail'){
            this.setState({
                error: JSON.stringify(e.error),
            });
        }
    };

And we changed the state of end after canceling

    try {
          await Voice.cancel();
          this.setState({
            end: true,
          });
        } catch (e) {
          //eslint-disable-next-line
          console.error(e);
        }
      };

We need further testing on Android if it breaks it downs

omargavidia avatar Nov 14 '19 02:11 omargavidia

Me too, Voice.stop() doesn't call onSpeechEnd !!

do you find any solutions on mine it like after call stop it hang for 5 seconds or more then onSpeechEnd will callback

punjasin avatar Nov 21 '19 02:11 punjasin

Same problem here, Voice.stop() doesn't call onSpeechEnd nor does it show FinalResult: true.

CyrisXD avatar Nov 21 '19 08:11 CyrisXD

@gaurav92-gs Did you solved your problem??

lfoliveir4 avatar Dec 16 '19 12:12 lfoliveir4

for some reason, I didn't fix anything and when we launch update on our app again (no change in that problem yet) it solves itself -,-

punjasin avatar Jan 09 '20 04:01 punjasin

I am having the same issue on iOS real device. My device is using iOS 13.5.1 and React Native 0.63.2 and voice is using 1.1.3. Have you guys solved this issue or found a work around? Android is working fine.

Aung-Myint-Thein avatar Jul 30 '20 07:07 Aung-Myint-Thein

I managed to make this work. I was using hook and accidentally calling destroy() in useEffect after the result is set. Now it is working properly after I updated the flow 🙂 I followed the codes from this article and managed to make it work. Please be careful that the codes in the article is not complete but can get the idea. https://medium.com/@gilshaan/speech-to-text-conversion-in-react-native-using-hooks-use-usestate-and-useeffect-c2b9de6b8a8a

Aung-Myint-Thein avatar Jul 31 '20 02:07 Aung-Myint-Thein

Thanks @Aung-Myint-Thein for the resource! @gaurav92-gs does this help you out to close the issue?

safaiyeh avatar Jul 31 '20 19:07 safaiyeh

@Aung-Myint-Thein The source code has same issue on iOS. Not working totally on iOS. only fetching first word

lindev0915 avatar Dec 23 '20 23:12 lindev0915

me too, any update

phongbksneep avatar Mar 29 '21 08:03 phongbksneep

any update on this problem? im facing this too

tearjuIce avatar Jul 20 '21 07:07 tearjuIce

Any update on this?

bampowbam avatar Oct 02 '21 23:10 bampowbam

Inside the onSpeechResults function add debounce and check the result.

DeepakM02 avatar Oct 10 '21 12:10 DeepakM02

Inside the onSpeechResults function add debounce and check the result.

What?

roots-ai avatar Oct 18 '21 15:10 roots-ai

Any updates here?

roots-ai avatar Oct 18 '21 15:10 roots-ai

In IOS, it will keep returning results one by one in words. You will have to wait for 1 or 2 secs and then check the result.

DeepakM02 avatar Oct 19 '21 12:10 DeepakM02

Guys! I Founded a solution. For me helped changing of Language which Voice lib listen. For English should be as 'en-GB'. Not others variants. await Voice.start('en-GB'); <--- like this.

Boichonok avatar Apr 04 '22 12:04 Boichonok

For IOS we need to add interval on speechEnd is not working.

` useEffect(() => { if (listening && isIos) { //clearing the timeout clearTimeout(clearVoicerecognisation?.current); //starting timeOut clearVoicerecognisation.current = setTimeout(() => { // alert('Closing after 3 seconds'); stopListening(); }, 3000); } }, [listening]);

useEffect(() => { // Set up event listeners Voice.onSpeechResults = event => { setSearchValue(event?.value[0]); }; Voice.onSpeechEnd = e => { console.log('closed'); stopListening(); }; return () => { // Clean up event listeners when component unmounts Voice.destroy().then(Voice.removeAllListeners); }; }, []);

const startListening = async () => { try { // Start voice recognition await Voice.start('en-US'); setSearchValue(''); } catch (error) { console.error('Error starting voice recognition:', error); } };

const stopListening = async () => { try { await Voice.stop(); clearTimeout(clearVoicerecognisation?.current); setIsListening(false); } catch (error) { console.error('Error stopping voice recognition:', error); } }; `

taj567 avatar Mar 07 '24 06:03 taj567

me too, any update?

EHRdev avatar Mar 26 '24 14:03 EHRdev

Still waiting for a fix. Our Project depends on it.

godwin-codeprism avatar May 03 '24 11:05 godwin-codeprism

It seems it is working for me. I have added patch work. I will share it soon.

On Fri, 3 May 2024, 5:13 pm Godwin Vinny Carole, @.***> wrote:

Still waiting for a fix. Our Project depends on it.

— Reply to this email directly, view it on GitHub https://github.com/react-native-voice/voice/issues/213#issuecomment-2092835454, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG6GMTFCFCVZOIB63YR3ZCLZANZ4XAVCNFSM4I7IL3GKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBZGI4DGNJUGU2A . You are receiving this because you commented.Message ID: @.***>

DeepakM02 avatar May 03 '24 12:05 DeepakM02