possible fix for speech recognition on android
parent
ac2a40f382
commit
1917bc19e0
|
@ -137,8 +137,10 @@ export default function MessageInput(props: MessageInputProps) {
|
|||
|
||||
speechRecognition.onresult = (event) => {
|
||||
let transcript = '';
|
||||
for (let i = 0; i < event.results.length; ++i) {
|
||||
transcript += event.results[i][0].transcript;
|
||||
for (let i = 0; i < event.results.length; i++) {
|
||||
if (event.results[i].isFinal && event.results[i][0].confidence) {
|
||||
transcript += event.results[i][0].transcript;
|
||||
}
|
||||
}
|
||||
dispatch(setMessage(initialMessage + ' ' + transcript));
|
||||
};
|
||||
|
@ -279,4 +281,4 @@ export default function MessageInput(props: MessageInputProps) {
|
|||
</div>
|
||||
</div>
|
||||
</Container>;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue