SpeechRecognition does not work on Android/Mobile Chrome but does on Desktop?

1.3k Views Asked by At

According to https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API, the Web Speech API should work on Chrome for Android, but it does not. On desktop, it works properly and asks for permissions to use the microphone before listening. Is there a chrome android setting that needs to be configured to use this technology? On Android, it does not even ask for permission, it just immediately denies permissions to location and microphone.

Example of my App is available at: a7-bolt170.herokuapp.com/during_run

Edit: Was looking in the wrong place, I gave the users the URL without an https:// prefix, so Chrome refused to give permissions to hardware. Adding the https:// prefix solved this.

2

There are 2 best solutions below

0
On BEST ANSWER

Chrome locks permissions when you don't use https://, always use https://, kids.

0
On

I don't know anything about Android BUT...

By looking at how it is done on a desktop under Chromium, it'll give you clues as to how to do it on Android:

To set such permissions in Chromium we do this...

chrome.contentSettings.microphone.set({primaryPattern:'<all_urls>',setting:'ask'});  // allow|block|ask

Upon the above being allowed, we then have to set the iframe with the "allow" parameter for multimedia like this example...

YourFrame.setAttribute('allow','microphone; camera;');

I hope this helps because Android can't be too different!