gpt4 book ai didi

firefox - 导航器 MediaDevices getUserMedia notAllowedError

转载 作者:行者123 更新时间:2023-12-04 15:42:18 26 4
gpt4 key购买 nike

我突然得到一个 navigator.MediaDevices.getUserMedia notAllowedError 我不是一个月前。没有代码改变。我正在使用火狐 68.01。当我在 AWS 上运行文件时会出现问题,但在本地运行时不会出现问题。我刷新了 Firefox,但这没有帮助。以安全模式启动无效。就像我说的那样,这以前工作正常并且可以在本地工作,但不能在服务器上工作。我该如何解决这个问题?

“当前上下文中的用户代理或平台不允许该请求”

最佳答案

getUserMedia 现在即使在 Firefox 中也需要安全连接 (https)。

在 Firefox 68 中,这表现为 NotAllowedError,直到最近 Chrome 都是这样工作的。

从 Firefox 69 开始,getUserMedia 方法将在不安全的连接 (http) 中完全消失,匹配 spec以及 Chrome 目前的工作方式。

http://localhost 应该仍然有效,因为它现在被认为是安全的。

来自 this Mozilla blog :

Firefox 68 behavior

In Firefox 68, getUserMedia will still be there, but the promise returned from it will always be rejected with NotAllowedError, while enumerateDevices will continue to work until Firefox 69. This matches how Chrome has worked for a good while (pre Chrome 74), and should be highly web compatible. It is an intermediate stepping stone to Firefox 69.

Firefox 69 behavior

In Firefox 69, both getUserMedia and enumerateDevices will throw TypeError. This matches how Chrome 74+ and the the spec now work.

It is worth pointing out that this TypeError exception will come from the absence of the navigator.mediaDevices object in insecure contexts—or, if callbacks are used, the absence of the deprecated navigator.mozGetUserMedia function. Any JavaScript that doesn’t test for this before invoking navigator.mediaDevices.getUserMedia() will get an immediate exception thrown instead of merely having its promise rejected. Compared to Firefox 68, this might affect surrounding code, hence the two-step process.

关于firefox - 导航器 MediaDevices getUserMedia notAllowedError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57419954/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com