I am trying to build a web app that could capture the user's desktop. I found this web api that should do the job perfectly, but I can't seem to make it work. Right now it should be supported both on the latest version of Edge and on Chrome 70 through enabling a flag, but on both browsers if I am looking at the navigator object the getDisplayMedia()
function is not in there. I also tried calling the function, but I get an error saying that it is not a function(which confirms that it is actually not in the navigator). What could be the problem?
Thanks in advance!
edit: Here is my javascript
function na() {
navigator.mediaDevices.getDisplayMedia({
video: {
mandatory: {
chromeMediaSource: 'desktop',
minWidth: 1280,
maxWidth: 1280,
minHeight: 720,
maxHeight: 720
}
}
}).then((stream)=>console.log(stream))
console.log(navigator)
}
na();