Error while sharing screen via Browser (Chrome and Firefox)

Asked

Viewed 97 times

2

I’m trying to make the Screen Sharing dialog appear in Chrome, but nothing happens.

I am using the following code (Just to display the dialog, I will stream 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’m already configured and installed in Chrome.

Anyone can help?

Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.