Sessions

A session is the most fundamental building block of the Video SDK. A session is similar to but not limited to a virtual meeting where two or more users can communicate with each other over video and audio. You can also include other features in a session, such as chat and screen sharing.

Create or join a session

To create a session, create an instance of ZMVideoSDKSessionContext and provide the userName, sessionName, and SDK JWT. See the following example for details.

ZMVideoSDKSessionContext sessionContext = new ZMVideoSDKSessionContext();
sessionContext.sessionName = SessionName;
sessionContext.sessionPassword = Password;
sessionContext.token = JWTToken;
sessionContext.userName = UserName;
sessionContext.videoOption.localVideoOn = true;
sessionContext.audioOption.mute = false;

The following table describes the properties of the ZoomVideoSDKSessionContext object.

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).
audioOptionNoConfigure audio settings by storing values in ZoomVideoSDKAudioOptions.
videoOptionNoConfigure video settings by storing values in ZoomVideoSDKVideoOptions.

Join a session sample code

Here's some sample code to join a session.

ZMVideoSDK.Instance.JoinSession(sessionContext, (result) => {
  if (result == ZMVideoSDKErrors.ZMVideoSDKErrors_Success)
  {
    ZMVideoSDKDelegate ZMDelegate = new ZMVideoSDKDelegateImpl(this);
    ZMVideoSDK.Instance.AddListener(ZMDelegate);
  }
});

Leave a session

To leave a session, you must call leaveSession() and indicate whether or not you would like to end the session if you are the host of the session. For example, see the following example to leave a session without ending it.

ZMVideoSDK.Instance.LeaveSession(false, (result) => {});

To leave and end the session, using the following code.

ZMVideoSDK.Instance.LeaveSession(true, (result) => {});

Manage user information

Each user joining a session is represented by an instance of the ZMVideoSDKUser object. Within this object exists an ID which uniquely identifies the user within the current session.

Add features

Now that you have added sessions to your integration, you can add Video SDK features such as video and audio. Expand the Add features section to see them all.