16
votes

Currently, the HTML5 web speech api works great on google chrome for all devices except mobile iOS. Text-to-speech works, but speech-to-text is not supported. webkitSpeechRecognition is not supported. See: Chrome iOS webkit speech-recognition

I am unable to find a workaround. I would like to add speech recognition support for iOS to my current web app that uses speech recognition and speech synthesis. Any suggestions? Thank you.

1
I know it is not straightforward, but you may have a look at github.com/syl22-00/pocketsphinx.jsFlorent
I'm having the same issue, any info on when iOS would eventually support this feature would be welcome.Diego Pamio

1 Answers

0
votes

Try something like this

recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.msSpeechRecognition)();
recognition.lang = "en-US";
recognition.interimResults = false;
recognition.maxAlternatives = 5;
recognition.onresult = function(event) {
  speechResults = event.results[0][0].transcript;
};
recognition.start();

The way the recognition variable is setup allows support for a variety of browsers. I made a Weave at LiveWeave.