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.
Add the following content to the podfile file.
// Only TUIKit 4.8.50 and later versions support the voice and video call features.
pod 'TXIMSDK_TUIKit_iOS' // By default, the audio and video library of the TXLiteAVSDK_TRTC version is integrated.
// pod 'TXIMSDK_TUIKit_iOS_Professional' // By default, the audio and video library of the TXLiteAVSDK_Professional version is integrated.
You cannot integrate different Tencent Cloud audio and video libraries at the same time as this will cause symbol conflicts. If you use a library not of the TRTC version, we recommend that you remove it and integrate the TXIMSDK_TUIKit_iOS_Professional
version. The audio and video library of the LiteAV_Professional version contains all basic audio and video capabilities.
Run the following command to download the third-party library to the current project:
pod install
If you cannot install the latest TUIKit version, run the following command to update the local CocoaPods repository list:
pod repo update
To initialize TUIKit, enter the SDKAppID generated in Step 1.
[[TUIKit sharedInstance] setupWithAppId:SDKAppID];
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 sharedInstance] login:@"userID" userSig:@"userSig" succ:^{
NSLog(@"-----> Login successful");
} fail:^(int code, NSString *msg) {
NSLog(@"-----> 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.
To implement offline push for voice and video calls, follow these steps:
sendAPNsForCall
function in the TUICall+Signal.m
class.didReceiveRemoteNotification
callback in the AppDelegate source code 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, modify the following code in the TRTCCall+Room.swift
source code:
func enterRoom() {
let param = TRTCParams()
// TRTC SDKAppID
param.sdkAppId = 1000000000
// UserSig generated based on the TRTC SDKAppID
param.userSig = "userSig"
}
The default call invitation timeout time is 30s. You can modify the timeOut
field in TRTCCall.swift
to customize the timeout time.
You cannot integrate different Tencent Cloud audio and video libraries at the same time as this will cause symbol conflicts. If you use a library not of the TRTC version, we recommend that you remove it and integrate the TXIMSDK_TUIKit_iOS_Professional
version. The audio and video library of the LiteAV_Professional version contains all basic audio and video capabilities.
If you use a LiteAV_Enterprise audio and video library, it cannot coexist with TUIKit.
Was this page helpful?