Manage User Information

Each user joining a session is assigned an ZMVideoSDKUser object to provide access to various user information. This section gives you an overview of user information that you can view and manage.

User information

While in a session, you can retrieve the following information of a user:

  • User ID
  • Display name (UserName)
  • Video status
  • Audio status
  • Share status
  • Video Statistic Information
  • Share Statistic Information
  • Host status
  • Manager status
  • Video pipe
  • Share pipe
  • Custom Identity (set on JWT payload)

Retrieve user

To obtain the ZMVideoSDKUser associated with the current user, use the getMySelf method.


// Get local user.
[[[ZMVideoSDK sharedZMVideoSDK] getSessionInfo] getMySelf];

// Get local user.
ZMVideoSDK.shared()?.getSessionInfo()?.getMySelf()

To obtain all of the users in the session, use the getRemoteUsers method.


// Get all users in a session.
[[[ZMVideoSDK sharedZMVideoSDK] getSessionInfo] getRemoteUsers];

// Get all users.
ZMVideoSDK.shared()?.getSessionInfo()?.getRemoteUsers()

Retrieve user's video

A user is tied to an ZMVideoSDKRawDataPipe to receive that user's video stream data within a session. To obtain the video pipe of user, use getVideoPipe within ZMVideoSDKUser. For more information on how to use the pipe, see Render a user's video.

User roles and actions

Users in a session can hold one of the following roles:

  • Host — The user who starts the session is considered the host of the session.
  • Manager — The manager role can be assigned to a participant by the host to help the host to manage the session participants.
  • Participant — A regular user who joins the session without host or manager permission.

A participant in the session has the privilege to view their own information as well as the information of other users.

A host of the session has the following privileges:

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

A manager of the session is assigned a subset of the host privileges, all of which are listed below:

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

Change display name

If you are the host, you can change your display name while in the session using the changeName method within ZMVideoSDKUserHelper. If you are the host or a manager, you may also change the display name of other users:


[[[ZMVideoSDK sharedZMVideoSDK] getUserHelper] changeName:newName user:user];

ZMVideoSDK.shared()?.getUserHelper().changeName(newName, user: user)

Transfer host privilege

The host of a session can transfer the host role to another user by calling the makeHost function within ZMVideoSDKUserHelper.


// Check if the current user is the host.
BOOL localUserIsHost = [[[[ZMVideoSDK sharedZMVideoSDK] getSessionInfo] getMySelf] isHost];
if (localUserIsHost) {
    // Transfer host privileges to user.
    [[[ZMVideoSDK sharedZMVideoSDK] getUserHelper] makeHost:user];
}

if let localUser = ZMVideoSDK.shared()?.getSessionInfo()?.getMySelf(),
localUser.isHost() {
    // Transfer host privileges to user.
    ZMVideoSDK.shared()?.getUserHelper().makeHost(user)
}

Assign manager role

Managers can help manage users while in a session. The host can promote a user to be a manager by calling the makeManager method within ZMVideoSDKUserHelper.


// Check if the current User is the host.
BOOL localUserIsHost = [[[[ZMVideoSDK sharedZMVideoSDK] getSessionInfo] getMySelf] isHost];
if (localUserIsHost) {
    // Make User a manager.
    [[[ZMVideoSDK sharedZMVideoSDK] getUserHelper] makeManager:user];
}

// Check if the current User is the host.
if let localUser = ZMVideoSDK.shared()?.getSessionInfo()?.getMySelf(),
localUser.isHost() {
    // Make User a manager.
    ZMVideoSDK.shared()?.getUserHelper().makeManager(user)
}

Revoke manager role

The host can revoke the manager role from a user by calling the revokeManager method within ZMVideoSDKUserHelper.


BOOL localUserIsHost = [[[[ZMVideoSDK sharedZMVideoSDK] getSessionInfo] getMySelf] isHost];
if (localUserIsHost) {
    // Revoke manager privileges from User.
    [[[ZMVideoSDK sharedZMVideoSDK] getUserHelper] revokeManager:user];
}

// Check if the current user is the host.
if let localUser = ZMVideoSDK.shared()?.getSessionInfo()?.getMySelf(),
localUser.isHost() {
    // Revoke manager privileges from user.
    ZMVideoSDK.shared()?.getUserHelper().revokeManager(user)
}

Remove user from a session

Users with either host or manager privilege can remove users from a session using the removeUser method within ZMVideoSDKUserHelper.


// Get current user.
ZMVideoSDKUser *localUser = [[[ZMVideoSDK sharedZMVideoSDK] getSessionInfo] 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.
    [[[ZMVideoSDK sharedZMVideoSDK] getUserHelper] removeUser:user];
}

// Get current user.
if let localUser = ZMVideoSDK.shared()?.getSessionInfo()?.getMySelf() {
    // Check if the current User is the host or a manager.
    if localUser.isHost() || localUser.isManager() {
        // Remove user from session.
        ZMVideoSDK.shared()?.getUserHelper().remove(user)
    }
}

Need help?

If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.