# Blank video getting rendered on toglling video

**URL:** <https://devforum.zoom.us/t/blank-video-getting-rendered-on-toglling-video/69115>\
**Category:** Web\
**Created:** [May 17, 2022, 2:34pm UTC](https://devforum.zoom.us/t/blank-video-getting-rendered-on-toglling-video/69115 "2022-05-17T14:34:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [May 17, 2022, 2:34pm UTC](https://devforum.zoom.us/t/blank-video-getting-rendered-on-toglling-video/69115/1 "2022-05-17T14:34:30Z")

</div>

Hey @tommy ,

We are using single canvas to render all videos, but sometimes blank videos are getting rendered **when we toggle video few times** and we are getting following error messages in browser console after few seconds when this happens:

`A VideoFrame was garbage collected without being closed. Applications should call close() on frames when done with them to prevent stalls.`

Camera does gets started but rendered video is blank.

**Browser Console Error**  
`A VideoFrame was garbage collected without being closed. Applications should call close() on frames when done with them to prevent stalls.`

**Which Web Video SDK version?**  
1.2.3

**Screenshots**  
 ![Screenshot 2022-05-17 at 12.57.09 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/a/b/ab9965ea718ea84b7cbf5244088fabb75bfa7e19.png)

**Device:**

- Device: Macbook Pro
- OS: macOS 11
- Browser: Chrome
- Browser Version: 101.0.4951.64 (Official Build) (x86\_64)

**Additional context**  
Its not happening always, but just wanted to share it with you because we’re not sure if its an issue in Zoom SDK or something from our side.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 17, 2022, 3:40pm UTC](https://devforum.zoom.us/t/blank-video-getting-rendered-on-toglling-video/69115/2 "2022-05-17T15:40:36Z")

</div>

Hey @shoaib ,

If the `startVideo()` promise does not resolve before you toggle the video this error could be thrown.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [May 18, 2022, 7:06pm UTC](https://devforum.zoom.us/t/blank-video-getting-rendered-on-toglling-video/69115/3 "2022-05-18T19:06:35Z")

</div>

Okay, and currently we are checking `bVideoOn` property of users to call `stream.renderVideo()` as done in demo app [here](https://github.com/zoom/sample-app-videosdk/blob/1f512342bcf384e1ee37ff213f450af080c82de3/react-demo/src/feature/video/hooks/useGalleryLayout.ts#L48) and then [here](https://github.com/zoom/sample-app-videosdk/blob/1f512342bcf384e1ee37ff213f450af080c82de3/react-demo/src/feature/video/hooks/useRenderVideo.ts#L45), Is it the best practice you would recommend to render videos?

Because it seems like `bVideoOn` property get sets to `true` before even resolution of `startVideo()` promise, resulting in calling of `stream.renderVideo()` before completion of `startVideo()` promise, Can it cause any issues?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 18, 2022, 8:31pm UTC](https://devforum.zoom.us/t/blank-video-getting-rendered-on-toglling-video/69115/4 "2022-05-18T20:31:07Z")

</div>

Hey @shoaib ,

For rendering other participant’s videos, the best “call back” is actually the event listener `peer-video-state-change` event listener.

> **[Video](https://marketplace.zoom.us/docs/sdk/video/web/essential/video/)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

> **[@zoom/videosdk](https://marketplacefront.zoom.us/sdk/custom/web/modules.html#event_peer_video_state_change)**
>
> Documentation for @zoom/videosdk

-Tommy

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [May 19, 2022, 6:30am UTC](https://devforum.zoom.us/t/blank-video-getting-rendered-on-toglling-video/69115/5 "2022-05-19T06:30:46Z")

</div>

Okay, Thanks @tommy!

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 19, 2022, 3:56pm UTC](https://devforum.zoom.us/t/blank-video-getting-rendered-on-toglling-video/69115/6 "2022-05-19T15:56:59Z")

</div>

Welcome! Let me know if you have any more questions! 🙂

-Tommy

---

<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:** [June 19, 2022, 1:57am UTC](https://devforum.zoom.us/t/blank-video-getting-rendered-on-toglling-video/69115/7 "2022-06-19T01:57:21Z")

</div>

Closed on June 19, 2022, 1:57am UTC

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