How to get user user's screen size? (to draw things)

Hi there,

Is there a way to get the current user’s screen size via Zoom Apps SDK?

We are trying use setVirtualForeground SDK method. However, in order to properly draw we need to know the user’s screen size. A method that gives us that info (onMyMediaChange) is only triggered on changes. If the user does not “change their media” after the app is launched the method is never triggered.

There seem to exist getUserMediaVideo method, but looks like it was disabled?


To be clear, are you looking to get the size of the user’s video, or the size of the Zoom App window or the size of the users desktop screen?

If you want to get the size of the Zoom App window you can use the window.innerWidth and window.innerHeight values multiplied by the devicePixelRatio.

I have an example of this in the custom layout sample app

To get the available size of the screen please see this stack overflow doc:

Unfortunately, we don’t have a method to get the size of the user’s video unless you’re using immersive mode and you set the placement and size of the participants videos. However, that is shown in the sample app linked above.

@MaxM we need to know the size of the user’s video. setVirtualForeground method draws on top of the user’s video. Without knowing the user’s screen size we cannot draw over the whole area :frowning:

I believe getUserMediaVideo is what we need, but for some reason it was disabled in the sdk?

Does the GetVideoState function work for your use case? The video object should include the height and width of the user’s video.

No, it only returns a boolean if the video is on or off :frowning:

Looking at the sample - devicePixelRatio doesn’t seem to be defined anywhere. Is this some kind of magic/well known value? I’ve seen it referred to in the docs but it wasn’t super clear to me.