TUICallKit
component. Performing the following key steps generally takes about an hour, after which you can implement the video call feature with complete UIs.Podfile
.pod 'TUICallKit_Swift'
pod 'TUICallKit'
pod install
TUICallKit
cannot be installed, run the following command to update the local CocoaPods repository list:pod repo update
pod update
Info.plist
of your app. Their content is what users see in the mic and camera access pop-up windows.<key>NSCameraUsageDescription</key><string>CallingApp needs to access your camera to capture video.</string><key>NSMicrophoneUsageDescription</key><string>CallingApp needs to access your mic to capture audio.</string>
TUICallKit
componentTUICore
to log in to the TUICallKit
component. This step is very important, as the user can use the component features properly only after a successful login. Carefully check whether the relevant parameters are correctly configured:import TUICoreTUILogin.login(1400000001, // Replace it with the `SDKAppID` obtained in step 1.userID: "denny", // Replace it with your `UserID`.userSig: "xxxxxxxxxxx") { // You can calculate a `UserSig` in the console and enter it here.print("login success")} fail: { (code, message) inprint("login failed, code: \\(code), error: \\(message ?? "nil")")}
#import <TUICore/TUILogin.h>[TUILogin login:1400000001 // Replace it with the `SDKAppID` obtained in step 1.userID:@"denny" // Replace it with your `UserID`.userSig:@"xxxxxxxxxxx" // You can calculate a `UserSig` in the console and enter it here.succ:^{NSLog(@"login success");} fail:^(int code, NSString *msg) {NSLog(@"login failed, code: %d, error: %@", code, msg);}
login
function are as detailed below:SDKSecretKey
to encrypt the information such as SDKAppID
and UserID
. You can generate a temporary UserSig
by clicking the UserSig Generate button in the console.genTestUserSig
function to calculate UserSig
locally, so as to help you complete the current integration process more quickly. However, this scheme exposes your SecretKey
in the application code, which makes it difficult for you to upgrade and protect your SecretKey
subsequently. Therefore, we strongly recommend you run the UserSig
calculation logic on the server and make the application request the UserSig
calculated in real time every time the application uses the TUICallKit
component from the server.call
function of TUICallKit
and specify the call type and the callee's userId
to make an audio/video call.import TUICallKit// Make a one-to-one video call. Suppose the `userId` is `mike`.TUICallKit.createInstance().call(userId: "mike", callMediaType: .video)
#import <TUICallKit/TUICallKit.h>// Make a one-to-one video call. Suppose the `userId` is `mike`.[[TUICallKit createInstance] call:@"mike" callMediaType:TUICallMediaTypeVideo];
Parameter | Type | Description |
userId | String | The ID of the target user, such as "mike" . |
callMediaType | TUICallMediaType | The call media type, such as TUICallMediaTypeVideo . |
groupCall
function of TUICallKit
and specify the call type and the list of callees' UserID
values to make a group audio/video call.import TUICallKitTUICallKit.createInstance().groupCall(groupId: "12345678",userIdList: ["denny", "mike", "tommy"],callMediaType: .video)
#import <TUICallKit/TUICallKit.h>[[TUICallKit createInstance] groupCall:@"12345678"userIdList:@[@"denny", @"mike", @"tommy"]callMediaType:TUICallMediaTypeVideo];
Parameter | Type | Description |
groupId | String | The group ID, such as "12345678" . |
userIdList | Array | The list of userId values of the target users, such as ["denny", "mike", "tommy"] |
callMediaType | TUICallMediaType | The call media type, such as TUICallMediaTypeVideo . |
TUICallKit
currently doesn't support making a group video call among users not in a group. If you have such a need, please contact info_rtc@tencent.com.TUICallKit
component will automatically display the call answering UI.TUICallKit.createInstance().setSelfInfo(nickname: "nickname", avatar: "avatar url") {} fail: { code, message in}
[[TUICallKit createInstance] setSelfInfo:@"nickname" avatar:@"avatar url" succ:^{} fail:^(int code, NSString *errMsg) {}];
TUICallKit
component:TUICallKit.createInstance().enableFloatWindow(true)
[[TUICallKit createInstance] enableFloatWindow:YES];
import TUICallEngineTUICallEngine.createInstance().addObserver(self)public func onCallBegin(roomId: TUIRoomId, callMediaType: TUICallMediaType, callRole: TUICallRole) {}public func onCallEnd(roomId: TUIRoomId, callMediaType: TUICallMediaType, callRole: TUICallRole, totalTime: Float) {}public func onUserNetworkQualityChanged(networkQualityList: [TUINetworkQualityInfo]) {}
#import <TUICallEngine/TUICallEngine.h>[[TUICallEngine createInstance] addObserver:self];- (void)onCallBegin:(TUIRoomId *)roomId callMediaType:(TUICallMediaType)callMediaType callRole:(TUICallRole)callRole {}- (void)onCallEnd:(TUIRoomId *)roomId callMediaType:(TUICallMediaType)callMediaType callRole:(TUICallRole)callRole totalTime:(float)totalTime {}- (void)onUserNetworkQualityChanged:(NSArray<TUINetworkQualityInfo *> *)networkQualityList {}
TUICallKit.createInstance().setCallingBell(filePath: " ")
[[TUICallKit createInstance] setCallingBell:@" "];
let callParams = TUICallParams()let offlinePushInfo = TUIOfflinePushInfo()callParams.offlinePushInfo = offlinePushInfocallParams.timeout = 30callParams.userData = "user data"TUICallKit.createInstance().call(userId: "mike", callMediaType: .video, params: callParams) {} fail: { code, message in}
TUICallParams *callParams = [TUICallParams new];callParams.offlinePushInfo = [TUIOfflinePushInfo new];callParams.timeout = 30;callParams.userData = @"user data";[[TUICallKit createInstance] call:@"mike"callMediaType:TUICallMediaTypeVideoparams:callParamssucc:^{} fail:^(int code, NSString * _Nullable errMsg) {}];
TUICallKit
.
Was this page helpful?