Resolution screensharing

Hello,
Is it possible to set the resolution for videoSource: ‘screen’?
Tried setting resolution in PublisherProperties, but it doesn’t take effect. Is chrome extension an option?

Hi,

Screen sharing doesn’t support changing the resolution by default. Width and height of the video in shouldn’t be changeable in case of screen sharing, as the screen has a specific widht and height.

This doesn’t mean you can’t do it. PublisherProperties are meant to be a simpler way of obtaining a MediaStream from the client, but you can always direclty provide a MediaStreamTrack to audioSource and videoSource properties. So if you are able to get a screen video track changing its resolution, you just have to pass it as videoSource property.

Regards.

1 Like

It works:

const publisherProperties = {
            videoSource: videoSource,
            publishAudio: false,
            publishVideo: true,
            mirror: false
        };
this.openViduScreen.initPublisherAsync(undefined, publisherProperties).then(
            (publisher: Publisher) => {
                publisher.once('accessAllowed', () => {
                    try {
                        publisher.stream.getMediaStream().getVideoTracks()[0].applyConstraints({
                            width: 1280,
                            height: 720
                          })
                    } catch (error) {
                        console.error(` erro na constraint =>`, publisher.stream.getMediaStream().getVideoTracks());
                    }
3 Likes

This is beautiful! Thanks!

2 Likes