Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

i am currently implementing speech input on a website and using the web speech API for it.

voice recognition works as expected in Chrome on desktop and android. Firefox does not have support for the API so it is not being used there.

the problem is with chrome on iOS where the service throws a "service-not-allowed" error.

this error seems to be distinctly different from the "not-allowed" error that is being thrown when the browser does not have permission to use the microphone.

in my case chrome has all permissions it would need (microphone permission, pop-ups are not blocked).

at first i thought the problem was, that for some reason chrome on iOS does not show me the permission pop-up, specifically for microphone usage, directly on the web page, but now i am not so sure anymore.

does anyone have experience with this problem or have a solution for this?

here is the working code for android/desktop, the function gets triggered by a button click:

function startDictation() {
    try {
        var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition;
        var recognition = new SpeechRecognition();
    } catch (e) {
        console.log(e);
    if (recognition) {
        recognition.continuous = false;
        recognition.interimResults = true;
        recognition.lang = $('html').attr('lang');
        recognition.start();
        recognition.onresult = function(e) {
            $('#searchInput').val(e.results[0][0].transcript);
            console.log(e.results[0][0].transcript);
        recognition.onerror = (e) => {
            console.error('Speech recognition error detected: ' + e.error);
            recognition.stop();
        recognition.onend = () => {
            console.log('Speech recognition service disconnected');

a few helpful links

  • web speech api error values
  • web speech api demo from google, that also doesn't work on iOS for me
  • i have tried various end devices at this point, two different iPads and an iPhone and the same error gets thrown everywhere.

    any help is appreciated, thanks!

    Looking at the docs, there's a number of reasons why the error would show up. Can you test your code in Safari iOS, just to see if it would fail there as well? If it doesn't, then it's something Chrome related. If it does, then it might be something iOS related. – FiddlingAway Feb 15 at 15:44 @FiddlingAway the code works fine in Safari iOS, it's the particular combination of Chrome + iOS that fails, so it does seem to be an iOS issue to me – adhena Feb 16 at 10:54

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.