Add video capabilities to the Contact Center SDK for iOS

View as Markdown

Initialize the video service

Create an instance of class ZoomCCItem to set the channel to use, chat or video. For video, set the sdkType property to ZoomCCIInterfaceType_Video.

Include the entryId from your Zoom Contact Center flow.

ZoomCCItem *item = [ZoomCCItem new];
item.sdkType = ZoomCCIInterfaceType_Video;
item.entryId = APP_VIDEO_ENTRY_ID;

Pass engagement variables (optional)

To pass custom application context variables to a video engagement, configure custom variables in Contact Center Management and set its value source to Application. Before calling initializeWithItem, use the variable name as the key and the application-provided value as the dictionary value in ZoomCCItem.engagementVariables.

ZoomCCItem *item = [ZoomCCItem new];
item.sdkType = ZoomCCIInterfaceType_Video;
item.entryId = APP_VIDEO_ENTRY_ID;
item.engagementVariables = @{@"test_key":@"test_value"};

Fetch the video service instance

Fetch the video service instance and set its delegate to receive callbacks from ZoomCCSDK. Initialize the service by calling initializeWithItem:. The service will connect to the Contact Center server to fetch the video information.

id<ZoomCCVideoService> videoService = [[ZoomCCInterface sharedInstance] videoService];
videoService.videoDelegate = self;
[videoService initializeWithItem:item];

Show the video view

To show the video view, call the function below. The call back gets the view's instance and displays it. The videoService requests to start a video session with the Contact Center server. Once it is ready, the user can join the video session automatically inside the ZoomCCSDK inner view.

__weak typeof(self) wself = self;
[videoService fetchUI:^(UIViewController * _Nonnull viewController) {
[wself directShow:viewController];
}];

Forcibly end an active video engagement

To forcibly end a video engagement, use the endVideo method. This action closes the video view and releases any associated service instances within the Contact Center SDK.

id<ZoomCCVideoService> videoService = [[ZoomCCInterface sharedInstance] videoService];
[videoService endVideo];

Callbacks

These callbacks are available for both chat and video.

onEngagementVariablesRequired

Called after login when the engagement application variables are known. Each dictionary can contain variableGroupName, variableName, and attributeName. Use attributeName as the key in ZoomCCItem.engagementVariables.

This callback only reports the variable definitions; the SDK sends matching values when the engagement is created.

  • service: the current service.
  • variables: an array of dictionaries describing variables that the current engagement may require. Each dictionary can contain variableGroupName, variableName, or attributeName.
- (void)onService:(id<ZoomCCService>)service
engagementVariablesRequired:(NSArray<NSDictionary<NSString *, NSString *> *> *)variables;

error

Sent after a service error.

  • service — the current service.
  • error — the service error code. See errors for details.
  • detail — the error details.
- (void)onService:(id<ZoomCCService>)service error:(NSUInteger)error  detail:(NSInteger)detail;

engagementStart

Sent after the service creates an engagement.

  • service — the current service.
  • engagementId — the engagement identifier.
- (void)onService:(id<ZoomCCService>)service engagementStart:(NSString*)engagementId;

engagementEnd

Sent after the engagement ends.

  • service — the current service.
  • engagementId — the engagement identifier.
- (void)onService:(id<ZoomCCService>)service engagementEnd:(NSString*)engagementId;

eventChange

Sent when a change has occurred, for example, due to a user action.

  • service — the current service.
  • event — the event that occurred.
- (void)onService:(id<ZoomCCService>)service eventChange:(ZoomCCSDKEvent)event;

loginStatusChanged

Sent when the login status has changed.

  • service — the current service.
  • status — the service status. ZoomCCSDKStatus_Login means the logging succeeded.
- (void)onService:(id<ZoomCCService>)service loginStatusChanged:(ZoomCCSDKStatus)status;

unreadMsgCountChanged (chat only)

Sent when the number of unread messages has changed. Only sent for chat.

  • service — the current service.
  • status — the service status. ZoomCCSDKStatus_Login means the logging succeeded.
- (void)onChatService:(id<ZoomCCChatService>)service unreadMsgCountChanged:(NSUInteger)count;