Sessions

Sessions are the fundamental building blocks of the Video SDK. A session connects two or more users to communicate with each other over video and audio, similar to a virtual meeting. Optional features include in-session chat and screen share.

Join session

To join a session, make the following call on the Zoom Video SDK instance:

const doZoomThings = async () => {
    await zoom.joinSession({
        sessionName:
            "name of video session (case insensitive, they are all converted to lowercase)",
        token: "JWT goes here",
        userName: "name of user",
        audioOptions: {
            connect: true,
            mute: false,
        },
        videoOptions: {
            localVideoOn: true,
        },
    });
};

The following table describes the properties of joinSession.

NameRequiredNote
sessionNameYesName and unique identifier of the session. A user will be able to join the session by entering the session name. Should be alphanumeric with a max-length of 150 characters. It can include symbols and the space character. Session names are case insensitive (they are all converted to lowercase). This must match the tpc value in the SDK JWT payload.
userNameYesDisplay name of the user shown in the session. If empty, the name is displayed as the string "null". Max 200 characters. Values longer than 200 characters are truncated without error.
tokenYesJWT token generated from your SDK credentials. See Authorize for details.
sessionPasswordNoPassword for session. If set, the session will be private and can only be joined if the user provides a valid password. If not set, the session will be public for anyone in your account. To join, they must use sessionName only. The field has a max-length limit of 10 characters, printable ASCII characters only (ch >= 32 && ch < 127).
audioOptionsNoConfigure audio settings.
videoOptionsNoConfigure video settings.

See JoinSessionConfig for details.

Optimize join latency with pre-join

To reduce connection time in 1:1 calls or invite flows, prepare the session before the user accepts the call. When the user accepts, commit the join to connect immediately. This two-step flow minimizes the time between when a user answers a call and when they're in the call. Pre-join requires Video SDK for React Native version 2.6.0 or later.

Prepare to join

Call prepareJoin() with the same JoinSessionConfig you would pass to joinSession(). The SDK opens the connection without joining the session. Pass an optional ZoomVideoSdkPreJoinParam to set how long the SDK waits before the preparation times out.

await zoom.prepareJoin(
    {
        sessionName:
            "name of video session (case insensitive, they are all converted to lowercase)",
        token: "JWT goes here",
        userName: "name of user",
        audioOptions: {
            connect: true,
            mute: false,
        },
        videoOptions: {
            localVideoOn: true,
        },
    },
    {
        timeoutInterval: 30,
    },
);

The following table describes the parameters of prepareJoin.

NameRequiredNote
configYesJoinSessionConfig with the session details. Same configuration as joinSession.
preJoinParamNoZoomVideoSdkPreJoinParam to configure the timeout. Set timeoutInterval to the number of seconds to wait, set timeoutInterval to 0 to use the default 30 seconds. Range is 1-60.

Commit the join

When the user accepts the call, finalize the connection by calling commitJoin(). It resolves with an Errors value.

const result = await zoom.commitJoin();

Listen for the onSessionJoin event to confirm the user joined the session. See Get started for details.

Cancel pre-join

If the user declines the call after prepareJoin(), cancel the preparation. cancelPrepareJoin() also resolves with an Errors value.

const result = await zoom.cancelPrepareJoin();

Pre-join errors

commitJoin() and cancelPrepareJoin() resolve with Errors.Success when the call succeeds. The following values indicate a pre-join problem.

  • Session_PreJoin_Not_In_Flow - the app called commitJoin() or cancelPrepareJoin() without an active pre-join flow.
  • Session_PreJoin_Already_Commit - the app already committed the pre-join flow.
  • Session_PreJoin_Timeout - the preparation timed out before the app called commitJoin().

User roles and actions

People in a session can hold one of the following roles: host, manager, or participant.

Host

The user with the host role_type is the host of the session.

A host of the session has the following privileges.

  • View information of users in the session.
  • Change the display name of a user in the session.
  • Mute or unmute a user's audio.
  • Transfer the host role to someone else in the session.
  • Promote another user to be a manager of the session.
  • Remove participants from the session.
  • Revoke manager privilege from a user.
  • Start a live stream.
  • Prevent other users from sharing their screen (lock screen).
  • End the session.

Manager

The manager or co-host role can be assigned to a participant by the host to help the host to manage the session participants.

A manager of the session is assigned the following subset of the host privileges.

  • Remove participants from a session.
  • Change the display name of a user in the session.
  • Mute or unmute a user's audio.
  • Prevent other users from sharing their screen (lock screen).

Participant

A regular user who joins the session without host or manager permission. A participant has privileges to view their own information as well as the information of other users.