업그레이드
Upgrade Instructions
TUICallKit is a new audio and video calling UI component launched by Tencent Cloud. It is an upgraded version of TUICalling, which supports more functional features such as group calling and AI noise reduction, and supports calling between all platforms with greater stability. We welcome you to use the new TUICallKit component. Before upgrading, please note the following:
TUICalling and TUICallKit support mutual calling. Please keep the SDKAppID unchanged before and after the upgrade, otherwise it will affect mutual communication.
TUICallKit needs to be used with the IM audio and video calling capability package. You can click on the IM console, enter the Basic Configuration page of the corresponding SDKAppID application, and find the Call function area in the lower right corner of the page. Click Try now to open TUICallKit's 7-day free trial service. If you need to officially launch the application, click Purchase to enter the purchase page.
Note:
The IM audio and video calling capability provides differentiated paid versions for different business needs, and you can learn about the included features and purchase the version that suits you on the IM purchase page.
Upgrade Steps
TUICallKit was designed to accommodate the upgrade needs of TUICalling customers, and can be upgraded in just two simple steps, which is expected to take 20 minutes:
Upgrade the dependency to TUICallKit
Complete the dependency upgrade to TUICallKit in your project and set the configuration file pubspec.yaml for your project:
dependencies:# Remove the old dependency tim_ui_kit_calling_plugin and add the new dependency tencent_calls_uikit:tencent_calls_uikit:
After setting up, execute the command
flutter pub get
.Note:
If you previously used it with IM components such as TUIChat and TUIContact, you can use TUICallKit normally after completing this step. The compatibility logic has been handled internally in the TUICallKit component.
2、Modify API usage
After completing the above steps, your project will not compile normally. You need to replace the TUICalling API with the new TUICallKit API. You can refer to the following API comparison information and search and replace it.
API meaning | TUICalling(tim_ui_kit_calling_plugin) | TUICallKit(tencent_calls_uikit) | Explanation |
Create a TUICallKit instance | TUICalling.sharedInstance | Replace reference and name. | |
Set the user's nickname | TUICalling.setUserNickname | Integrate the interface for setting avatar and nickname into the setSelfInfo interface. | |
Set the user's avatar | TUICalling.setUserAvatar | Integrate the interface for setting avatar and nickname into the setSelfInfo interface. | |
Initiate a 1v1 call | TUICalling.call | See TUICalling.call interface changes for details. | |
Initiate a group call | / | / | |
Actively join the current group call | / | / | |
Set custom ringtone | TUICalling.setCallingBell | Replace reference and name. | |
Enable/disable mute mode | TUICalling.enableMuteMode | Replace reference and name. | |
Enable/disable floating window function | TUICalling.enableFloatWindow | Replace reference and name. | |
Set listener | TUICalling.registerListener | See TUICalling.registerListener interface changes for details. |
Here are the adaptation solutions for the two APIs with significant changes during this upgrade:
TUICalling.call Interface Changes
TUICalling Code Example:
// Original InterfaceFuture<void> call(String userId, CallingScenes type, [OfflinePushInfo? offlinePushInfo]);
TUICallKit Code Example:
// New InterfaceFuture<void> call(String userId, TUICallMediaType callMediaType, [TUICallParams? params]);// New Calling MethodTUIOfflinePushInfo offlinePushInfo = TUIOfflinePushInfo();offlinePushInfo.title = "Flutter TUICallKit";offlinePushInfo.desc = "This is an incoming call from Flutter TUICallkit";TUICallParams params = TUICallParams(offlinePushInfo: offlinePushInfo);TUICallKit.instance.call(callUserId, TUICallMediaType.audio, params);
TUICallKit.setCallingListener Interface Changes
TUICalling Code Example:
TUICalling.sharedInstance().registerListener(TUICallingListener(onInvited: (params) {}onCallingCancel: () {}……));
TUICallKit Code Example:
TUICallEngine.instance.addObserver(TUICallObserver(onError:(int code, String message) {},onCallCancelled: (String callerId) {},onCallBegin:(TUIRoomId roomId, TUICallMediaType callMediaType, TUICallRole callRole) {},……));
After upgrading the above APIs, you can use the
TUICallKit
component normally.