Navigator MediaDevices getUserMedia "拒绝许可"

问题描述 投票:0回答:1

我在使用这段代码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 而不提示相机设置!

我的chrome v. 81.0.4044.129 (64bit) 和我在Windows 10上。工作在 火狐 (台式机& 移动)和 边缘 !

NB: Tried this lines in chrome console on stackoverflow : works !


我的应用是用Spring Boot运行的(这是一个Jhispter应用),当我在chrome控制台测试前一行时,它没有工作。我试着在Tomcat服务器上使用相同的Keystore文件运行一个测试应用程序,再试一次就可以了。也许是我的Spring引导程序的问题?这是我在Spring引导程序中SSL的app.yml conf。

server:
port: 443
ssl:
    key-store: classpath:config/tls/keystore.p12
    key-store-password: password
    key-store-type: PKCS12

这是我的第一个问题,如果我做错了什么,请告诉我!我正面临着使用这段代码getUserMedia的问题,想让UserMedia显示本地摄像头。

spring-boot google-chrome webrtc jhipster getusermedia
1个回答
0
投票

JHipster作为一个限制性的 特征政策 默认配置。不能访问 可带摄像头或麦克风. 你应该根据自己的需要来设置数值。

© www.soinside.com 2019 - 2024. All rights reserved.