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