TUICalling
is an open-source UI component for audio/video communication. With just a few lines of code changes, you can integrate it into your project to implement one-to-one audio/video calls that support offline push notifications. In addition to the iOS component, we also offer components for Android, web, Flutter, UniApp, and more.
Note:All components of TUIKit use two basic PaaS services of Tencent Cloud, namely TRTC and IM. When you activate TRTC, IM and the trial edition of the IM SDK (which supports only 100 DAUs) will be activated automatically. For the billing details of IM, see Pricing.
![]() |
TUICalling
componentTo import the component using CocoaPods, follow the steps below:
TUICalling
folder in the same directory as Podfile
in your project.Source
and Resources
folders and the TUICalling.podspec
file in TUICalling/iOS/ to the TUICalling
folder in your project.Podfile
and run pod install
to import the component.# :path => "The relative path of `TUICalling.podspec`"
pod 'TUICalling', :path => "TUICalling/TUICalling.podspec", :subspecs => ["TRTC"]
Note:The
Source
andResources
folders and theTUICalling.podspec
file must be in the same directory.
Your app needs mic and camera permissions to implement audio/video communication. Add the two items below to 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>
// 1. Log in to the component
[TUILogin initWithSdkAppID:@"Your SDKAppID"];
[TUILogin login:@"Your UserID" userSig:@"Your UserSig" succ:^{
NSLog(@"login success");
} fail:^(int code, NSString *msg) {
NSLog(@"login failed, code: %d, error: %@", code, msg);
}];
// 2. Initialize the `TUICalling` instance
[TUICalling shareInstance];
Parameter description:
SDKAppID
.SDKAppID
. You can view your application’s secret key on the Application Management page of the TRTC console.SDKAppID
, userID
, and SecretKey
. You can click here to quickly generate a UserSig
for testing or calculate it on your own by referring to our TUICalling demo project. For more information, see UserSig.Make a one-to-one audio/video call using TUICalling#call:
// Make a one-to-one video call. Suppose the `userId` is `1111`
[[TUICalling shareInstance] call:@[@"1111"] type:TUICallingTypeVideo];
Note:After the callee completes step 3, (that is, after successful login), the
TUICalling
component will display the call answering UI when the callee receives a call invitation.
You can make audio/video calls after completing the previous four steps. However, if you want your users to be able to receive call invitations even when your app is in the background or after it is closed, then you need to also implement the offline push notification feature. For details, see Offline Push (iOS).
If you want to be notified of call status (for example, the start and end of a call), register the following listeners:
[[TUICalling shareInstance] setCallingListener:self];
- (BOOL)shouldShowOnCallView {
return YES;
}
- (void)callStart:(nonnull NSArray<nsstring *=""> *)userIDs type:(TUICallingType)type role:(TUICallingRole)role viewController:(UIViewController * _Nullable)viewController {
}
- (void)callEnd:(nonnull NSArray<nsstring *=""> *)userIDs type:(TUICallingType)type role:(TUICallingRole)role totalTime:(float)totalTime {
}
- (void)onCallEvent:(TUICallingEvent)event type:(TUICallingType)type role:(TUICallingRole)role message:(nonnull NSString *)message {
}
To implement the floating window feature in your app, call TUICalling.shareInstance().enableFloatWindow(enable: true)
when initializing the TUICalling
component.
Note:Currently, the iOS component supports only in-app floating windows (after users tap the Back button to return to a previous page).
TUICalling
component support customizing ringtones?Yes. You can implement this by calling TUICalling#setCallingBell.
Enter the following command in a terminal window (you need to install Ruby on your Mac first):
sudo gem install cocoapods
TUICalling
run in the background?Yes. If you want the SDK to run in the background, select your project, under the Capabilities tab, toggle on Background Modes, and select Audio, AirPlay, and Picture in Picture.
Note:If you have any requirements or feedback, contact colleenyu@tencent.com.
Was this page helpful?