rtc_room_engine 1.7.1 copy "rtc_room_engine: ^1.7.1" to clipboard
rtc_room_engine: ^1.7.1 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 tui_room_engine to initiate a meeting, please Create an application in the TRTC Console and record the SDKAppID and SecretKey parameters. These parameters will be used in the subsequent integration process. The location of the application creation and parameters is shown in the following figure:

Log in to the tui_room_engine #

Add the following code to your project, which initializes the component by calling the related interfaces in tui_room_engine . This step is crucial because only after initialization can you use the various functions of tui_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 Secret Key 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 temporary usable UserSig through the UserSig generation function at the top of the Console overview page.
  • 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 (SecretKey). UserSig is obtained by encrypting the SDKAppID, UserID, and expiration time with the SecretKey, not by directly configuring the SecretKey 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 SecretKey to the App's code. This is not good for you to upgrade and protect your SecretKey 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 tui_room_engine component.

Use the tui_room_engine #

Create a room #

Calling the room tui_room_engine createRoom method , you can create a room.

var _roomEngine=TUIRoomEngine.createInstance(); 

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 tui_room_engine's enterRoom method.

var _roomEngine=TUIRoomEngine.createInstance(); 

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](https://www.tencentcloud.com/document/product/1143/54279)  license then run the project.
><img src="https://qcloudimg.tencent-cloud.cn/raw/393aee8e7e947062c38bcd6c04512ba1.png" width="900">

## Communication and feedback

If you have any suggestions or comments in the use process, you are welcome to join our [technical exchange group](https://zhiliao.qq.com/s/cWSPGIIM62CC/cFUPGIIM62CF) for technical exchange and product communication.
6
likes
145
pub points
63%
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

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

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

More

Packages that depend on rtc_room_engine