How to pin multiple users?

IANAprogrammer, much less a javascript programmer. With that said, I’ve been combing the files in the source code for both jitsi-meet and lib-jitsi-meet for several hours. I’m trying to find a way to pin more than one user at a time (I need to pin both a storyteller and a sign language interpreter). I’ve found lots of interesting bits about getting the current pin state of a user, and toggling pins, but I haven’t been able to figure out having two at once.

I did find https://github.com/pstros/lib-jitsi-meet/pull/12/files but those changes don’t seem to be in master, anymore. I tried to recreate them, myself, only to discover that I didn’t actually know how to actually call the new functions to see if they worked.

Has anyone run into this issue and solved it? Or can point me towards potential solutions that are more up to date than the 2017 pull request? Thanks!

they never were, this change has not been merged into jitsi-meet. I got curious about this and since no dev has bothered to answer, here is my take.
I am almost sure that this possibility is coded at the videobridge level,
I think (not sure) that it is not implemented at the lib-jitsi-meet level
here is the stuff:

    pinEndpoint(id) {
        // Cache the value if channel is missing, till we open it.
        this._pinnedEndpoint = id; 
        if (this._channel && this._channel.isOpen()) {
            this._channel.sendPinnedEndpointMessage(id);
        }
    }   

since this is saved in a variable, not an array, it’s not possible to have several users pinned. So it would be a large change.

To solve this problem I am using

conference.selectParticipants(participantIds);
conference.setLastN(participantIds.length);

Where conference is my instance of JitsiConference. Set Last N is in case you want to limit your client to get video feeds only for those participants. Each client can select a different set of participants, or the same. More information here https://github.com/jitsi/jitsi-videobridge/blob/master/doc/last-n.md

Interesting, thank you! This sent me off into the code for videobridge, where I learned that PinnedEndpointMessage is supposed to be deprecated and no longer used in jitsi-meet, in favour of a PinnedEndpointsMessage that takes an array of values. I’ve tested switching to that and passing in just the one id, and it seems to work. Now I think I need to figure out how to build an array of ids to pass, based on who’s already pinned and adding in the new id for pinning.

    /**
     * A message sent from a client to a bridge, indicating that the list of endpoints pinned by the client has changed.
     */
    class PinnedEndpointsMessage(val pinnedEndpoints: List<String>) : BridgeChannelMessage(TYPE) {
        companion object {
            const val TYPE = "PinnedEndpointsChangedEvent"
        }
    }

    /**
     * A message sent from a client to a bridge, indicating that the client's pinned endpoint has changed.
     *
     * This format is no longer used in jitsi-meet and is considered deprecated. The semantics are equivalent to
     * [PinnedEndpointsMessage] with a list of one endpoint.
     */
    @Deprecated("Use SelectedEndpointsMessage")
    class PinnedEndpointMessage(val pinnedEndpoint: String?) : BridgeChannelMessage(TYPE) {
        companion object {
            const val TYPE = "PinnedEndpointChangedEvent"
        }
    }

It’s been a loooooong time since I’ve handled code larger than system scripts, so this is stretching my limits, here. Thanks for the tip!

Oh, this is an interesting potential workaround, if I’m reading it correctly. I hadn’t even thought of this approach. I’d have to see if restricting video to only two feeds would work for the person I’m doing this for.

If I may ask more questions, how do you get the ids for the users you want “pinned”?

not sure how it squares with this. The documentation you are linking to is more than 4 years old and sometimes devs forget to update it.

You could have your custom app logic (and UI) for a moderator to be able to “mark” who are the pinned participants (your storyteller and interpreter), get their IDs (property in JitsiParticipant class) and send a command for all participants to use those IDs and then each client would call selectParticipants using that array.

The recent change you mention @gpatel-fr , is for being able to set a minimum wide last N value. By default it is -1 which means it will not affect the last N value that each endpoint asks. The default -1 means no limit. Now only if you change that setting value in the video bridge, last N will be limited to the minimum value between a client’s preference, and this wide setting. This allows for the server to set a hard limit in the last N (for example if you need to save bandwidth).