Windows SDK functions

Contents

The Zoom Windows SDK provides the following services:

  1. Initialization
  2. Authentication service
  3. Meeting service
  4. Meeting UI controller
  5. Setting service

For API documentation, please visit the Windows SDK Documentation Page.

1. Initialization

You can find these APIs in zoom_sdk.h. Please call Zoom SDK APIs in main UI thread for thread-safe operation.

1.1 Initialize Zoom SDK and create authentication service

When initializing the SDK, also include the auth_service_interface.h code string.

Please do not use raw IP address as the web domain

Please do not use raw IP address as the web domain, it will put yourself into vulnerability issues. If you would like to learn why, please see our security practices for more information.

Code sample:

void AuthorizeSDK()
{
	// Initialize SDK with InitParam object
	ZOOM_SDK_NAMESPACE::InitParam initParam;
	ZOOM_SDK_NAMESPACE::SDKError initReturnVal(ZOOM_SDK_NAMESPACE::SDKERR_UNINITIALIZE);

	// Set web domain to zoom.us
	initParam.strWebDomain = L"https://zoom.us";
	initReturnVal = ZOOM_SDK_NAMESPACE::InitSDK(initParam);

	// Check if InitSDK call succeeded
	if (initReturnVal == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
	{
		// Create IAuthService object to perform Auth actions
		ZOOM_SDK_NAMESPACE::IAuthService* authService;
		ZOOM_SDK_NAMESPACE::SDKError authServiceInitReturnVal = ZOOM_SDK_NAMESPACE::CreateAuthService(&authService);

		if (authServiceInitReturnVal == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
		{
			// Create IAuthServiceEvent object to listen for Auth events from SDK
			ZOOM_SDK_NAMESPACE::IAuthServiceEvent* authListener;
			// Auth SDK with AuthContext object
			ZOOM_SDK_NAMESPACE::AuthContext authContext;
			ZOOM_SDK_NAMESPACE::SDKError authCallReturnValue(ZOOM_SDK_NAMESPACE::SDKERR_UNAUTHENTICATION);

			// Call SetEvent to assign your IAuthServiceEvent listener
			yourAuthServiceEventListener = new YourAuthServiceEventListener();
			authListener = yourAuthServiceEventListener;
			authService->SetEvent(authListener);

			// Provide your JWT to the AuthContext object
			authContext.jwt_token = L"Your JWT token here";

			authCallReturnValue = authService->SDKAuth(authContext);
			if (authCallReturnValue == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
			{
					// SDK Auth in progress
			} 

		}
	}
}

void yourAuthServiceEventListener::onAuthenticationReturn(ZOOM_SDK_NAMESPACE::AuthResult ret) {
  if (ret == ZOOM_SDK_NAMESPACE::SDKError::AUTHRET_JWTTOKENWRONG)
  {
    // SDK Auth call failed because the JWT token is invalid.
  } else if (ret == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
  {
    // SDK Authenticated successfully 
  }  
}

2. Using the authentication service

When you first start using the Zoom SDK you should do the authentication first.

2.1 Log in end-user

Code sample:

void loginUserWithEmail()
{
	// Log in end user with LoginParam object
	ZOOM_SDK_NAMESPACE::LoginParam loginParam;
	// To log in with email and password, create a LoginParam4Email object
	ZOOM_SDK_NAMESPACE::LoginParam4Email emailParam;

	loginParam.loginType = ZOOM_SDK_NAMESPACE::LoginType::LoginType_Email;
	emailParam.userName = L"End User's Zoom Email";
	emailParam.password = L"End User's Zoom Password";
	// Set bRememberMe to remeber this user
	emailParam.bRememberMe = false;
	loginParam.ut.emailLogin = emailParam;

	// Call Login on your IAuthService instance
	ZOOM_SDK_NAMESPACE::SDKError loginCallReturnValue(ZOOM_SDK_NAMESPACE::SDKERR_UNAUTHENTICATION);
	loginCallReturnValue = yourSDKInstance->authService->Login(loginParam);
	if (loginCallReturnValue == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
	{
			// SDK login call in progress.
	}
}

void yourAuthServiceEventListener::onLoginReturnWithReason(ZOOM_SDK_NAMESPACE::LOGINSTATUS ret, ZOOM_SDK_NAMESPACE::IAccountInfo* pAccountInfo, ZOOM_SDK_NAMESPACE::LoginFailReason reason)
{
  if (ret == ZOOM_SDK_NAMESPACE::SDKError::LoginFail_LoginTokenInvalid)
  {
    // SDK authService Login call failed because the login token is invalid.
  } else if (ret == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
  {
    // Login succeeded
  }  
}

2.2 Log out end-user

Code sample:

void logoutUser()
{
	// Call Logout on your IAuthService instance
	ZOOM_SDK_NAMESPACE::SDKError logoutCallReturnValue(ZOOM_SDK_NAMESPACE::SDKERR_UNKNOWN);
	logoutCallReturnValue = yourSDKInstance->authService->Logout();
	if (logoutCallReturnValue == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
	{
		// Logout call succeeded, listen for logout result using the onLogoutRet callback
	}
}

3. Meeting service

If you want to use the meeting service include the meeting_service_interface.h. code string.

3.1 Create Meeting service

Code sample:

void createMeetingService()
{
	// Create IMeetingService object to perform meeting actions
	ZOOM_SDK_NAMESPACE::IMeetingService* meetingService;
	ZOOM_SDK_NAMESPACE::SDKError meetingServiceInitReturnVal = ZOOM_SDK_NAMESPACE::CreateMeetingService(&meetingService);
	if (meetingServiceInitReturnVal == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
	{
		// MeetingService was created successfully, it is recommended to store this value for use across the application
	}
}

3.2 Start Meeting for a user that is not logged-in

The following code can be used if the user is not logged into Zoom through the SDK yet. This method requires obtaining a ZAK token for the user from the REST API, thus the user is referred to as an “API user” in the code.

Code sample:

void startMeetingForApiUser()
{
	// Start meeting for API user with StartParam object
	ZOOM_SDK_NAMESPACE::StartParam startMeetingParam;
	// Provide meeting credentials for API user using StartParam4WithoutLogin
	ZOOM_SDK_NAMESPACE::StartParam4WithoutLogin startMeetingWithoutLoginParam;

	startMeetingParam.userType = ZOOM_SDK_NAMESPACE::SDK_UT_WITHOUT_LOGIN;

	startMeetingWithoutLoginParam.zoomuserType = ZOOM_SDK_NAMESPACE::ZoomUserType_APIUSER;
	startMeetingWithoutLoginParam.meetingNumber = 1234567890;
	// Starting a meeting without the user logging in requires a ZAK token
	startMeetingWithoutLoginParam.userZAK = L"ZAK token for user";
	startMeetingWithoutLoginParam.userID = L"User ID or email for user";
	startMeetingWithoutLoginParam.userName = L"Display name for user";

	startMeetingParam.param.withoutloginStart = startMeetingWithoutLoginParam;

	ZOOM_SDK_NAMESPACE::SDKError startMeetingCallReturnValue(ZOOM_SDK_NAMESPACE::SDKERR_UNKNOWN);
	startMeetingCallReturnValue = yourMeetingServiceInstance->Start(startMeetingParam);
	if (startMeetingCallReturnValue == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
	{
		// Start meeting call succeeded, listen for start meeting result using the onMeetingStatusChanged callback
	}
}

3.3 Start Meeting for a logged-in user

The following code can be used if the end-user has logged into Zoom through the SDK already.

Code sample:

void startMeetingForEndUser()
{
	// Start meeting for end user with StartParam object
	ZOOM_SDK_NAMESPACE::StartParam startMeetingParam;
	// Provide meeting credentials for end user using StartParam4NormalUser
	ZOOM_SDK_NAMESPACE::StartParam4NormalUser startMeetingForNormalUserParam;

	startMeetingParam.userType = ZOOM_SDK_NAMESPACE::SDK_UT_NORMALUSER;

	startMeetingForNormalUserParam.meetingNumber = 1234567890;
	startMeetingParam.param.normaluserStart = startMeetingForNormalUserParam;

	ZOOM_SDK_NAMESPACE::SDKError startMeetingCallReturnValue(ZOOM_SDK_NAMESPACE::SDKERR_UNKNOWN);
	startMeetingCallReturnValue = yourMeetingServiceInstance->Start(startMeetingParam);
	if (startMeetingCallReturnValue == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
	{
		// Start meeting call succeeded, listen for start meeting result using the onMeetingStatusChanged callback
	}
}

3.4 Join Meeting for API user

Code sample:

void joinMeetingForAPIUser()
{
	// Join meeting for API user with JoinParam object
	ZOOM_SDK_NAMESPACE::JoinParam joinMeetingParam;
	// Provide meeting credentials for API user using JoinParam4WithoutLogin
	ZOOM_SDK_NAMESPACE::JoinParam4WithoutLogin joinMeetingWithoutLoginParam;

	joinMeetingParam.userType = ZOOM_SDK_NAMESPACE::SDK_UT_WITHOUT_LOGIN;

	// If there is a ZAK token for this user provide it here, otherwise use JoinParam4NormalUser instead
	joinMeetingWithoutLoginParam.userZAK = L"ZAK token for user";
	joinMeetingWithoutLoginParam.meetingNumber = 1234567890;
	joinMeetingWithoutLoginParam.psw = L"Meeting password";
	joinMeetingWithoutLoginParam.userName = L"Display name for user";

	joinMeetingParam.param.withoutloginuserJoin = joinMeetingWithoutLoginParam;

	ZOOM_SDK_NAMESPACE::SDKError joinMeetingCallReturnValue(ZOOM_SDK_NAMESPACE::SDKERR_UNKNOWN);
	joinMeetingCallReturnValue = yourMeetingServiceInstance->Join(joinMeetingParam);
	if (joinMeetingCallReturnValue == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
	{
		// Join meeting call succeeded, listen for join meeting result using the onMeetingStatusChanged callback
	}
}

3.5 Join Meeting for end-user

Code sample:

void joinMeetingForEndUser()
{
	// Join meeting for end user with JoinParam object
	ZOOM_SDK_NAMESPACE::JoinParam joinMeetingParam;
	// Provide meeting credentials for end user using JoinParam4NormalUser
	ZOOM_SDK_NAMESPACE::JoinParam4NormalUser joinMeetingForNormalUserLoginParam;

	joinMeetingParam.userType = ZOOM_SDK_NAMESPACE::SDK_UT_NORMALUSER;

	joinMeetingForNormalUserLoginParam.meetingNumber = 1234567890;
	joinMeetingForNormalUserLoginParam.psw = L"Meeting password";
	joinMeetingForNormalUserLoginParam.userName = L"Display name for user";

	joinMeetingParam.param.normaluserJoin = joinMeetingForNormalUserLoginParam;

	ZOOM_SDK_NAMESPACE::SDKError joinMeetingCallReturnValue(ZOOM_SDK_NAMESPACE::SDKERR_UNKNOWN);
	joinMeetingCallReturnValue = yourMeetingServiceInstance->Join(joinMeetingParam);
	if (joinMeetingCallReturnValue == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
	{
		// Join meeting call succeeded, listen for join meeting result using the onMeetingStatusChanged callback
	}
}

4. Meeting UI controller

You can get this controller after you have been in the meeting. If not, you can’t use this controller.

Code sample:

void getMeetingUIController()
{
	ZOOM_SDK_NAMESPACE::IMeetingUIController* meetingUIController = yourMeetingServiceInstance->GetUIController();
	if (meetingUIController)
	{
		// Use the IMeetingUIController instance to control the Zoom Meeting UI, for example:
		meetingUIController->EnterFullScreen(enableFullScreenForPrimaryMonitor, enableFullScreenForSecondaryMonitor);
		meetingUIController->ShowChatDlg(showChatDlgParam);
		meetingUIController->SwtichToAcitveSpeaker();
	}
}

4.1 Meeting configuration controller

You can set the meeting configuration controller before you call the start or join meeting API. If the meeting has ended the configuration will reset automatically.

Code sample:

void getMeetingConfigurationController()
{
	ZOOM_SDK_NAMESPACE::IMeetingConfiguration* meetingConfiguration = yourMeetingServiceInstance->GetMeetingConfiguration();
	if (meetingConfiguration)
	{
		// Use the IMeetingConfiguration instance to control the Zoom Meeting Configuration, for example:
		meetingConfiguration->EnableForceAutoStartMyVideoWhenJoinMeeting(true);
		meetingConfiguration->DisableAttendeeMenuItem(attendeeMenuItem);
		meetingConfiguration->HideShareButtonOnMeetingUI(true);
	}
}

4.2 Meeting annotation controller

You can get this controller when you or someone else are sharing screens. If not, this controller will not be accessible to you.

Code sample:

void getMeetingAnnotationController()
{
	ZOOM_SDK_NAMESPACE::IAnnotationController* meetingAnnotationController = yourMeetingServiceInstance->GetAnnotationController();
	if (meetingAnnotationController)
	{
		// Use the IAnnotationController instance to control the Zoom Meeting Annotations, for example:
		meetingAnnotationController->CanDoAnnotation();
		meetingAnnotationController->StartAnnotation(ZOOM_SDK_NAMESPACE::SDK_FIRST_VIEW);
		meetingAnnotationController->SetColor(ZOOM_SDK_NAMESPACE::SDK_FIRST_VIEW, RGB(255, 255, 255));
		meetingAnnotationController->StopAnnotation(ZOOM_SDK_NAMESPACE::SDK_FIRST_VIEW);
	}
}

5. Setting service

If you want to use this service, include the setting_service_interface.h. code string.

Code sample:

void createSettingService() {
	// Create ISettingService object to perform setting actions
	ZOOM_SDK_NAMESPACE::ISettingService* settingService;
	ZOOM_SDK_NAMESPACE::SDKError settingServiceInitReturnVal = ZOOM_SDK_NAMESPACE::CreateSettingService(&settingService);
	if (settingServiceInitReturnVal == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
	{
		// SettingService was created successfully, it is recommended to store this value for use across the application
		// Use the ISettingService instance to control the meeting settings, for example:
		settingService->GetRecordingSettings();
		settingService->ShowSettingDlg(showSettingDialogueParam);
		settingService->GetVideoSettings();
	}
}