rtc_room_engine 2.2.2 copy "rtc_room_engine: ^2.2.2" to clipboard
rtc_room_engine: ^2.2.2 copied to clipboard

A product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education.

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.

  1. Visit TRTC Console > Applications, select Create application.

  2. In the Create application pop-up, select Conference and enter the application name, click Create.

  3. 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**.

  4. 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
}

Parameter Description

Here are some of the key parameters used in the login function:

Here is a detailed introduction to the key parameters used in the login function:

  • SDKAppID:You have already obtained it in step Activate the service , so it will not be repeated here.
  • UserID:The ID of the current user, string type, only allows to contain English letters (a-z and A-Z), numbers (0-9), hyphens (-), and underscores (_).
  • UserSig:Encrypt the SDKAppID, UserID, etc. with the SDKSecretKey obtained in step Activate the service to get the UserSig, which is a ticket for authorization and is used for Tencent Cloud to recognize whether the current user can use the TRTC service. You can create a temporarily available UserSig through the UserSig Tools through the project sidebar in the console.
  • For more information, please refer to the UserSig related.

Note:

  • This step is also the step with the most feedback from developers we have received so far. Common problems are as follows:
>   * SDKAppID is set incorrectly. Please use the SDKAppID of the international site correctly, otherwise, you will not be able to access it.
>
>   + UserSig is misconfigured as an encryption key (SDKSecretKey). UserSig is obtained by encrypting the SDKAppID, UserID, and expiration time with the SDKSecretKey, not by directly configuring the SDKSecretKey as UserSig.
>   + UserID is set to simple strings like "1", "123", "111", etc. Since TRTC does not support multi-terminal login with the same UserID, simple UserIDs like "1", "123", "111" are easily occupied by your colleagues, causing login failure. Therefore, we recommend that you set some UserIDs with high identifiability when debugging.
  • The sample code in rtc_room_engine/example/lib/debug/generate_test_user_sig.dart uses the genTestUserSig function to compute UserSig locally in order to get you through the current access process faster, but it exposes your SDKSecretKey to the App's code. This is not good for you to upgrade and protect your SDKSecretKey later, so we strongly recommend that you keep the UserSig calculation logic on the server side and let the app request the real-time calculated UserSig from your server every time you use the rtc_room_engine component.

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
}

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
} 

More features #

Custom Beauty settings #

  • step 1.Enable video process
    var trtcCloud = (await TRTCCloud.sharedInstance())!;
    var enable = true;
    _trtcCloud.enableCustomVideoProcess(enable);
    
  • 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());
    

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 info_rtc@tencent.com. Your feedback is greatly appreciated.

6
likes
0
pub points
68%
popularity

Publisher

verified publishertrtc.io

A product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education.

Homepage

License

unknown (license)

Dependencies

ffi, flutter, json_annotation, logging, path_provider, plugin_platform_interface, tencent_trtc_cloud

More

Packages that depend on rtc_room_engine