voice icon indicating copy to clipboard operation
voice copied to clipboard

Every-time a new sentence is recognised it replaces the previously recognised text

Open nishmitha03 opened this issue 1 year ago • 5 comments

export const SpeechRecognition = (props: any) => {

  useEffect(() => {
    Voice.onSpeechStart = startListening;
    Voice.onSpeechEnd = stopListening;
    Voice.onSpeechResults = onSpeechResults;
    Voice.onSpeechError = (err) =>
      console.error('err in chatai component', err);
    return () => {
      Voice.destroy().then(Voice.removeAllListeners);
    };
  }, []);
const onSpeechResults = (e: any) => {
    const text = e.value[0];
    setRecognizedText(text);
  };  
const startListening = async () => {
    try {
      await Voice.start('en-US');
      setIsListening(true);
    } catch (error) {
      console.error('Error starting voice recognition', error);
    }
  };
  const stopListening = async () => {
    try {
      await Voice.stop();
      setIsListening(false);
    } catch (error) {
      console.error('Error stopping voice recognition', error);
    }
  };
  }

The logs look something like this LOG textttt===>>> {"value": ["But the data was coming"]} LOG textttt===>>> {"value": ["Once"]} LOG textttt===>>> {"value": ["Once I"]} LOG textttt===>>> {"value": ["Once I made"]}

Expected result LOG textttt===>>> {"value": ["But the data was coming Once I made"]}

This mostly happens for Iphone above 13

nishmitha03 avatar Nov 21 '24 12:11 nishmitha03

this is a bug only happens in iOS 18.0, upgrade to 18.1 will fix this https://forums.developer.apple.com/forums/thread/762952

AndyHuangWB avatar Nov 22 '24 07:11 AndyHuangWB

@AndyHuangWB Thank you

nishmitha03 avatar Nov 22 '24 08:11 nishmitha03

@AndyHuangWB is this issue specific to this package for iOS 18.0 versions?

nishmitha03 avatar Nov 29 '24 05:11 nishmitha03

Have you find any solution, I'm having same issue, I couldn't fix it

Zecky-dev avatar Dec 19 '24 13:12 Zecky-dev

@Zecky-dev , nope, not sure though but I think it happens only in iOS 18.0 https://forums.developer.apple.com/forums/thread/762952

nishmitha03 avatar Dec 19 '24 17:12 nishmitha03