导航器 MediaDevices getUserMedia "Permission denied"
Navigator MediaDevices getUserMedia "Permission denied"
我在使用此代码时遇到 getUserMedia 问题,想让 UserMedia 显示本地摄像头。
navigator
.mediaDevices
.getUserMedia({video: true, audio: true})
.then(stream => {
console.log("success!")
})
.catch(e => {
console.log("e: ", e);
});
当我在 http://localhost(:9000) 时:得到“成功!”
但是当我在线时 https://mydomaine.com:443 得到 e: DOMException: Permission denied
并且没有提示相机设置
!
- 我的 SSL 认证似乎很酷:Security overview from Chrome
- 我的网站相机选项没问题(询问模式):Chrome settings
我的 chrome v. 81.0.4044.129(64 位),我在 Windows 10.
适用于 Firefox(桌面和移动)和 Edge!
注意:在 Whosebug 上的 chrome 控制台中尝试了这一行:有效!
我的应用程序是 运行 Spring Boot(它是一个 Jhispter 应用程序),当我在 chrome 控制台上测试前一行时它不起作用。我尝试使用相同的 Keystore 文件在 Tomcat 服务器上 运行 测试应用程序,再试一次就成功了。也许我的 Spring 启动应用程序有问题?
这是我的 app.yml 在我的 Spring 启动应用程序
中用于 SSL 的配置文件
server:
port: 443
ssl:
key-store: classpath:config/tls/keystore.p12
key-store-password: password
key-store-type: PKCS12
这是我的第一个问题,如果我做错了什么请告诉我!
JHipster 作为限制性 feature policy configured by default. No access to camera or microphone is allowed。您应该根据需要设置值。
我在使用此代码时遇到 getUserMedia 问题,想让 UserMedia 显示本地摄像头。
navigator
.mediaDevices
.getUserMedia({video: true, audio: true})
.then(stream => {
console.log("success!")
})
.catch(e => {
console.log("e: ", e);
});
当我在 http://localhost(:9000) 时:得到“成功!”
但是当我在线时 https://mydomaine.com:443 得到 e: DOMException: Permission denied
并且没有提示相机设置
!
- 我的 SSL 认证似乎很酷:Security overview from Chrome
- 我的网站相机选项没问题(询问模式):Chrome settings
我的 chrome v. 81.0.4044.129(64 位),我在 Windows 10.
适用于 Firefox(桌面和移动)和 Edge!
注意:在 Whosebug 上的 chrome 控制台中尝试了这一行:有效!
我的应用程序是 运行 Spring Boot(它是一个 Jhispter 应用程序),当我在 chrome 控制台上测试前一行时它不起作用。我尝试使用相同的 Keystore 文件在 Tomcat 服务器上 运行 测试应用程序,再试一次就成功了。也许我的 Spring 启动应用程序有问题? 这是我的 app.yml 在我的 Spring 启动应用程序
中用于 SSL 的配置文件server:
port: 443
ssl:
key-store: classpath:config/tls/keystore.p12
key-store-password: password
key-store-type: PKCS12
这是我的第一个问题,如果我做错了什么请告诉我!
JHipster 作为限制性 feature policy configured by default. No access to camera or microphone is allowed。您应该根据需要设置值。