Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nishmitha03 opened this issue Nov 21, 2024 · 5 comments

Comments

@nishmitha03
Copy link

nishmitha03 commented Nov 21, 2024

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

@AndyHuangWB
Copy link

AndyHuangWB commented Nov 22, 2024

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

@nishmitha03
Copy link
Author

@AndyHuangWB Thank you

@nishmitha03
Copy link
Author

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

@Zecky-dev
Copy link

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

@nishmitha03
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants