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

**URL:** <https://devforum.zoom.us/t/how-to-get-user-users-screen-size-to-draw-things/87912>\
**Category:** Zoom Apps\
**Created:** [May 5, 2023, 7:29pm UTC](https://devforum.zoom.us/t/how-to-get-user-users-screen-size-to-draw-things/87912 "2023-05-05T19:29:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eugenem](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/eugenem/32/39086_2.png) [@eugenem](https://devforum.zoom.us/u/eugenem)\
**Post date:** [May 5, 2023, 7:29pm UTC](https://devforum.zoom.us/t/how-to-get-user-users-screen-size-to-draw-things/87912/1 "2023-05-05T19:29:32Z")

</div>

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [May 10, 2023, 5:19pm UTC](https://devforum.zoom.us/t/how-to-get-user-users-screen-size-to-draw-things/87912/2 "2023-05-10T17:19:56Z")

</div>

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

> <https://github.com/zoom/zoomapps-customlayout-js/blob/28aff71df50c5e55a2a72c5030a206d5276a8b18/public/js/index.js#L114-L115>

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

> <https://stackoverflow.com/questions/2242086/how-to-detect-the-screen-resolution-with-javascript/2242100#2242100>

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.

---

<div class="post-metadata">

**Author:** ![eugenem](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/eugenem/32/39086_2.png) [@eugenem](https://devforum.zoom.us/u/eugenem)\
**Post date:** [May 10, 2023, 6:00pm UTC](https://devforum.zoom.us/t/how-to-get-user-users-screen-size-to-draw-things/87912/3 "2023-05-10T18:00:25Z")

</div>

@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 ☹

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

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [May 11, 2023, 7:18pm UTC](https://devforum.zoom.us/t/how-to-get-user-users-screen-size-to-draw-things/87912/4 "2023-05-11T19:18:41Z")

</div>

Does the [GetVideoState](https://appssdk.zoom.us/classes/ZoomSdk.ZoomSdk.html#getVideoState) function work for your use case? The video object should include the height and width of the user’s video.

---

<div class="post-metadata">

**Author:** ![eugenem](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/eugenem/32/39086_2.png) [@eugenem](https://devforum.zoom.us/u/eugenem)\
**Post date:** [May 11, 2023, 10:28pm UTC](https://devforum.zoom.us/t/how-to-get-user-users-screen-size-to-draw-things/87912/5 "2023-05-11T22:28:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sam2](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@sam2](https://devforum.zoom.us/u/sam2)\
**Post date:** [May 12, 2023, 12:47pm UTC](https://devforum.zoom.us/t/how-to-get-user-users-screen-size-to-draw-things/87912/6 "2023-05-12T12:47:20Z")

</div>

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.
