TUIKit 4.8.50 and later versions provide video and voice call features for one-to-one and group chats based on TRTC and support interconnection between iOS and Android platforms. To quickly integrate TUIKit video and voice call features, follow the steps described in this document.
Note:
- In TUIKit 4.8.50 and later versions, the voice and video call features are integrated in the TUIKit component and designed based on the new signaling solution.
- In versions earlier than TUIKit 4.8.50, the voice and video call features are integrated in the TUIKitDemo sample on the iOS client. If you use the voice and video call features of an earlier version, we do not recommend that you upgrade the version to avoid compatibility issues.
We recommend that you use source code to integrate TUIKit so that you can modify the source code to meet your business requirements.
implementation project(':tuikit')
To initialize TUIKit, enter the SDKAppID generated in Step 1.
TUIKitConfigs configs = TUIKit.getConfigs();
TUIKit.init(this, SDKAPPID, configs);
Call the login
API provided by TUIKit to log in to IM. For more information on how to generate UserSig, see How to Generate Usersig.
TUIKit.login(userID, userSig, new IUIKitCallBack() {
@Override
public void onSuccess(Object data) {
//Login successful
}
@Override
public void onError(String module, final int code, final String desc) {
// Login failed
}
});
When you tap Video or Voice on the chat UI, TUIKit displays the call invitation UI and sends a call request to the peer.
When an online user receives a call invitation, TUIKit displays the call accept UI. The user can answer or reject the call.
When an offline user receives a call invitation, offline push is required to wake up the app call UI. For more information about offline push, see Step 7.
To implement offline push for voice and video calls, follow these steps:
sendOnlineMessageWithOfflinePushInfo
method in the TRTCAVCallImpl.java class.redirect
method in the OfflineMessageDispatcher.java class to wake up the call UI.If you have created the TRTC and IM SDKAppIDs, you cannot use the same account or authentication information for these two applications. You need to generate a UserSig corresponding to the TRTC SDKAppID to perform authentication. For more information on how to generate UserSig, see How to Generate Usersig.
After obtaining the TRTC SDKAppID and UserSig, you need to replace the corresponding values in the TRTCAVCallImpl
source code.
private void enterTRTCRoom() {
...
TRTCCloudDef.TRTCParams TRTCParams = new TRTCCloudDef.TRTCParams(mSdkAppId, mCurUserId, mCurUserSig, mCurRoomID, "", "");
...
}
The default call invitation timeout time is 30s. You can modify the TIME_OUT_COUNT
field in TRTCAVCallImpl
to customize the timeout time.
Was this page helpful?