[Q] input element -> voice input vs (soft) keyboard


#1

I have a "searchbar" in my app and the user might use the (soft) keyword or voice input (most keyboard offers to opportunity to use the language as well).

Is there a way to detect, if the voice was used? I did not find anything so far looking at the event sequence that is triggered. The length (more than one character added at once) does not help as well, in case of auto completion.

Any ideas?

Best regards
Andreas


#2

Don’t believe it is possible as it handled by system and got inserted as usual text to input


#3

Please check Speech Recognition API browser support

Basically, put button/icon beside search bar, which triggers recognition.onstart function. Simple example here.

just don’t forget to remove button if Speech Recognition API is not supported. Something like:

try {
var SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
var recognition = new SpeechRecognition();
}
catch(e) {
console.error(e);
$(’.speech_rec_button’).hide();
}


#4

Thanks for the feedback,

I already have a mic-icon, but I noticed that someone uses the mic offered by the keyboard leading to an unwanted behaviour…

So, I try to decide based on the input (at least to make a good guess).

Many thanks
Andreas