Navigator.getUserMedia() deprecated

Hey there,

Im trying to build a face-ai in the browser and it worked on my local network but when I try to run it on my raspberry PI it says the Navigator.getUserMedia() is deprecated. I know there is a method called MediaDevices.getUserMedia but I honestly have 0 idea how to implement it.

Code:
const video = document.getElementById(‘video’)

Promise.all([
faceapi.nets.tinyFaceDetector.loadFromUri(’/models’),
faceapi.nets.faceLandmark68Net.loadFromUri(’/models’),
faceapi.nets.faceRecognitionNet.loadFromUri(’/models’),
faceapi.nets.faceExpressionNet.loadFromUri(’/models’),
]).then(startVideo)

function startVideo() {
navigator.getUserMedia(
{ video: {} },
stream => video.srcObject = stream,
err => console.error(err)
)
}

Hi @DevJoris,

Here’s a reference for you to get started!:

2 Likes

And here is the reference for the deprecated Navigator.getUserMedia() which points to the [ MediaDevices.getUserMedia() suggested by @khalby786

1 Like