Call | Answer |
| |
TUICalling
component. You no longer need to pay attention to UI as it is now implemented within the TUICalling
component.TestVideoCall
and click Create.iOS/Example/Debug/GenerateTestUserSig.swift
.GenerateTestUserSig.swift
:TUICalling/Example/TUICallingApp.xcworkspace
with Xcode (version 11.0 or above) and click Run.userId
of the person you want to call and tap Search.Source
folder contains three subfolders: ui
, model
, and Service
. The Service
subfolder includes the open-source TUICallingManager
component, which we share with the public. You can find the component’s APIs in the TUICallingManager.h
file.TUICalling
and TUICallingManager
components, with no need to implement complicated call UI or logic by yourself.TRTCCalling
depends on the TRTC SDK and IM SDK. You can integrate the two SDKs into your project by following the steps below:pod 'TXIMSDK_iOS'pod 'TXLiteAVSDK_TRTC'
SDK | Download Page | Integration Guide |
TRTC SDK | ||
IM SDK |
Privacy - Camera Usage Description
and Privacy - Microphone Usage Description
in info.plist
.TUICalling
componentSource
, Resources
, and TXAppBasic
folders and the TUICalling.podspec
file under the demo project directory to your project directory.Podfile
and run pod install
to complete the import.pod 'TXAppBasic', :path => "../TXAppBasic/"pod 'TXLiteAVSDK_TRTC'pod 'TUICalling', :path => "../", :subspecs => ["TRTC"]
TUICallingManager.sharedInstance()
to initialize the component.TUILogin.initWithSdkAppID(SDKAPPID)
to initialize login.TUILogin.login(userId, userSig)
to log in to the component. Specify the key parameters as described below:Parameter | Description |
sdkAppID | |
userId | ID of the current user, which is a string that can contain letters (a-z and A-Z), digits (0-9), hyphens (-), and underscores (_). We recommend you set it based on your business account system. |
userSig |
// Initialize the componentTUICallingManager.sharedInstance();// Log in to the componentTUILogin.initWithSdkAppID(SDKAPPID)TUILogin.login(userId, userSig) {print("login success")} fail: { code, errorDes inprint("login failed, code:\\(code), error: \\(errorDes ?? "nil")")}
call();
of TUICallingManager
to initiate a call, passing in the user IDs (userIDs
) and call type (type
). For the call type, you can pass in .audio
(audio call) or .video
(video call). If only one user ID is passed in for userIDs
, the call is a one-to-one call; if two or more user IDs are passed in, the call is a group call.// 1. Register the listenerTUICallingManager.shareInstance().setCallingListener(listener: TUICallingListerner())// 2. Set whether to enable custom views (disabled by default)TUICallingManager.shareInstance().enableCustomViewRoute(enable: true)// 3. Set callbackspublic func shouldShowOnCallView() -> Bool {return true;}public func callStart(userIDs: [String], type: TUICallingType, role: TUICallingRole, viewController: UIViewController?) { if let vc = viewController {callingVC = vc;vc.modalPresentationStyle = .fullScreenif var topController = UIApplication.shared.keyWindow?.rootViewController {while let presentedViewController = topController.presentedViewController {topController = presentedViewController}if let navigationVC = topController as? UINavigationController {if navigationVC.viewControllers.contains(self) {present(vc, animated: false, completion: nil)} else {navigationVC.popToRootViewController(animated: false)navigationVC.pushViewController(self, animated: false)navigationVC.present(vc, animated: false, completion: nil)}} else {topController.present(vc, animated: false, completion: nil)}}}}public func callEnd(userIDs: [String], type: TUICallingType, role: TUICallingRole, totalTime: Float) {callingVC.dismiss(animated: true, completion: nil)}public func onCallEvent(event: TUICallingEvent, type: TUICallingType, role: TUICallingRole, message: String) {}// 4.Make a callTUICallingManager.shareInstance().call(userIDs, .video)
sendModel
) of TRTCCallingImpl
. After completing the offline push configuration for your application, you will be able to send notifications to offline users.TUICalling
component.API | Description |
call | Sends call invitations by user ID. |
receiveAPNSCalled | Answers a call. |
setCallingListener | Sets the listener. |
setCallingBell | Sets the ringtone (preferably shorter than 30s). |
enableMuteMode | Enables/Disables the mute mode. |
enableCustomViewRoute | Enables/Disables custom views. After enabling custom views, you will receive a CallingView instance in the callback for calling/being called, and can decide how to display the view by yourself. The view must be displayed full screen or in proportion to the screen size; otherwise, an error may occur. |
Was this page helpful?