# SDKERR\_WRONG\_USEAGE on Pin video

**URL:** <https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681>\
**Category:** Android\
**Created:** [September 29, 2022, 7:23am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681 "2022-09-29T07:23:00Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [September 29, 2022, 7:23am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/1 "2022-09-29T07:23:00Z")

</div>

Hi There,

I’m trying tthe o pin meeting participants video, but its working for first time, and when I try to change pinned video, its not working.

I tested this with 2 participants in meeting; both videos are ON. but its not working when trying to switch pinned video.

below is my code for reference.

```auto
    private fun pinUser(userId: Long) {
        val videoController = zoomSdk.inMeetingService.inMeetingVideoController

        val pinId = videoController.pinnedUser
        Log.e(TAG,"Pin > $pinId | ${videoController.isUserPinned(pinId)}")
        if (pinId > 0) {
            mGalleryVideoViewMgr?.removeAttendeeVideoUnit(pinId)
            videoController.pinVideo(false, pinId )
        }

        try {
            var user = zoomSdk.inMeetingService.getUserInfoById(userId).userName
            if (userId == getMyId()) {
                user = "$user (Me)"
            }
            binding.activeUser.text = user
        }catch (e: Exception) {
            e.printStackTrace()
        }

        val status = videoController.pinVideo(true, userId)
        mGalleryVideoViewMgr?.addAttendeeVideoUnit(userId, renderInfo)
        Log.e(TAG,"PIN > ${status.name}")
    }

```

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [September 29, 2022, 7:43pm UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/2 "2022-09-29T19:43:29Z")

</div>

Hi, @jovy,

Can you share what version of the SDK you are using in your testing?

---

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [September 30, 2022, 4:47am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/3 "2022-09-30T04:47:57Z")

</div>

Hi @donte.zoom

Zoom SDK version is 5.11.3.7251

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [September 30, 2022, 11:57am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/4 "2022-09-30T11:57:44Z")

</div>

Thank you @jovy ! Are you seeing any errors? What is happening when the second participant is pinned? Have you stepped through the function and verified the expected values are being used? Also, is this only happening when there are two participants, have you tested with more than two participants?

---

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [September 30, 2022, 3:26pm UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/5 "2022-09-30T15:26:25Z")

</div>

Hi Donte,

There is no error msg. It only able to one time.  
I have 3 people in the call. First, I pinned A, then change to pin B. I pinned A again, then it is not switching. It still pinning B without any error msg

Thanks

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [September 30, 2022, 8:34pm UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/6 "2022-09-30T20:34:52Z")

</div>

@jovy ,

Have you verified that the userID for A is being used as expected? Sounds like once you pin B, the userID for A is not being used. Can you doubt-check by printing the userID values to confirm?

---

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [October 4, 2022, 3:15am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/7 "2022-10-04T03:15:52Z")

</div>

Hi @donte.zoom  
I have checked logs for the user id, I can see it’s correct also I’m printing the username from the pin user id.  
I printed logs when I switch between pin users,  
for the first time it work, but the second onwards shows an error.  
Please refer below logs

```auto
E/MyMeetingActivity: PIN userName > Jovy
E/MyMeetingActivity: PIN userId > 16780288
E/MyMeetingActivity: PIN status > SDKERR_WRONG_USEAGE
W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.

```

in the last line after SDKERR\_WRONG\_USEAGE, I’m getting _Attempted to finish an input event but the input event receiver has already been disposed._ is it related to the pin user?

Please check and let me know if you can find something for this issue. Also please note that we got this issue only after updating zoom SDK to 5.11.3.7251 , before this function was working fine.  
Also, the video of all users which I tried to pin is ON.

---

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [October 12, 2022, 2:02pm UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/8 "2022-10-12T14:02:03Z")

</div>

Hi

I would like to follow up this topic

thanks

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [October 12, 2022, 7:39pm UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/9 "2022-10-12T19:39:30Z")

</div>

@jovy,

Thank you for following up on this topic. I reached out internally to get some additional feedback on the behavior you’ve reported and it looks like you’re calling pinVideo twice with the same userId value within that method, that could be one issue.

To verify the pinned user is being removed, can you add a log call inside of the if statement? This will help determine whether the pin was successful and also ensure the expected behavior of the pinning feature is working as expected:

```auto
tif (pinId > 0) {
            // Add a log of the pinID here

            mGalleryVideoViewMgr?.removeAttendeeVideoUnit(pinId)
            videoController.pinVideo(false, pinId )
        }

        try {
            var user = zoomSdk.inMeetingService.getUserInfoById(userId).userName
            if (userId == getMyId()) {

             // Add another log for the userId here
                user = "$user (Me)"
            }

```

---

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [October 13, 2022, 2:57am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/10 "2022-10-13T02:57:27Z")

</div>

Hi @donte.zoom

I’m not calling pinUser id 2 times, actually, here `videoController.pinVideo(false, pinId)` I’m trying to unpin existing pined user first, but from line `val pinId = videoController.pinnedUser` I’m trying to get pinned user, but it always returns id = 0

Please check below logs for reference

```auto
E/ParticipantsFragment: select Jovy / 16779264

E/MyMeetingActivity: Current Pinned user: 0 //log of the pinID 
E/MyMeetingActivity: New Pin id PIN > 16779264 // log for the userId

E/MyMeetingActivity: Pin status SDKERR_WRONG_USEAGE
W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
E/MyMeetingActivity: onUserVideoStatusChanged: 16779264 | Video_ON

```

For the above logs, it worked for the first time when I switch between users. after execution, I notice `onUserVideoStatusChanged` gets executed, but when I try to change pinned user for the second time onwards, it’s not working.  
below are the logs when the pin user did not work

```auto
E/ParticipantsFragment: select Jovy Chiu / 16780288

E/MyMeetingActivity: Current Pinned user: 0 //log of the pinID 
E/MyMeetingActivity: New Pin id PIN > 16780288 // log for the userId

E/MyMeetingActivity: Pin status SDKERR_WRONG_USEAGE

```

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [October 13, 2022, 5:09am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/11 "2022-10-13T05:09:32Z")

</div>

@jovy ,

> [@jovy](#):
>
> but from line `val pinId = videoController.pinnedUser` I’m trying to get pinned user, but it always returns id = 0

What value is returned for the pinned User if you call the getPinnedUser method?

```
val pinId = videoController.getPinnedUser()

```

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/8/0/80c4efaacd7948d80daebf305986470bbb486cdf.png)

# getPinnedUser

> **[InMeetingVideoController (Zoom.us SDK API Document)](https://marketplacefront.zoom.us/sdk/meeting/android/us/zoom/sdk/InMeetingVideoController.html#getPinnedUser())**
>
> declaration: package: us.zoom.sdk, interface: InMeetingVideoController

---

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [October 13, 2022, 5:52am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/12 "2022-10-13T05:52:54Z")

</div>

Hi @donte.zoom

`videoController.getPinnedUser()` and ` videoController.pinnedUser` is same function,  
we write `getPinnedUser()` in java and `pinnedUser` in kotlin.

It returns value 0

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [October 13, 2022, 4:08pm UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/13 "2022-10-13T16:08:36Z")

</div>

Thanks for the clarification @jovy. I" ve reached out to internally resources and will follow up with what I learn.

---

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [October 19, 2022, 1:32pm UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/14 "2022-10-19T13:32:18Z")

</div>

Hi Donte

good day  
May I follow up this

thanks

---

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [November 1, 2022, 3:36am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/15 "2022-11-01T03:36:14Z")

</div>

Hi Donte,

Would like to check if you have any news

Thanks

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [November 2, 2022, 2:37am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/16 "2022-11-02T02:37:58Z")

</div>

@jovy,

Thanks for following up, there is no update. More to follow as information becomes available.

---

<div class="post-metadata">

**Author:** ![jovy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jovy/32/55248_2.png) [@jovy](https://devforum.zoom.us/u/jovy)\
**Post date:** [November 30, 2022, 7:52am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/17 "2022-11-30T07:52:47Z")

</div>

Hi @donte.zoom

I finally fixed this error after many attempts.

I made it work after removing all attendee videos and then adding videos for the selected user id.

````auto
    private fun pinUser(userId: Long) {

        val videoController = zoomSdk.inMeetingService.inMeetingVideoController

        mGalleryVideoViewMgr?.removeAllVideoUnits()

        try {
            var user = zoomSdk.inMeetingService.getUserInfoById(userId).userName
            if (userId == getMyId()) {
                user = "$user (Me)"
            }
            binding.activeUser.text = user
        }catch (e: Exception) {
            e.printStackTrace()
        }

        val status = videoController.pinVideo(true, userId)
        mGalleryVideoViewMgr?.addAttendeeVideoUnit(userId, renderInfo)
        Log.e(TAG,"New Pin id PIN > $userId")
        Log.e(TAG,"Pin status ${status.name}")
    }```
````

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [December 22, 2022, 9:14pm UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/18 "2022-12-22T21:14:19Z")

</div>

@jovy ,

Glad you hear you were able to resolve the behavior you were seeing and thank you for posting the solution as it will be of great benefit to other community members.

Happy Coding !

---

<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:** [January 22, 2023, 7:14am UTC](https://devforum.zoom.us/t/sdkerr-wrong-useage-on-pin-video/76681/19 "2023-01-22T07:14:31Z")

</div>

Closed on January 22, 2023, 7:14am UTC

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