getUserMedia() is not allowed in localhost - Safari 11

。_饼干妹妹 提交于 2020-02-19 09:34:39

问题


Trying to call getUserMedia from an insecure document.

I'm testing safari 11 tech preview. Got this error while trying to run basic peer in localhost. Does anyone experience the same or is localhost treated as insecure region in safari 11?

Any flag or settings to allow this in safari? Currently i'm using ngrok to tunnel it via https and accessing in the same machine.


回答1:


Update:

You can now enable this from the Develop menu:

Select Allow Media Capture on Insecure Sites


Original Answer:

Yes, you will need to run it with HTTPS, even with localhost, when using Safari.

Do you see get this error even with an ngrok tunnel using HTTPS?




回答2:


In last version of safari, the option to allow media capture from insecure sites is located directly in the web inspector window :



来源:https://stackoverflow.com/questions/44523609/getusermedia-is-not-allowed-in-localhost-safari-11

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!