I'm trying to make the Screen Sharing dialog appear in Chrome, but nothing happens.
I'm using the following code (just to display the dialog, I'll stream the server to the server when it works)
function screenshare() {
navigator.mediaDevices.getUserMedia({
video: {
mandatory: {
chromeMediaSource: 'screen',
maxWidth: 1920,
maxHeight: 1080,
minAspectRatio: 1.77
}
},
audio: false
}, function(stream) {
console.log(stream)
}, function(error) {
console.log(error)
})
}
When I run the function I get the following error:
NavigatorUserMediaError {name: "InvalidStateError", message: "", constraintName: ""}constraintName: ""message: ""name: "InvalidStateError"__proto__: NavigatorUserMediaError
Yes, I already have an extension configured and installed in Chrome.
Can anyone help?
Thank you!