# Customize rendered video dimension in attachVideo()

**URL:** <https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500>\
**Category:** Web\
**Tags:** video-sdk\
**Created:** [March 26, 2024, 3:12am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500 "2024-03-26T03:12:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![shi88.andy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shi88.andy/32/55545_2.png) [@shi88.andy](https://devforum.zoom.us/u/shi88.andy)\
**Post date:** [March 26, 2024, 3:12am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/1 "2024-03-26T03:12:37Z")

</div>

We were able to render 1:1 ratio by modifying the sender resolution to `720x720` but this become a problem, sometime zoom-sdk downgrade the video resolution to 360, and on 16:9 ratio, our default is 1:1, this cause inconsistency.

my question is, is there a way to set width and height of rendered video in `attachVideo()` method? regardless of the ratio of video the sender sent.  
@vic.yang

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [March 26, 2024, 5:37am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/2 "2024-03-26T05:37:24Z")

</div>

Hey @shi88.andy

Thanks for your feedback.

It depends on the style of the video-player (returned by `attachVideo()`). If you want to restrict it to 1:1, I suggest setting its style with the `aspect-ratio: 1` property.

> **[aspect-ratio - CSS: Cascading Style Sheets | MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio)**
>
> The aspect-ratio CSS property allows you to define the desired width-to-height ratio of an element's box. This means that even if the parent container or viewport size changes, the browser will adjust the element's dimensions to maintain the...

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![shi88.andy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shi88.andy/32/55545_2.png) [@shi88.andy](https://devforum.zoom.us/u/shi88.andy)\
**Post date:** [March 26, 2024, 6:06am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/3 "2024-03-26T06:06:55Z")

</div>

just tested by setting the `<video-player/>` css `aspect-ratio` , it still renders the ratio that the sender sent.

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [March 26, 2024, 6:32am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/4 "2024-03-26T06:32:33Z")

</div>

Hey @shi88.andy

Did you set the `originalRatio` option when calling `stream.startVideo` method on the sender side?

If the sender cannot maintain a 1:1 aspect ratio but requires the receiver to render it as 1:1, currently, this cannot be achieved because changing the aspect ratio will result in video cropping or distortion, which is not the expected behavior.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![shi88.andy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shi88.andy/32/55545_2.png) [@shi88.andy](https://devforum.zoom.us/u/shi88.andy)\
**Post date:** [March 26, 2024, 8:34am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/5 "2024-03-26T08:34:19Z")

</div>

> [@vic.yang](#):
>
> e sender can

yep we did set that it’ll stay on 1:1 ratio on first few minutes, after sometime sdk usually drop our resolution down.  
The issue is sometime there’s a warning from the sdk that it drops our resolution from 720p (which we initially send on 1:1 ratio) to 360 (becomes 16:9 out of our control). This is the case that we’re not 100% sure how to handle.

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [March 26, 2024, 8:51am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/6 "2024-03-26T08:51:13Z")

</div>

Hey @shi88.andy

Could you share some sessionId with us for troubleshooting purposes?

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![shi88.andy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shi88.andy/32/55545_2.png) [@shi88.andy](https://devforum.zoom.us/u/shi88.andy)\
**Post date:** [March 26, 2024, 9:05am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/7 "2024-03-26T09:05:42Z")

</div>

here’s the one that we just did L19M3ML9S8m2Q7c3BLlMRg==

---

<div class="post-metadata">

**Author:** ![shi88.andy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shi88.andy/32/55545_2.png) [@shi88.andy](https://devforum.zoom.us/u/shi88.andy)\
**Post date:** [March 26, 2024, 9:08am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/8 "2024-03-26T09:08:40Z")

</div>

and about this, actually it’ll be really helpful if we can send 16:9, and let receiver able to render 1:1 or 16:9 at will.  
We need 1:1 when on small video mode, while going 16:9 on fullscreen mode.

Is this not possible?

---

<div class="post-metadata">

**Author:** ![shi88.andy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shi88.andy/32/55545_2.png) [@shi88.andy](https://devforum.zoom.us/u/shi88.andy)\
**Post date:** [March 27, 2024, 7:25am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/9 "2024-03-27T07:25:05Z")

</div>

re:  
`If the sender cannot maintain a 1:1 aspect ratio but requires the receiver to render it as 1:1, currently, this cannot be achieved because changing the aspect ratio will result in video cropping or distortion, which is not the expected behavior. `

IMO the sdk should allow client to render however it wants, wether it’ll be cropped or not, we were using twilio before and was able to easily render 1:1 on small video, then go to 16:9 ratio for fullscreen. This ratio lock could force us to change the UI, and I don’t think it’ll be just us using it this way. There should at least be a way to get `attachVideo` method to render on custom width/height.

@vic.yang

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [March 27, 2024, 7:44am UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/10 "2024-03-27T07:44:08Z")

</div>

Hey @shi88.andy

> L19M3ML9S8m2Q7c3BLlMRg==

We analyzed this session, and indeed, it initially captured video at a 1:1 aspect ratio. However, after some time, upon evaluating that the device performance was sufficient, we upgraded the capture resolution and changed the aspect ratio. This is indeed an issue, and we will fix it in a future release.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [April 26, 2024, 5:45pm UTC](https://devforum.zoom.us/t/customize-rendered-video-dimension-in-attachvideo/106500/11 "2024-04-26T17:45:06Z")

</div>

Closed on April 26, 2024, 5:45pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
