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;
let item = ZoomCCItem.init()
item.sdkType = .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"};
let item = ZoomCCItem.init()
item.sdkType = .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];
let videoService = ZoomCCInterface.sharedInstance().videoService()
videoService.videoDelegate = self
if (videoService.status == .initial) {
videoService.initialize(with: 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];
}];
videoService.fetchUI { vc in
self.navigationController?.pushViewController(vc, animated: true)
}
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];
let videoService = ZoomCCInterface.sharedInstance().videoService()
videoService.endVideo()
Callbacks
These callbacks are available for both chat and video.
onEngagementVariablesRequirederrorengagementStartengagementEndeventChangeloginStatusChangedunreadMsgCountChanged(chat only)
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 containvariableGroupName,variableName, orattributeName.
- (void)onService:(id<ZoomCCService>)service
engagementVariablesRequired:(NSArray<NSDictionary<NSString *, NSString *> *> *)variables;
func onService(_ service: ZoomCCService, engagementVariablesRequired variables: [[String: String]]) {
}
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;
func onService(_ service: ZoomCCService, error: UInt, detail: Int) {
}
engagementStart
Sent after the service creates an engagement.
service— the current service.engagementId— the engagement identifier.
- (void)onService:(id<ZoomCCService>)service engagementStart:(NSString*)engagementId;
func onService(_ service: ZoomCCService, engagementStart engagementId: String) {
}
engagementEnd
Sent after the engagement ends.
service— the current service.engagementId— the engagement identifier.
- (void)onService:(id<ZoomCCService>)service engagementEnd:(NSString*)engagementId;
func onService(_ service: ZoomCCService, engagementEnd engagementId: String) {
}
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;
func onService(_ service: ZoomCCService, eventChange event: ZoomCCSDKEvent) {
}
loginStatusChanged
Sent when the login status has changed.
service— the current service.status— the service status.ZoomCCSDKStatus_Loginmeans the logging succeeded.
- (void)onService:(id<ZoomCCService>)service loginStatusChanged:(ZoomCCSDKStatus)status;
func onService(_ service: ZoomCCService, loginStatusChanged status: ZoomCCSDKStatus) {
}
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_Loginmeans the logging succeeded.
- (void)onChatService:(id<ZoomCCChatService>)service unreadMsgCountChanged:(NSUInteger)count;
func onChatService(_ service: ZoomCCChatService, unreadMsgCountChanged count: UInt) {
}