# Adjust Rendered Video Position returns Error: User Id is Not Correct

**URL:** <https://devforum.zoom.us/t/adjust-rendered-video-position-returns-error-user-id-is-not-correct/102619>\
**Category:** Web\
**Created:** [January 26, 2024, 12:15pm UTC](https://devforum.zoom.us/t/adjust-rendered-video-position-returns-error-user-id-is-not-correct/102619 "2024-01-26T12:15:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![godwin.owonam](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/godwin.owonam/32/53602_2.png) [@godwin.owonam](https://devforum.zoom.us/u/godwin.owonam)\
**Post date:** [January 26, 2024, 12:15pm UTC](https://devforum.zoom.us/t/adjust-rendered-video-position-returns-error-user-id-is-not-correct/102619/1 "2024-01-26T12:15:27Z")

</div>

**Description**  
I am having an error when I call the mediaStream?.adjustRenderedVideoPosition() method. I called this method when the video element could not be found in the non-shared array buffer Video container. So instead of using the video element to render, I used the canvas element.  
I would appreciate response ASAP. Thanks.

**Browser Console Error**

```auto
Object { type: "INVALID_PARAMETERS", reason: "userId is not correct" }
​
reason: "userId is not correct"
​
type: "INVALID_PARAMETERS"
​

```

**Which Web Video SDK version?**  
1.9.5

**Video SDK Code Snippets**  
Below is a snippet of the code used:

```auto
const startVideoWithCanvas = useCallback(async() => {
        const startVideoOptions = { hd: true };
        if (mediaStream?.isSupportVirtualBackground() && isBlur) {
            Object.assign(startVideoOptions, { virtualBackground: { imageUrl: 'blur' } });
        }

        try {
            await mediaStream?.startVideo(startVideoOptions).catch((err) => {
                message.error('Die Videoaufnahme konnte nicht gestartet werden.');
                setIsCameraDisabled(() => true);
                console.log('217 could not start video');
            });
        } catch (error) {
            console.log(error);
        }

        if (!mediaStream?.isSupportMultipleVideos()) {
            console.log('selfVideoLayout', selfVideoLayout);

            if(!visibleParticipants) {
                return;
            }

            if(!videoRef)
            {
                return;
            }

            const index = visibleParticipants.findIndex(
                (user) => user.userId === zmClient.getCurrentUserInfo().userId
            );

            if (index > selfVideoLayout.length - 1 || index < 0) {
                return;
            }

            console.log('visibleParticipants userId', visibleParticipants[index].userId);
            console.log('currentUserInfo userId', zmClient.getCurrentUserInfo().userId);
            console.log('sessionInfo userId', zmClient.getSessionInfo().userId);

            let dimension = selfVideoLayout[index];
            const { width: w, height: h, x: _x, y: _y } = dimension;
            const { height: canvasHeight } = canvasDimension;

            let width = w;
            let height = h;
            let y = canvasHeight - _y - height;
            let x = _x;

            console.log('w, h, y, x', width, height, x, y);

            try {
                mediaStream?.adjustRenderedVideoPosition(
                    canvasElement,
                    zmClient.getSessionInfo().userId,
                    width,
                    height,
                    x,
                    y
                ).catch(err => {
                    console.log(err);
                });

                mediaStream?.renderVideo(
                    canvasElement, 
                    zmClient.getCurrentUserInfo().userId, 
                    width, 
                    height, 
                    _x, 
                    y, 
                    3
                ).then(() => {
                    console.log('Started video with x at ', _x);
                }).catch((err) => {
                    console.log(err);
                    message.error('Die Videoaufnahme konnte nicht gestartet werden.');
                    setIsCameraDisabled(() => true);
                    console.log('201 could not start video');
                });
            } catch (error) {
                console.log(error);
            }
        }
    }, [canvasDimension, canvasElement, isBlur, mediaStream, selfVideoLayout, videoRef, visibleParticipants, zmClient]);

```

From the console logs above you would notice that the ids returned are the same. But the SDK API returns an error.

---

<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:** [January 28, 2024, 8:28am UTC](https://devforum.zoom.us/t/adjust-rendered-video-position-returns-error-user-id-is-not-correct/102619/2 "2024-01-28T08:28:48Z")

</div>

Hey @godwin.owonam

Thanks for your feedback.

> reason: “userId is not correct”  
> ​  
> type: “INVALID\_PARAMETERS”

Typically, this error occurs when the video has not been rendered yet, but the `stream.adjustRenderedVideoPosition` method is called. This call is ineffective.

In practical scenarios, this error has no other side effects; it simply indicates that adjusting the position or size of the video is invalid.

Perhaps we should consider downgrading the error level to a warning in the next version.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![godwin.owonam](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/godwin.owonam/32/53602_2.png) [@godwin.owonam](https://devforum.zoom.us/u/godwin.owonam)\
**Post date:** [January 29, 2024, 3:44am UTC](https://devforum.zoom.us/t/adjust-rendered-video-position-returns-error-user-id-is-not-correct/102619/3 "2024-01-29T03:44:49Z")

</div>

Thanks @vic.yang

Definitely. The error should be more descriptive. Because this misled me to think there was something wrong with the SDK that it could not recognize the user Id.

Furthermore, I have tried calling this method after calling the renderVideo() method. Perhaps the renderVideo() method did not resolve before the adjustRenderedVideoPosition() executed, but I still got the same error.

Is this me calling it wrongly as well?

---

<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:** [January 29, 2024, 4:20am UTC](https://devforum.zoom.us/t/adjust-rendered-video-position-returns-error-user-id-is-not-correct/102619/4 "2024-01-29T04:20:30Z")

</div>

Hey @godwin.owonam

Correct.

You have to wait for the `renderVideo()` method to get resolved before calling the `stream.adjustRenderedVideoPosition` method.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![godwin.owonam](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/godwin.owonam/32/53602_2.png) [@godwin.owonam](https://devforum.zoom.us/u/godwin.owonam)\
**Post date:** [January 29, 2024, 2:37pm UTC](https://devforum.zoom.us/t/adjust-rendered-video-position-returns-error-user-id-is-not-correct/102619/5 "2024-01-29T14:37:53Z")

</div>

Okay. Thanks. This helped.

---

<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:** [February 29, 2024, 12:38am UTC](https://devforum.zoom.us/t/adjust-rendered-video-position-returns-error-user-id-is-not-correct/102619/6 "2024-02-29T00:38:30Z")

</div>

Closed on February 29, 2024, 12:38am UTC

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