Open juan-serrano-soria opened 1 month ago
i made some changes to project
handling the state on Android. I think one of the problem, is there are many timeout to stop the recording every 2-5 seconds - that could be problems. So instead, i implement to stop recording if "listening state" changed or "there is an error in recording".
SpeechRecognition.addListener('partialResults', (data) => {
if (continueRecording) {
setTranscript([...transcript, data.matches[0]]);
} else {
setTranscript([data.matches[0]]);
}
if (Capacitor.platform === 'android') {
if (!data || !data.matches[0]) {
stopRecording();
}
SpeechRecognition.addListener('listeningState', (state) => {
if (state && state.status && state.status === 'stopped') {
stopRecording();
}
});
}
});
}
You can import the project from here - https://monaca.mobi/en/directimport?pid=666a6abde7888535448d0191
Anyway, i think the app can be improved like
The continue recording functionality does not work 100% of the times. Sometimes the speech is not correctly added to state when continuing listening.