Search code examples
spring-bootgoogle-chromewebrtcjhipstergetusermedia

Navigator MediaDevices getUserMedia "Permission denied"


i'm facing a issue with getUserMedia using this code, wanting to get UserMedia to show local camera.

navigator
.mediaDevices
.getUserMedia({video: true, audio: true})
.then(stream => {
    console.log("success!")
})
.catch(e => {
    console.log("e: ", e);
});

When i'm on http://localhost(:9000) : got "success!" but when i'm online whith https://mydomaine.com:443 got e: DOMException: Permission denied and not prompt for camera settings !

My chrome v. 81.0.4044.129 (64bit) and i'm on Windows 10.
Works on Firefox (desktop & mobile) and Edge !

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


My app is running with Spring Boot (it's a Jhispter app) and when i test previous line on chrome console it doesn't work. I tried to run a test-app on a Tomcat server using same Keystore file, trying again and that's work. Maybe a issue with my Spring boot app ? This is my app.yml conf for SSL in my Spring boot app

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

Is my fisrt issue here, plz let me know if i'm doing something wrong !


Solution

  • JHipster as a restrictive feature policy configured by default. No access to camera or microphone is allowed. You should set the values according to your needs.