# Cannot run stream.adjustRenderedVideoPosition right after connecting

**URL:** <https://devforum.zoom.us/t/cannot-run-stream-adjustrenderedvideoposition-right-after-connecting/60306>\
**Category:** Web\
**Created:** [November 16, 2021, 12:20pm UTC](https://devforum.zoom.us/t/cannot-run-stream-adjustrenderedvideoposition-right-after-connecting/60306 "2021-11-16T12:20:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![simkin](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/simkin/32/31663_2.png) [@simkin](https://devforum.zoom.us/u/simkin)\
**Post date:** [November 16, 2021, 12:20pm UTC](https://devforum.zoom.us/t/cannot-run-stream-adjustrenderedvideoposition-right-after-connecting/60306/1 "2021-11-16T12:20:11Z")

</div>

**Description**  
When my video client connects and other users are already in the room,  
I want to display their camera streams, of course.  
If I get more than 1 user, I’ll want to rearrange the video position on canvas.  
PROBLEM  
if there are 2+ streams already running when a new client joins, that new  
client will have to run stream.adjustRenderedVideoPosition

However, doing so right after connecting results in an error.  
\*\*Only after the console says \*\*  
**Open\_Audio\_WebSocket\_Connect**  
**consume interval 3**  
**does it work.**  
**Is there a way for me to detect that?**

**Browser Console Error**  
here is the error that’s caught attempting to run stream.adjustRenderedVideoPosition

```auto
reason: "userId is not correct"
type: "INVALID_PARAMETERS"

```

The thing is, after the console says

```auto
http://localhost:8081/public/zoomlib/video_mtsimd.min.js
js_media.min.js:1 sharing decode fileURL: http://localhost:8081/public/zoomlib/sharing_mtsimd.min.js
ready to start!
ready to start!
ready to dec video!
ready to dec video!
Open_Sharing_WebSocket_Connect
Open_Sharing_WebSocket_Connect
Open_Video_WebSocket_Connect
Open_Video_WebSocket_Connect
JsAudioDec.js receive startMedia
JsAudioDec.js receive startMedia
Open_Audio_WebSocket_Connect
Open_Audio_WebSocket_Connect
consume interval 3

```

the same code runs without problems.

**Which Web Video SDK version?**  
1.1.5

**Video SDK Code Snippets**  
The code snippets that are causing the error / issue so we can reproduce.  
(running VueJS)

```auto
            initClient() {
                this.client = ZoomVideo.createClient();
                this.client.init('en-US', window.location.origin + '/public/zoomlib');
                this.addClientEventHandlers();
            },

```

```auto
                this.initClient();
                let signature = await this.fetchToken();

                this.client.join(this.topic, signature, this.username, this.password)
                .then( async (data) => {
                    // this.addClientEventHandlers();
                    this.stream = this.client.getMediaStream();
                    this.chat = this.client.getChatClient();
                    this.ses.info = this.client.getSessionInfo();

                })
                .catch((error) => {

                });

```

from here: client.on(‘user-updated’)  
if new user to render \> start render  
right after render, I call stream.adjustRenderedVideoPosition  
with the correct coordinates

**To Reproduce(If applicable)**

**Screenshots**  
If applicable, add screenshots to help explain your problem.

**Device (please complete the following information):**

- Device: Mac Mini, PC, Macbook, other PC
- OS: MacOS11, Windows 10
- Browser: Chrome
- Browser Version 95

**Additional context**  
Add any other context about the problem here.

---

<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:** [November 19, 2021, 7:36am UTC](https://devforum.zoom.us/t/cannot-run-stream-adjustrenderedvideoposition-right-after-connecting/60306/2 "2021-11-19T07:36:15Z")

</div>

Hey @simkin

Thanks for your feedback.

`stream.adjustRenderedVideoPosition` should be invoked after the video is rendered, when joining a session, the VideoSDK will establish multiple data channels (audio, video, sharing) with the server, it may take a while, so even invoking `stream.renderVideo` right after the connecting, in VideoSDK, it will be held until the data channel connection is established. We provide the `media-sdk-change` event to indicate the accurate timing of initialization.

In the sample project, here are the usage of the `media-sdk-change` event, [sample-app-videosdk/App.tsx at master · zoom/sample-app-videosdk · GitHub](https://github.com/zoom/sample-app-videosdk/blob/master/react-demo/src/App.tsx#L158) and [sample-app-videosdk/useRenderVideo.ts at master · zoom/sample-app-videosdk · GitHub](https://github.com/zoom/sample-app-videosdk/blob/master/react-demo/src/feature/video/hooks/useRenderVideo.ts#L19)

Hope my explanation can help you.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![simkin](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/simkin/32/31663_2.png) [@simkin](https://devforum.zoom.us/u/simkin)\
**Post date:** [November 20, 2021, 8:59am UTC](https://devforum.zoom.us/t/cannot-run-stream-adjustrenderedvideoposition-right-after-connecting/60306/3 "2021-11-20T08:59:00Z")

</div>

> [@vic.yang](#):
>
> media-sdk-change

Vic thank you that was exactly what I needed.  
I imagine I am not the only one who needed this bit of info, so it would  
be very helpful if the SDK reference could be updated with all the  
events available.

Thank you again.

---

<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:** [November 23, 2021, 11:35pm UTC](https://devforum.zoom.us/t/cannot-run-stream-adjustrenderedvideoposition-right-after-connecting/60306/4 "2021-11-23T23:35:29Z")

</div>

Great to hear @simkin !

We will add this to the SDK reference CC @vic.yang .

Thanks,  
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:** [December 24, 2021, 9:36am UTC](https://devforum.zoom.us/t/cannot-run-stream-adjustrenderedvideoposition-right-after-connecting/60306/5 "2021-12-24T09:36:16Z")

</div>

Closed on December 24, 2021, 9:36am UTC

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