Integrate Audio and Video Calling Features
This document introduces how to use the ZEGOCLOUD Call Kit to add audio and video calling capabilities to ZIMKit.
Implementation Process
Please refer to the Quick Start to integrate IMKit. If it has already been integrated, you can skip this step.
Modify your app module's build.gradle file and add the CallKit dependency:
dependencies {
...
implementation 'com.github.ZEGOCLOUD:zego_uikit_prebuilt_call_android:+' // add this line in your module-level build.gradle file's dependencies, usually named [app].
}
In previous steps, you used the following code to initialize ZIMKit:
Long appId = ; // The AppID you get from ZEGOCLOUD Admin Console.
String appSign = ; // The App Sign you get from ZEGOCLOUD Admin Console.
ZIMKit.initWith(this,appId,appSign);
ZIMKit.initNotifications(); // Online notification for the initialization (use the following code if this is needed).
To integrate the audio and video calling feature, you need to use the method with ZIMKitConfig
class parameters for initialization:
ZIMKitConfig zimKitConfig = new ZIMKitConfig();
Long appId = ; // The AppID you get from ZEGOCLOUD Admin Console.
String appSign = ; // The App Sign you get from ZEGOCLOUD Admin Console.
ZIMKit.initWith(this,appId,appSign,zimKitConfig);
ZIMKit.initNotifications(); // Online notification for the initialization (use the following code if this is needed).
In the ZIMKitConfig
class, we can enable the audio and video calling features by creating a ZegoCallPluginConfig
object:
ZIMKitConfig zimKitConfig = ;
// ...
zimKitConfig.callPluginConfig = new ZegoCallPluginConfig();
After enabling the CallKit feature, we can add audio and video call buttons by configuring the ZIMKitConfig
's ZIMKitInputConfig
parameter:
ZIMKitConfig zimKitConfig = new ZIMKitConfig();
zimKitConfig.callPluginConfig = new ZegoCallPluginConfig();
zimKitConfig.inputConfig.expandButtons.add(ZIMKitInputButtonName.VOICE_CALL);
zimKitConfig.inputConfig.expandButtons.add(ZIMKitInputButtonName.VIDEO_CALL);
After configuration, the input box on the chat page will have voice and video calling buttons. Clicking on them will bring up a secondary menu where you can choose to make a video call or a voice call (group calls are not supported at the moment).
More resources
The above content only introduces the basic configuration required to integrate the audio and video calling UIKit. If you need to further customize the call configuration, you can set:
ZIMKitConfig zimKitConfig = ;
// ...
zimKitConfig.callPluginConfig = new ZegoCallPluginConfig();
// Customize call configuration
ZegoUIKitPrebuiltCallInvitationConfig invitationConfig = new ZegoUIKitPrebuiltCallInvitationConfig();
zimKitConfig.callPluginConfig.invitationConfig = invitationConfig; // opt,invitationConfig for call
zimKitConfig.callPluginConfig.resourceID = ; // opt,resourceID for call
For information on customizing call functions using ZegoUIKitPrebuiltCallInvitationConfig, please refer to the following documentation:
This article introduces how to further customize the functions and interfaces of the call.