Kerem
Kerem

Reputation: 1553

Google WebSpeech API is throwing 'not-allowed' error for microphone permission

I am using Google's WebSpeech API found on this site: https://developers.google.com/web/updates/2013/01/Voice-Driven-Web-Apps-Introduction-to-the-Web-Speech-API

With Python's http.server on my Windows machine, enter image description here

it works without any problem: enter image description here

I upload exactly same files, same API but it does not work in my CentOS remote server throwing a 'not-allowed' error for the microphone permission: enter image description here

I thought that problem could be http server related. So I tried with Apache Httpd, Python http.server and Nginx. None of them worked.

Any idea about what's blocking the microphone? Thanks!

Upvotes: 6

Views: 7312

Answers (3)

Laila
Laila

Reputation: 31

I experienced not-allowed also - trying to access mic from Chrome inside cross-origin iframe. Resolved by adding allow="microphone;" to the iframe:

<iframe src="mysrc" allow="microphone;"></iframe>

Note: Also required using HTTPS for parent page & iframe page

Reference: https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-permissions-in-cross-origin-iframes

Upvotes: 3

user6269864
user6269864

Reputation:

I've encountered the same issue (throws not-allowed), but I was using HTTPS.

In my case, it turned out that you can't obtain speech or enable microphone access from an iframe. The same code works normally when not shown in an iframe.

Upvotes: 1

alesub
alesub

Reputation: 1492

I couldn't find documentation backing this up, but from my own experience I can confirm that only after installing an SSL certificate on a website, chrome stopped blocking it from requesting microphone access.

Upvotes: 4

Related Questions