Last updated:
0 purchases
rtc room engine
English | 简体中文
RTC Room Engine SDK #
A product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education.
Activate the service #
Before using rtc_room_engine to initiate a meeting, please Create an application in the TRTC Console. You can follow the steps below to activate the TRTC Conference product service and receive a free 14-day trial version.
Note:
If you wish to purchase the paid version, please refer to TRTC Conference Monthly Packages, follow the Purchasing Guide to complete the purchase.
Visit TRTC Console > Applications, select Create application.
In the Create application pop-up, select Conference and enter the application name, click Create.
After completing the application creation, you will default entry to the application details page, select the Free Trail in the floating window, and click to** Get started for free**.
After the activation is completed, you can view the edition information on the current page. The SDKAppID and SDKSecretKey here will be used in the integration guide.
Log in to the rtc_room_engine #
Add the following code to your project, which initializes the component by calling the related interfaces in rtc_room_engine . This step is crucial because only after initialization can you use the various functions of rtc_room_engine. Please be patient and check if the relevant parameters are configured correctly:
TUIActionCallback actionCallback = await TUIRoomEngine.login(
1400000001, // Please replace with the SDKAppID obtained in step Activate the service
"userId", // Please replace with your UserID
"xxxxxxxxxx"); // You can calculate a UserSig in the Console and fill it in this position
if (actionCallback.code == TUIError.success) {
// login success
}else{
// login error
}
copied to clipboard
Parameter Description
Here is a detailed introduction to the key parameters used in the login function:
SDKAppID:Obtained it in Active the service.
UserID:The ID of the current user, which is a string that can only contain English letters (a-z and A-Z), numbers (0-9), hyphens (-), and underscores (_).
UserSig:The authentication credential used by Tencent Cloud to verify whether the current user is allowed to use the TRTC service. You can get it by using the SDKSecretKey to encrypt information such as SDKAppID and UserID. You can generate a temporary UserSig on the UserSig Tools page in the TRTC console.
For more information, please refer to the UserSig.
Note:
Many developers have contacted us with questions regarding this step. Below are some of the frequently encountered problems:
The SDKAppID is set incorrectly.
UserSig is set to the value of SDKSecretKey mistakenly. The UserSig is generated by using the SDKSecretKey for the purpose of encrypting information such as SDKAppID, UserID, and the expiration time. But the value of the UserSig cannot be directly substituted with the value of the SDKSecretKey.
The UserID is set to a simple string such as 1, 123, or 111, and your colleague may be using the same UserID while working on a project simultaneously. In this case, login will fail as TUIRoomKit doesn't support login on multiple terminals with the same UserID. Therefore, we recommend you use some distinguishable UserID values during debugging.
The sample code on GitHub uses the genTestUserSig function to calculate UserSig locally, so as to help you complete the current integration process more quickly. However, this scheme exposes your SDKSecretKey in the application code, which makes it difficult for you to upgrade and protect your SDKSecretKey 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 TUIRoomKit component from the server.
Use the rtc_room_engine #
Create a room #
Calling the room rtc_room_engine createRoom method , you can create a room.
var _roomEngine=TUIRoomEngine.sharedInstance();
var roomInfo = TUIRoomInfo(roomId: 'your room id');
TUIActionCallback actionCallback = await _roomEngine.createRoom(roomInfo);
if (actionCallback.code == TUIError.success) {
//create room success
}else{
//create room error
}
copied to clipboard
Join the room #
You can enter the specified room by calling rtc_room_engine's enterRoom method.
var _roomEngine=TUIRoomEngine.sharedInstance();
TUIValueCallBack<TUIRoomInfo> valueCallback = await _roomEngine.enterRoom("your room id");
if (valueCallback.code == TUIError.success) {
// enter room success
}else{
// enter room error
}
copied to clipboard
More features #
Custom Beauty settings #
step 1.Enable video process
var trtcCloud = (await TRTCCloud.sharedInstance())!;
var enable = true;
_trtcCloud.enableCustomVideoProcess(enable);
copied to clipboard
step 2.Enable video process (Taking Android platform as an example,that usedTencent effect SDK)
//step 1. Create a BeautyProcess class implements ITXCustomBeautyProcesser
class BeautyProcess implements ITXCustomBeautyProcesser {
@Override
public TXCustomBeautyDef.TXCustomBeautyPixelFormat getSupportedPixelFormat() {
return TXCustomBeautyDef.TXCustomBeautyPixelFormat
.TXCustomBeautyPixelFormatTexture2D;
}
@Override
public TXCustomBeautyDef.TXCustomBeautyBufferType getSupportedBufferType() {
return TXCustomBeautyDef.TXCustomBeautyBufferType
.TXCustomBeautyBufferTypeTexture;
}
@Override
public void onProcessVideoFrame(TXCustomBeautyDef.TXCustomBeautyVideoFrame srcVideoFrame,
TXCustomBeautyDef.TXCustomBeautyVideoFrame destVideoFrame) {
//process your video frame
destVideoFrame.texture.textureId = srcVideoFrame.texture.textureId;
}
}
//step 2. Create a BeautyFactory class implements
//ITITXCustomBeautyProcesserFactoryXCustomBeautyProcesser
class TencentEffectBeauty implements ITXCustomBeautyProcesserFactory {
private BeautyProcess mBeautyProcess;
@Override
public ITXCustomBeautyProcesser createCustomBeautyProcesser() {
//create BeautyProcess
mBeautyProcess = new BeautyProcess();
return mBeautyProcess;
}
@Override
public void destroyCustomBeautyProcesser() {
if (null != mBeautyProcess) {
//destroy BeautyProcess
mBeautyProcess = null;
}
}
}
//step 3. register your BeautyFactory class to TRTCCloudPlugin
TRTCCloudPlugin.register(new TencentEffectBeauty());
copied to clipboard
eg. See example at example/android/app/src/main/java/com/rtc/room/engine/demo/MainActivity.java
,paste your Tencent effect license then run the project.
Communication and feedback #
If you have any suggestions or comments during the use of our product, please feel free to contact us at [email protected]. Your feedback is greatly appreciated.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.