Deploy webrtc on rpi 4

hello i try to deploy a angular server on a rpi4 but i have a problem with a webrtc feature
but when i deploy my server i have an error “navigator.mediaDevices” is undifined

FROM balenalib/%%BALENA_ARCH%%-node:14-buster-run

WORKDIR /usr/src/app

RUN npm install -g angular-http-server

COPY . ./

CMD ["npm", "run", "start:prod"]

my command in package.json :
"start:prod": "angular-http-server --path dist/front"

Do you have any idea
i can send you more information

Hi thomiyi

Have you allowed the browser to use your camera in the settings for webrtc?

Do you see undefined in a simple html/js page, without angular if you enter something like this?

async function getMedia(constraints) {
let stream = null;

try {
stream = await navigator.mediaDevices.getUserMedia(constraints);
/* use the stream /
} catch (err) {
/
handle the error */
}
}

It should only work with https or localhost otherwise will error, you can test if this is the issue with:
chrome://flags/#unsafely-treat-insecure-origin-as-secure
or this: Enabling the Microphone/Camera in Chrome for (Local) Unsecure Origins | by Scott Carmichael | Medium

Do you know which webrtc adapter you are using? GitHub - webrtc/adapter: READ ONLY FORK: Shim to insulate apps from spec changes and prefix differences. Latest adapter.js release:

yes it work localy

i have this :

let stream = await navigator.mediaDevices.getUserMedia({video: true});
    stream.getTracks().forEach(track => {
      screen.pc.addTrack(track, stream)
    });

maybe it’s because i don’t use https, but how can i activate it?

Hi
That’s good it works locally.
Do you have the PUBLIC DEVICE URL enabled in the dashboard? That should be https…
Did you add that URL to cors whitelist?

I can Send you the public IP tomorow
An what whitelist?
I have cors whitelist on my nodejs server and it works well, angular and nodejs communicate When it deploy

Hi you may need add *.balena-cloud.com to your allowlist Network Setup on balenaOS - Balena Documentation.
Let me know if that resolves it.

Hi
Did you get your webrtc setup to work with public IP?
Thanks!