Add video capability to the Contact Center SDK for Android

View as Markdown

After initializing the SDK, call the getZoomCCVideoService (Java) or zoomCCVideoService (Kotlin) function to get ZoomCCVideoService and initialize it with the ZoomCCItem class. Then call fetchUI to open the WaitingRoom view.

Show video from the requesting server

ZoomCCVideoService service = ZoomCCInterface.INSTANCE.getZoomCCVideoService();
ZoomCCItem item = new ZoomCCItem(VideoEntryId, null, ZoomCCIInterfaceType.VIDEO, CCServerType.CCServerWWW);
service.init(item);
service.fetchUI();

Pass engagement variables (optional)

To pass host application context variables to a video engagement, configure custom variables in Contact Center Management and set its value source to Application. Before calling init(), use the configured attributeName as the key and the application-provided value as the map value in ZoomCCItem.engagementVariables.

ZoomCCVideoService service = ZoomCCInterface.INSTANCE.getZoomCCVideoService();
ZoomCCItem item = new ZoomCCItem(VideoEntryId, null, ZoomCCIInterfaceType.VIDEO, CCServerType.CCServerWWW);
item.setEngagementVariables(Map.of("customAttribute", "customValue"));
service.init(item);
service.fetchUI();

End video

ZoomCCVideoService service = ZoomCCInterface.INSTANCE.getZoomCCVideoService();
service.endVideo();

Log off of the service

If you don't want to receive further callbacks from the SDK, call logoff().

ZoomCCVideoService videoService = ZoomCCInterface.INSTANCE.getZoomCCVideoService();
videoService.logoff();

Release SDK resources

To release SDK resources, call releaseZoomCCService in onDestroy().

protected void onDestroy() {
ZoomCCInterface.INSTANCE.releaseZoomCCService("VideoEntryId");
super.onDestroy();
}

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.

ZoomCCVideoService service = ZoomCCInterface.INSTANCE.getZoomCCVideoService();
service.endVideo();

Callbacks

These callbacks are available for both chat and video.

Implement listeners and see the available callback functions.

Implement a listener

To subscribe to these events, define your own instance of the ZoomCCChatListener object and add it to the SDK by calling the addListener function. See how to implement this listener and assign it to the SDK instance, along with examples of the event handlers associated with the SDK.

Add a listener

ZoomCCChatService service = ZoomCCInterface.INSTANCE.getZoomCCChatService();
service.addListener(your listener);

Callback functions

These examples show callback functions provided by the Contact Center SDK. Use these functions and implement any additional operations as needed after receiving the result of the callback function.

onEngagementVariablesRequired

Called after login when the engagement application variables are known. Each map 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.

  • variables - (List<Map<String, String>>) variable definitions returned by Contact Center.

onLoginStatus

Called when the service login status changes.

  • status - the login status.

onError

Called when a service error occurs.

  • error - (Int) the service error code. See errors for details.
  • detail - (Long) the detail code.
  • description - (String) the error description.

onEngagementStart

Sent after the service creates an engagement.

  • engagementId - (string) the engagement identifier.

onEngagementEnd

Sent after the engagement ends.

  • engagementId - (string) the engagement identifier.

unreadMsgCountChanged

Sent when the number of unread messages changes.

  • unreadMsgCountChanged - (integer) the number of unread messages.

onClientEvent

Called when VIDEO_STARTED, VIDEO_END, NOTIFICATION_JOIN_CALL, VIDEO_CLIENT_END, VIDEO_FORCE_END, and TASK_CREATED events are triggered.

  • ClientEvent: the event that occurred.