Reputation: 89
I am trying speech to text conversion in reactjs web application using Web speech API . When I open application on Windows desktop, web speech API works without any problem. But when I open the same application on Android chrome browser, it recognizes the same speech multiple times. I think on android chrome browser, the intermediate results of web speech API are considered as final result.
Upvotes: 2
Views: 2039
Reputation: 11
I was experiencing the same problem. What I load my app, I check for to determine if the app is loaded on a mobile device and set a non displayable (your option) checkbox within the html file, as follows:
x_mobileFlg = window.navigator.userAgentData.mobile
gObj_deviceFlgs.mobileDevice = x_mobileFlg
if (x_mobileFlg) {
document.getElementById("chkbox-mobile-device").checked = true
}
else {
document.getElementById("chkbox-mobile-device").checked = false
}
Then when I initiate the speech recongition api call I change the continuous flag if the device is mobile.
objVoiceRecognitionInput.continuous = true
if (document.getElementById("chkbox-mobile-device").checked) {
objVoiceRecognitionInput.continuous = false;
}
This worked perfectly, and I can input the text I want with my voice on either device.
Upvotes: 1
Reputation: 89
This is from https://www.npmjs.com/package/react-speech-recognition.
The transcript contains duplicate words! There is a bug in Android Chrome that causes the Web Speech API to generate duplicate words in the speech recognition result. Possible workarounds:
Set the continuous option to false (This worked in my case) Detect Android Chrome and render fallback content on that browser
Upvotes: 0