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

Inconsistent delay before onSpeechStart is called #497

Open
rewhsu opened this issue Apr 24, 2024 · 1 comment
Open

Inconsistent delay before onSpeechStart is called #497

rewhsu opened this issue Apr 24, 2024 · 1 comment

Comments

@rewhsu
Copy link

rewhsu commented Apr 24, 2024

I realize that this project is essentially abandoned, but am wondering if anyone else is experiencing this issue or has found a fix. onSpeechStart seems to experience an inconsistent delay, usually after the first time the Voice.start() method is called.

I've logged this line in the module, and it seems to essentially be firing immediately, as expected:

console.log('Voice.startSpeech', new Date().toISOString()) // 2024-04-24T22:35:23.832Z
Voice.startSpeech(locale, callback);

The callback also seems to be firing at essentially the same time.

However, my implementation's onSpeechStart sometimes fires immediately, or can experience a delay of up to a couple seconds:

useEffect(() => {
    Voice.onSpeechStart = onSpeechStart;
    Voice.onSpeechRecognized = onSpeechRecognized;
    Voice.onSpeechEnd = onSpeechEnd;
    Voice.onSpeechError = onSpeechError;
    Voice.onSpeechResults = onSpeechResults;
    Voice.onSpeechPartialResults = onSpeechPartialResults;
    Voice.onSpeechVolumeChanged = onSpeechVolumeChanged;
    return () => {
      Voice.destroy().then(Voice.removeAllListeners);
    };
}, []);

const onSpeechStart = (_e: SpeechStartEvent) => {
    console.log('onSpeechStart', new Date().toISOString()); // 2024-04-24T22:35:26.447Z
    setStarted(true);
};

Any help, alternatives, or discussion would be greatly appreciated, thanks!

@rewhsu
Copy link
Author

rewhsu commented Apr 24, 2024

A related issue: #404

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

1 participant