How to Add Call Status Observer in Your iOS App
In your audio and video calling application on the iOS platform, you may need to use callback functions to obtain the user's call status and make timely responses. For example, when you know that the current call is a group call, you may need to allocate more resources to reduce latency and ensure a better calling experience for users. Tencent RTC Call (TUICallKit) provides developers with a rich set of callback functions to meet various business requirements.
For more information, please refer to our technical documentation, which includes the API documentation for TUICallObserver. It provides detailed information about the parameters and more. Feel free to explore it.
Now, let's take the callbacks "onCallReceived", "onCallBegin", and "onCallEnd" as examples to guide you on how to invoke callback functions in your iOS project.
Video Tutorial
How to Use TUICallObserver in Your iOS Calling App?
Note: If you haven't set up your own iOS audio and video calling application yet, please refer to this tutorial blog: "How to Build A Video Calling App on iOS" and follow the steps to enter the TRTC console for creating your Call application.
Step 1: Import the TUICallEngine component and add the TUICallObserver protocol.
To begin, navigate to your iOS project and import the TUICallEngine component. Then, add the TUICallObserver protocol at the appropriate location, as shown in the following image:
Next, register the callback events in the TUILogin function. Here, you will need to use TUICallEngine and add the callbacks:
import TUICallEngine
TUICallEngine.createInstance().add(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]) {
}