A session is the most fundamental building block of the Video SDK for iOS. 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. Optionally, you can also include features such as chat and screen sharing in a session.
Create and join a session
To create a session, you must provide a session name to uniquely identify it.
The process of creating and joining a session requires the developer's SDK JWT. When you create and join a session through the Video SDK, you must provide a string value representing the session name. The name determines whether the SDK joins an existing session or creates a new one.
- If you call
joinSession()with a session name and there is no session currently active with that name, the SDK creates the session for you. - If a session with that name is currently active, the SDK lets you join the active session if you provide all the required parameters, for example, a password if one has been set for the session.
Sessions become inactive and available for reuse after you call leaveSession() to end a session or the backend closes the session when there are no longer any users in that session.
The session name only needs to be unique to your app at the developer account level. For instance, developers with separate developer accounts (separate SDK credentials) can use the same session name for their separate apps (for example, App A and App B). While the names are the same, Zoom creates different unique sessions for both of these apps. Two different apps built with the Video SDK cannot join sessions created by the other. Each app can only join a session that it created.
To create a session through the SDK, create an instance of ZoomVideoSDKSessionContext and provide the userName, sessionName, and SDK JWT as shown below.
Create a SessionContext object
let sessionContext = ZoomVideoSDKSessionContext()
// Ensure that you do not hard code JWT or any other confidential credentials in your production app.
sessionContext.token = "Your jwt"
sessionContext.sessionName = "Your session name"
sessionContext.userName = "Your name"
sessionContext.sessionPassword = "Your session password"
if let session = ZoomVideoSDK.sharedInstance()?.joinSession(sessionContext) {
// Session joined successfully.
}
ZoomVideoSDKSessionContext *sessionContext = [[ZoomVideoSDKSessionContext alloc] init];
// Ensure that you do not hard code JWT or any other confidential credentials in your production app.
sessionContext.token = @"Your jwt";
sessionContext.sessionName = @"Your session name";
sessionContext.userName = @"Your name";
sessionContext.sessionPassword = @"Your session password";
ZoomVideoSDKSession *session = [[ZoomVideoSDK sharedInstance] joinSession:sessionContext];
if (session) {
// Session joined successfully.
}
The following table describes all the properties of the sessionContext object.
| Name | Required | Note |
|---|---|---|
sessionName | Yes | Name 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. |
userName | Yes | Display 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. |
token | Yes | JWT token generated from your SDK credentials. See Authorize for details. |
sessionPassword | No | Password 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). |
audioOption | No | Configure audio settings by storing values in ZoomVideoSDKAudioOptions. |
videoOption | No | Configure video settings by storing values in ZoomVideoSDKVideoOptions. |
Prior to joining a session, ensure that you have set up a delegate for callback events by conforming your class to the ZoomVideoSDKDelegate protocol and using ZoomVideoSDK.sharedInstance()?.delegate = self or [ZoomVideoSDK sharedInstance].delegate = self. To successfully monitor events related to a session, you will need to use some important callback functions.
Once you have your context and delegate set up, call the joinSession() method to join a session.
if let session = ZoomVideoSDK.sharedInstance()?.joinSession(sessionContext) {
// Session joined successfully.
}
ZoomVideoSDKSession *session = [[ZoomVideoSDK sharedInstance] joinSession:sessionContext];
if (session) {
// Session joined successfully.
}
Note that the return value of the joinSession() method will return the session upon success, and nil upon failure.
To retrieve further information about the joinSession attempt, you must listen for specific callbacks, some of which may require user interaction.
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.
Before the user can use prepareJoin() and commitJoin(), the caller must already have the session up and running. The user then uses the pre-join flow to join the existing session more quickly.
Implement the surrounding incoming-call workflow, including push notification delivery and platform-level call handling using a framework like CallKit.
Prepare to join
First create your session context as described in Create a SessionContext object. Then call prepareJoin() to prepare the connection without joining the session. Configure the timeout interval using ZoomVideoSDKPreJoinParam.
let preJoinParam = ZoomVideoSDKPreJoinParam()
preJoinParam.timeoutInterval = 30 // Timeout in seconds (1-60, or 0 for default 30s)
if let session = ZoomVideoSDK.sharedInstance()?.prepareJoin(sessionContext, preJoinParam: preJoinParam) {
// Pre-join prepared successfully.
}
ZoomVideoSDKPreJoinParam *preJoinParam = [[ZoomVideoSDKPreJoinParam alloc] init];
preJoinParam.timeoutInterval = 30; // Timeout in seconds (1-60, or 0 for default 30s)
ZoomVideoSDKSession *session = [[ZoomVideoSDK sharedInstance] prepareJoin:sessionContext preJoinParam:preJoinParam];
if (session) {
// Pre-join prepared successfully.
}
ZoomVideoSDKSession \*session = [[ZoomVideoSDK sharedInstance] prepareJoin:sessionContext preJoinParam:preJoinParam]; if (session) {
// Pre-join prepared successfully.
}
| Name | Required | Note |
|---|---|---|
params | Yes | ZoomVideoSDKSessionContext with session details. Same configuration as standard joinSession(). |
preJoinParam | Yes | ZoomVideoSDKPreJoinParam to configure timeout. Set timeoutInterval to 1-60 seconds, or 0 to use the default (30 seconds). |
Commit the join
When the user accepts the call, finalize the connection by calling commitJoin().
let result = ZoomVideoSDK.sharedInstance()?.commitJoin()
ZoomVideoSDKError result = [[ZoomVideoSDK sharedInstance] commitJoin];
The return value indicates success or error. Listen for onSessionJoin() to confirm you've successfully joined.
Cancel pre-join
If the user declines the call after prepareJoin(), cancel the preparation.
let result = ZoomVideoSDK.sharedInstance()?.cancelPrepareJoin()
ZoomVideoSDKError result = [[ZoomVideoSDK sharedInstance] cancelPrepareJoin];
Hold participants until admitted
OnHold places participants in a holding state when they join a session. They stay on hold, outside the session, until a host or manager admits them.
The hold JWT payload field controls whether a session supports OnHold. Set it in the JWT of the first user to join, which starts the session.
0- (default) The session does not support OnHold.1- The session supports OnHold, and OnHold is on when the session starts.2- The session supports OnHold, but OnHold is off when the session starts. A host or manager can turn it on during the session.
When OnHold is on, participants who join receive onHoldJoined() instead of onSessionJoin() until a host or manager admits them.
Check OnHold status
Get the ZoomVideoSDKOnHoldHelper by calling getOnHoldHelper(). Call isSupportHold() to check whether the current session supports OnHold, and isOnHoldEnabled() to check whether OnHold is on.
if let onHoldHelper = ZoomVideoSDK.sharedInstance()?.getOnHoldHelper() {
let isSupportHold = onHoldHelper.isSupportHold()
let isOnHoldEnabled = onHoldHelper.isOnHoldEnabled()
}
ZoomVideoSDKOnHoldHelper *onHoldHelper = [[ZoomVideoSDK sharedInstance] getOnHoldHelper];
BOOL isSupportHold = [onHoldHelper isSupportHold];
BOOL isOnHoldEnabled = [onHoldHelper isOnHoldEnabled];
Get notified when you are on hold
When the local user joins a session with OnHold on, the SDK calls onHoldJoined instead of onSessionJoin. Use this callback to show a holding screen until a host or manager admits the user.
func onHoldJoined() {
// The local user is on hold. Show a holding screen.
}
- (void)onHoldJoined {
// The local user is on hold. Show a holding screen.
}
Get notified when other users are on hold
The SDK calls onHoldUserJoin when users are placed on hold, and onHoldUserLeave when users leave the on-hold list. Use these callbacks to keep a list of users waiting for a host or manager to admit them.
Users leave the on-hold list in either of the following cases.
- A host or manager admits them. Hosts and managers then also receive
onUserJoinfor each admitted user who is not already in the session's user list. - They leave while still on hold. The SDK reports these users through
onHoldUserLeaveonly, not throughonUserLeave.
func onHoldUserJoin(_ helper: ZoomVideoSDKOnHoldHelper?, users userArray: [ZoomVideoSDKOnHoldUser]?) {
userArray?.forEach { user in
// Add user.getUserName() to your list of users on hold.
}
}
func onHoldUserLeave(_ helper: ZoomVideoSDKOnHoldHelper?, users userArray: [ZoomVideoSDKOnHoldUser]?) {
// Remove these users from your list of users on hold.
}
- (void)onHoldUserJoin:(ZoomVideoSDKOnHoldHelper *)helper users:(NSArray<ZoomVideoSDKOnHoldUser *> *)userArray {
for (ZoomVideoSDKOnHoldUser *user in userArray) {
// Add [user getUserName] to your list of users on hold.
}
}
- (void)onHoldUserLeave:(ZoomVideoSDKOnHoldHelper *)helper users:(NSArray<ZoomVideoSDKOnHoldUser *> *)userArray {
// Remove these users from your list of users on hold.
}
Admit users on hold
A host or manager can call getOnHoldUserList to get the users currently on hold, then call admit to admit one user or admitAll to admit every user on hold.
if let onHoldHelper = ZoomVideoSDK.sharedInstance()?.getOnHoldHelper() {
// Admit one user.
if let user = onHoldHelper.getOnHoldUserList()?.first {
let result = onHoldHelper.admit(user)
}
// Admit all users on hold.
let result = onHoldHelper.admitAll()
}
ZoomVideoSDKOnHoldHelper *onHoldHelper = [[ZoomVideoSDK sharedInstance] getOnHoldHelper];
// Admit one user.
ZoomVideoSDKOnHoldUser *user = [[onHoldHelper getOnHoldUserList] firstObject];
if (user) {
ZoomVideoSDKError result = [onHoldHelper admit:user];
}
// Admit all users on hold.
ZoomVideoSDKError result = [onHoldHelper admitAll];
Turn OnHold on or off during a session
A host or manager can call enableHold to turn OnHold on or off in a session that supports OnHold. This change only affects future join attempts. It does not admit users who are already on hold.
// Pass true to turn OnHold on, or false to turn it off.
let result = ZoomVideoSDK.sharedInstance()?.getOnHoldHelper()?.enableHold(true)
// Pass YES to turn OnHold on, or NO to turn it off.
ZoomVideoSDKError result = [[[ZoomVideoSDK sharedInstance] getOnHoldHelper] enableHold:YES];
Leave a Session
When you are ready to leave the session, you must call the leaveSession() method and indicate whether or not you would like to end the session for everyone if you are the host of the session.
// A value of true will end the session if you are the host
ZoomVideoSDK.sharedInstance()?.leaveSession(shouldEndSession)
// A value of true will end the session if you are the host
[[ZoomVideoSDK sharedInstance] leaveSession:shouldEndSession];
Configure audio and video
To control whether a user connects to audio or turns on local video when joining, build a ZoomVideoSDKAudioOptions and a ZoomVideoSDKVideoOptions object, then assign them to the audioOption and videoOption properties of the ZoomVideoSDKSessionContext before you call joinSession().
// Set up audio options.
let audioOptions = ZoomVideoSDKAudioOptions()
audioOptions.connect = true // Auto connect to audio upon joining.
audioOptions.mute = true // Auto mute audio upon joining.
// Set up video options.
let videoOptions = ZoomVideoSDKVideoOptions()
videoOptions.localVideoOn = true // Turn on local video upon joining.
// Pass the options into the session context.
let sessionContext = ZoomVideoSDKSessionContext()
sessionContext.audioOption = audioOptions
sessionContext.videoOption = videoOptions
// Set up audio options.
ZoomVideoSDKAudioOptions *audioOptions = [[ZoomVideoSDKAudioOptions alloc] init];
audioOptions.connect = YES; // Auto connect to audio upon joining.
audioOptions.mute = YES; // Auto mute audio upon joining.
// Set up video options.
ZoomVideoSDKVideoOptions *videoOptions = [[ZoomVideoSDKVideoOptions alloc] init];
videoOptions.localVideoOn = YES; // Turn on local video upon joining.
// Pass the options into the session context.
ZoomVideoSDKSessionContext *sessionContext = [[ZoomVideoSDKSessionContext alloc] init];
sessionContext.audioOption = audioOptions;
sessionContext.videoOption = videoOptions;
See Video and Audio for details.
Obtain session information
After joining a session, retrieve the ZoomVideoSDKSession object to read information about the session itself, such as its name, password, host, and host name. Use getSession() to obtain the session object.
if let session = ZoomVideoSDK.sharedInstance()?.getSession() {
let sessionName = session.getSessionName()
let sessionPassword = session.getSessionPassword()
let sessionHost = session.getSessionHost()
let sessionHostName = session.getSessionHostName()
}
ZoomVideoSDKSession *session = [[ZoomVideoSDK sharedInstance] getSession];
NSString *sessionName = [session getSessionName];
NSString *sessionPassword = [session getSessionPassword];
ZoomVideoSDKUser *sessionHost = [session getSessionHost];
NSString *sessionHostName = [session getSessionHostName];
For a full list of available information on the session object, see the ZoomVideoSDKSession reference.
Get user information
Each user joining a session is represented by an instance of the ZoomVideoSDKUser object. While in a session, you can retrieve the following information for a user:
- User ID
- Display name
- Custom User ID (set on JWT payload)
- Host and manager status
- Video, audio, and screen sharing status
- Video and screen sharing statistics, raw data, and canvas
See the ZoomVideoSDKUser class reference for details.
Get the current user
The user who is currently using this instance of the SDK is referred to as the local user. Use the getMySelf method to get the local user.
// Get local User.
ZoomVideoSDK.sharedInstance()?.getSession()?.getMySelf()
// Get local User.
[[[ZoomVideoSDK sharedInstance] getSession] getMySelf];
Get all users except the current user
Use the getRemoteUsers method to get a list of all users who are not the local user.
// Get all users who are not this user.
let remoteUsers = ZoomVideoSDK.sharedInstance()?.getSession()?.getRemoteUsers()
// Get all users who are not this user.
NSArray *remoteUsers = [[[ZoomVideoSDK sharedInstance] getSession] getRemoteUsers];
Get user's video canvas
A user's ZoomVideoSDKVideoCanvas is used to render the user's video stream within a session. To obtain the video canvas of a user, use getVideoCanvas within ZoomVideoSDKUser.
// Get user's video canvas.
user.getVideoCanvas()
// Get user's video canvas.
[user getVideoCanvas];
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.
Manage users
See below for details on how to manage users.
Change display name
If you are the host, use the the changeName method to change your display name while in the session. If you are the host or manager, you may also change the display name of other users. See the examples below for details.
// Change name of User.
ZoomVideoSDK.sharedInstance()?.getUserHelper().changeName(newName, with: user)
// Change name of User.
[[[ZoomVideoSDK sharedInstance] getUserHelper] changeName:newName withUser:user];
Transfer host privilege to another user
When needed, the host of a session can call the makeHost function to transfer the host role to another user.
// Check if the current User is the host.
if let localUser = ZoomVideoSDK.sharedInstance()?.getSession()?.getMySelf(),
localUser.isHost() {
// Transfer host privileges to User.
ZoomVideoSDK.sharedInstance()?.getUserHelper().makeHost(user)
}
// Check if the current User is the host.
BOOL localUserIsHost = [[[[ZoomVideoSDK sharedInstance] getSession] getMySelf] isHost];
if (localUserIsHost) {
// Transfer host privileges to User.
[[[ZoomVideoSDK sharedInstance] getUserHelper] makeHost:user];
}
Assign manager role
Managers can help manage users while in a session. The host can call the makeManager method to promote a user to a manager.
// Check if the current User is the host.
if let localUser = ZoomVideoSDK.sharedInstance()?.getSession()?.getMySelf(),
localUser.isHost() {
// Make User a manager.
ZoomVideoSDK.sharedInstance()?.getUserHelper().makeManager(user)
}
// Check if the current User is the host.
BOOL localUserIsHost = [[[[ZoomVideoSDK sharedInstance] getSession] getMySelf] isHost];
if (localUserIsHost) {
// Make User a manager.
[[[ZoomVideoSDK sharedInstance] getUserHelper] makeManager:user];
}
Revoke manager role
The host can call revokeManager method to revoke the manager role from a user.
// Check if the current User is the host.
if let localUser = ZoomVideoSDK.sharedInstance()?.getSession()?.getMySelf(),
localUser.isHost() {
// Revoke manager privileges from User.
ZoomVideoSDK.sharedInstance()?.getUserHelper().revokeManager(user)
}
// Check if the current User is the host.
BOOL localUserIsHost = [[[[ZoomVideoSDK sharedInstance] getSession] getMySelf] isHost];
if (localUserIsHost) {
// Revoke manager privileges from User.
[[[ZoomVideoSDK sharedInstance] getUserHelper] revokeManager:user];
}
Remove user from a session
Users with either host or manager privilege can use the removeUser method within ZoomVideoSDKUserHelper to remove users from a session.
// Get current User.
if let localUser = ZoomVideoSDK.sharedInstance()?.getSession()?.getMySelf() {
// Check if the current User is the host or a manager.
if localUser.isHost() || localUser.isManager() {
// Remove User from session.
ZoomVideoSDK.sharedInstance()?.getUserHelper().remove(user)
}
}
// Get current User.
ZoomVideoSDKUser *localUser = [[[ZoomVideoSDK sharedInstance] getSession] getMySelf];
// Check if the current User is the host.
BOOL localUserIsHost = [localUser isHost];
// Check if the current User is a manager.
BOOL localUserIsAManager = [localUser isManager];
if (localUserIsHost || localUserIsAManager) {
// Remove User from session.
[[[ZoomVideoSDK sharedInstance] getUserHelper] removeUser:user];
}
Callbacks
All of these callbacks can be found within your ZoomVideoSDKDelegate implementation.
onSessionJoin: Called when current user has joined the session.onSessionLeave: Called when current user has left the session.onHoldJoined: Called when the current user joins a session with OnHold on and is placed on hold. See Hold participants until admitted.onHoldUserJoin: Called when users are placed on hold.userArrayrepresents the users who were just placed on hold.onHoldUserLeave: Called when users leave the on-hold list, either because a host or manager admitted them or because they left while on hold.userArrayrepresents the users who just left the on-hold list.onError: Called when the ZoomVideoSDK raises an error. For example, failure to join a session, network timeouts, etc. The error: Errors_Success (rawValue: 0) represents a successful callback without errors.onUserJoin: Called when any user joins the session. Helper is provided to provide user-related functionality.UserArrayrepresents the updated array of user IDs of users who have joined the session.onUserLeave: Called when any user joins the session.UserArrayrepresents the updated array of user IDs of users who have left the session.onSessionNeedPassword: Called when attempting to join a session that requires a password, but no password was provided. A completion parameter is provided to retry the join. Use completion when you would like to retry joining the session. Inside of the completion parameter, there is a field for the password and a Bool which when set to true will cancel the attempt to join the session and will ignore the password.onSessionPasswordWrongCalled when attempting to join a session that requires a password, but the provided password was incorrect. completion is provided to retry the join. Call completion when you would like to retry joining the session. Inside of the completion parameters is a field for the updated password and a Bool that when set to true will cancel the attempt to join the session and will ignore the password.
See Integrate for more details on how to add a listener delegate. See the following sections for examples.
Retrieve user information
The ZoomVideoSDKUserHelper helps with retrieval of user information associated with users as they join a session. To be notified when users join a session, use the onUserJoin callback within ZoomVideoSDKDelegate:
func onUserJoin(_ helper: ZoomVideoSDKUserHelper?, users userArray: [ZoomVideoSDKUser]?) {
// UserArray contains the new users.
// Use helper to perform actions on a user.
if let userArray = userArray {
for user in userArray {
print(user)
}
}
}
- (void)onUserJoin:(ZoomVideoSDKUserHelper *)helper users:(NSArray<ZoomVideoSDKUser *> *)userArray {
// UserArray contains the new users.
// Use helper to perform actions on a user.
for (int i = 0; i < userArray.count; i++) {
NSLog(@"%@", userArray[i]);
}
}
If you have not already implemented a listener for the callback events, see Integrate for details.
Get notified when a local user successfully joins or leaves a session
func onSessionJoin() {
// You have successfully joined the session.
return
}
func onSessionLeave() {
// You have successfully left the session.
return
}
- (void)onSessionJoin {
// You have successfully joined the session
}
- (void)onSessionLeave {
// You have successfully left the session
}
Get notified when other users successfully join or leave a session
func onUserJoin(_ helper: ZoomVideoSDKUserHelper?, users userArray: [ZoomVideoSDKUser]?) {
// UserArray contains the new users.
// Use helper to perform actions on a user.
if let userArray = userArray {
for user in userArray {
print(user)
}
}
}
func onUserLeave(_ helper: ZoomVideoSDKUserHelper?, users userArray: [ZoomVideoSDKUser]?) {
// UserArray contains the users that recently left.
// Use helper to perform actions on a user.
if let userArray = userArray {
for user in userArray {
print(user)
}
}
}
- (void)onUserJoin:(ZoomVideoSDKUserHelper *)helper users:(NSArray<ZoomVideoSDKUser *> *)userArray {
// UserArray contains the new users.
// Use helper to perform actions on a user.
for (int i = 0; i < userArray.count; i++) {
NSLog(@"%@", userArray[i]);
}
}
- (void)onUserLeave:(ZoomVideoSDKUserHelper _)helper users:(NSArray<ZoomVideoSDKUser _> \*)userArray {
// UserArray contains the users that recently left. // Use helper to perform
actions on a user. for (int i = 0; i < userArray.count; i++) { NSLog(@"%@", userArray[i]); } }
Get notified when the host of the session changes
func onUserHostChanged(_ helper: ZoomVideoSDKUserHelper?, users user: ZoomVideoSDKUser?) {
// User is the new host of the session.
// Use helper to perform actions on a user.
if let userName = user?.getName() {
print("\\(userName): is the new host.")
}
}
- (void)onUserHostChanged:(ZoomVideoSDKUserHelper *)helper users:(ZoomVideoSDKUser *)user {
// User is the new host of the session.
// Use helper to perform actions on a user.
if (user.getUserName)
NSLog(@"%@: is the new host.", user.getUserName);
}
Get notified when a session requires password to join
func onSessionNeedPassword(_ completion: ((String?, Bool) -> ZoomVideoSDKERROR)? = nil) {
// Recommended action: prompt user to enter password again and pass user input into completion
if let completion = completion {
let userInput = "Password"
let cancelJoinSession = false
let completionReturnValue = completion(userInput, cancelJoinSession)
}
// Alternatively, you may abandon the attempt to join the session
// let userInput = nil
// let cancelJoinSession = true
// let completionReturnValue = completion(userInput, cancelJoinSession)
// print("Completion return value code: \(completionReturnValue)")
}
- (void)onSessionNeedPassword:(ZoomVideoSDKERROR (^)(NSString *, BOOL))completion {
// Recommended action: prompt user to enter password again and pass user input into completion
NSString *userInput = @"Password";
Boolean cancelJoinSession = NO;
if (completion) {
completion(userInput, cancelJoinSession);
}
// Alternatively, you may abandon the attempt to join the session
NSString *userInput = NULL;
Boolean cancelJoinSession = YES;
if (completion) {
completion(userInput, cancelJoinSession);
}
}
Get notified when a wrong password is entered while joining a session
func onSessionPasswordWrong(_ completion: ((String?, Bool) -> ZoomVideoSDKERROR)? = nil) {
// Recommended action: prompt user to enter password again and pass user input into completion
if let completion = completion {
let userInput = "Password"
let cancelJoinSession = false
let completionReturnValue = completion(userInput, cancelJoinSession)
}
// Alternatively, you may abandon the attempt to join the session
// let userInput = nil
// let cancelJoinSession = true
// let completionReturnValue = completion(userInput, cancelJoinSession)
// print("Completion return value code: \(completionReturnValue)")
}
- (void)onSessionPasswordWrong:(ZoomVideoSDKERROR (^)(NSString *, BOOL))completion {
// Recommended action: prompt user to enter password again and pass user input into completion
NSString *userInput = @"Password";
Boolean cancelJoinSession = NO;
if (completion) {
completion(userInput, cancelJoinSession);
}
// Alternatively, you may abandon the attempt to join the session
NSString *userInput = NULL;
Boolean cancelJoinSession = YES;
if (completion) {
completion(userInput, cancelJoinSession);
}
}