Html getUserMedia() 权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17578199/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 10:57:35  来源:igfitidea点击:

getUserMedia() permission denied

htmlwebrtc

提问by egidra

I am trying to test out screen sharing using getUserMedia(). I have Chrome version 28 and the getUserMedia()screen capturing flag enabled, yet I still get permission denied errors.

我正在尝试使用getUserMedia(). 我有 Chrome 版本 28 并getUserMedia()启用了屏幕捕获标志,但我仍然收到权限被拒绝的错误。

On this screen capture demo, I get the following error:

在此屏幕截图演示中,我收到以下错误:

getUserMedia error: NavigatorUserMediaError {code: 1, PERMISSION_DENIED: 1}

getUserMedia 错误:NavigatorUserMediaError {代码:1,PERMISSION_DENIED:1}

While, on this screen capture demo, I get the following demo:

而在这个屏幕截图演示中,我得到了以下演示:

PERMISSION_DENIED. Are you no SSL?

没有权限。你没有SSL吗?

I never got any prompts about sharing when visiting the sites. Why does my browser deny permission to screen share?

访问网站时,我从未收到任何有关共享的提示。为什么我的浏览器拒绝屏幕共享权限?

采纳答案by tom

The second demo you mentioned (this one) works for me on Chrome 28.

你提到的第二个演示(这个)在 Chrome 28 上对我有用。

It sounds like you enabled the flag, but make sure the one called Enable screen capture support in getUserMedia()is enabled in chrome://flags(and that you have restarted Chrome since enabling that).

这听起来像你启用了标志,但要确保那叫一个Enable screen capture support in getUserMedia()处于启用状态chrome://flags(并且自并使该你已经重新启动Chrome浏览)。

回答by Tomas Prado

I had the same permission denied problem.
I solved it simply clicking in

我有同样的权限被拒绝问题。
我只需点击就解决了

Chrome video icon disabled video

Chrome 视频图标禁用视频

And enabling the "Ask me to enable video..." option

并启用“让我启用视频...”选项

Reload page and it will ask again if you want to load the webcam.
That worked for me.

重新加载页面,它会再次询问您是否要加载网络摄像头。
那对我有用。

回答by Sam Dutton

For screen capture with getUserMedia, you need to use HTTPS. (Apologies if you followed a link of mine which didn't have that!)

对于使用 getUserMedia 的屏幕截图,您需要使用 HTTPS。(抱歉,如果您点击了我没有的链接!)

回答by ovunccetin

I faced the same situation and my reason is that the camera is already usedby another page. I closed the page, retry and everything is alright.

我遇到了同样的情况,我的原因是相机被另一个页面使用。我关闭了页面,重试,一切正常。

回答by arthur.sw

I had the same problem, just because I didn't run the webpage from a local server (I was simply opening my html page in chrome through the file system).

我遇到了同样的问题,只是因为我没有从本地服务器运行网页(我只是通过文件系统在 chrome 中打开我的 html 页面)。

Using a basic server like mamp fixed it!

使用像 mamp 这样的基本服务器修复了它!