Participants from different subsessions can interact with each other

All integrations were made following the Zoom Video SDK documentation.
I’m having some unsolved issues in the documentation.

Even if participants are in different subsessions, they can hear, view cameras and share screens from participants in another subsession.

In addition to inserting participants into different subsessions, is it necessary to take any other action so that they are in separate environments? The idea is that the participant can only hear, see the camera and share the screen of the participants in the same subsession.

I created a logic that, based on the group that a user has in my system, subsessions were created and when entering the session the participants were already inserted in them. For this to work I needed to implement a step by step that:

  1. Opens all subsessions
  2. Inserts the user into the subsession corresponding to the group with the same title
  3. Closes all subsessions

The code snippet that does this is this:

const checkOrCreateSubsession = async (client, subsessionClient, userGroup, userId) => {
    if (subsessionClient && userGroup) {
        const currentSubsessionClient = client.getSubsessionClient()
        const subsessionsList = currentSubsessionClient.getSubsessionList()
        if (currentSubsessionClient) {
            const groupExists = subsessionsList?.find(i => i?.subsessionName === userGroup)
            if (!groupExists) {
                const response = await handleCreateSubsessions(subsessionClient, userGroup)
                const newSubsessionId = response[0]?.subsessionId
                if (newSubsessionId && userId) {
                    await currentSubsessionClient.openSubsessions(subsessionClient.getSubsessionList())
                    await assignUserToSubsession(currentSubsessionClient, userId, newSubsessionId)
                    await closeSubsessions(subsessionClient)
                }
            }
        }
    }
}

Below is more information about the versions and system I am using:
Video SDK version: 1.12.5
React version: 18
Next JS version: 14.2.2
OS: Windows 11
Browser: Google Chrome
Browser Version 129.0.6668.70 (Official Build) (64 bits)

Hey @dev_lxpead

Thanks for your feedback.

From the phenomenon you described, it appears that participants were only assigned to the subsession but did not join it.

In the openSubsessions method, there is an option to control whether participants automatically enter the subsession after being assigned, with the default value set to false. In this case, participants assigned to a subsession will receive the subsession-invite-to-join event, and in the callback for handling this event, the joinSubsession method can be called to join the assigned subsession.

Of course, if automatic join into the subsession is needed, you can specify the isAutoJoinSubsession option as true in the openSubsessions method.

Thanks
Vic

1 Like

@dev_lxpead - Vic is referring to the join subsession function mentioned in the below link

Hello! I applied the suggested fixes but the interaction between subrooms still happens.
I looked in the documentation and couldn’t find a way to confirm if the user actually entered the subroom. Is there a way to check this?

Can the host communicate with all users in the session and also those in subsessions? I ask because in my tests, users in a subsession cannot hear the host.

Hi Yan,

Please use the function subsession.getSubsessionList() for getting a list of all sub session along with users present in the sub session.

Hi Yan,

Additionally you can use the function startBroadcastVoice() and stopBroadcastVoice() to broadcast voice from main session to sub sessions.

Thank you very much for your feedback @binesh.dhami !
With this command, will all users in all subsessions be able to hear each other? Or will they only hear the host?

Hi Yan,

All the participants in the subsession won’t be able to hear each other with this command. They will only hear the person from the main session.

Thank you,
binesh

Thanks for the feedback!
The start Broadcast Voice function worked perfectly, would it be possible to do the same to display the camera and the screen being shared by the host?

Thanks for the feedback!
By setting isAutoJoinSubsession to true I was able to make it work. In my code there was a validation that was getting in the way of this implementation. When I fixed it, everything started working.

Hi Yan,

The broadcast function can be used to display the content in the main session to all sub session.
link: SubsessionClient | Zoom Video SDK for Web - 1.12.12

Thanks
Binesh

Thanks for getting back @binesh.dhami !
So how can I retrieve the host information when it calls the startBroadcastVoice function?

I haven’t found a way for a user to retrieve this information to display the host container again.

The documentation states that I only need to send a string in the broadcast function:
broadcast(content: string)

But how can I use this to render the camera or screen sharing for users within subsessions?

Hello! I found the shareToSubsession function in the documentation. I believe that with it I will be able to display screen sharing with users who are in subsessions. However, I did not find many details on how to use the return of this function.
I am getting the following error when calling this function:

{
    "type": "INVALID_PARAMETERS",
    "reason": "Expected to accept HTMLCanvasElement, but actual it is BA"
}

Is there a way to control whether the container that should display the video is a canvas?

Hey @dev_lxpead

This is a sender-side method that can be specified in the stream.startShareScreen method or enabled after starting screen sharing using the media.shareToSubsession method.

As for the INVALID_PARAMETERS error you mentioned, it may be thrown by another method, since the media.shareToSubsession method does not require any parameters.

Thanks
Vic

Hello!
Can you explain to me how broadcasting works? I would also like to better understand how the client and stream work. By understanding these three concepts better, I believe I can find a solution to this problem, as I don’t know how to use the feedback that Zoom sends me to correctly render the camera and the host’s screen sharing.

Hey @dev_lxpead

Can you explain to me how broadcasting works?

We provide several approaches for the host to broadcast to subsessions:

  • Text Messages: Use subsessionClient.broadcast(message) for text-only communication.

  • Audio Voice: Use subsessionClient.startBroadcastVoice() to start and subsessionClient.stopBroadcastVoice() to stop broadcasting audio. This feature is available only when the host is in the main session.

  • Screen Sharing: Use media.shareToSubsession to share the screen. This feature is available only when the host is in the main session.

  • Video: We currently don’t support it.

Thanks
Vic

Thanks for the feedback!
I’m trying to use media.shareToSubsession but without any results. I’m not getting an error or success response when the method is called.

After calling this method, is there any logic required to display screen sharing to users inside the subroom?

Hey @dev_lxpead

media.shareToSubsession

It’s a method for switching functionality. It allows you to control whether to share the screen content to the subsession after initiating screen sharing.

Therefore, the prerequisite is that the host must first share the screen using stream.startScreenShare.

Could you help check whether the stream.startScreenShare method was called first?

Thanks
Vic