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.
Don’t believe it is possible as it handled by system and got inserted as usual text to input
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:
var SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
var recognition = new SpeechRecognition();
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).