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

Flutter plugin of rtc_room_engine SDK

rtc_room_engine #

This article will explain how to complete the shortest time to complete the tui_room_engine SDK access, .For details about product billing and functions, see Billing Overview.

Activate the service #

Before using tui_room_engine to initiate a meeting, you need to open tui_room_engine's exclusive multi-person audio and video interaction service, the detailed steps are as follows:

  1. Log in to Tencent Cloud Vision Cube SDK console, click the create project button, select multiple audio and video interactive scenes and integration methods, here we recommend "UI fast integration", that is, tui_room_engine.
  2. After selecting the access scenario and integration method, you need to open the two Tencent cloud-based PaaS capabilities used by the multiplayer audio and video room SDK, namely instant messaging IM and real-time audio and video TRTC, after opening, click the Create project and next button.
  3. After the project is created, you need to match an IM application for the project, because the multiplayer audio and video room SDK relies on the basic capabilities provided by the IM SDK. You can create or manage existing IM applications here. After the association is successful, you can receive a 7-day free experience version for subsequent development and debugging work. Of course, if you have tried it before, you can also purchase the official version directly by clicking on this page.
  4. Click the Go to Integration button, select the project configuration, view the detailed configuration page, find the SDKAppID and key and record it, they will be used in the next step 4: using tui_room_engine components, so that the multi-person audio and video room SDK service is completed.

Log in to the tui_room_engine #

Add the following code to your project, which does this by calling the relevant interface in the tui_room_engine. This step is critical because tui_room_engine functions can only be used after you log in, so please be patient to check that the relevant parameters are configured correctly:

TUIActionCallback actionCallback = await TUIRoomEngine.login(
       1400000001,
        "userId",
        "xxxxxxxxxx");
    if (actionCallback.code == TUIError.success) {
      //login success
    }else{
	  //login error
	}

parameter specification

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

  • SDKAppID: You obtained it in the last step of [Step 1](##Open service), so I won't repeat it here.
  • UserID: indicates the ID of the current user. The value is a string of letters (A-z and A-z), digits (0-9), hyphens (-), and underscores (_).
  • UserSig: Use the SecretKey obtained in [Step 1](##Open service) of Step 3, to encrypt SDKAppID, UserID and other information, and you can get UserSig, which is an authentication ticket used by Tencent Cloud to identify whether the current user can use TRTC services. You can generate a temporarily usable UserSig through the helper in the console.
  • For more information, see How to Calculate and use UserSig.

Attention:

  • This step is also the step we have received the most feedback from developers, and the common questions are as follows:
>   * The SDKAppID is incorrectly set. The SDKAppID of a domestic station is generally a 10-bit integer starting with 140.
>
>   + UserSig is misconfigured as a SecretKey. UserSig encrypts SDKAppID, UserID, and expiration time with SecretKey instead of directly configuring UserSig with SecretKey.
>   + UserID is set to a simple string such as "1", "123", and "111". **TRTC does not support multiple logins of the same UserID**. Therefore, userids such as "1", "123", and "111" are easily occupied by your colleagues during collaborative development, resulting in login failures. Therefore, we recommend that you set some recognizable userids when debugging.
  • The sample code in Github 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: roomId);
roomInfo.speechMode = RoomStore.to.speechMode;
roomInfo.roomType = RoomStore.to.roomType;
roomInfo.maxSeatCount = 0;
TUIActionCallback actionCallback = await _roomEngine.createRoom(roomInfo);

if (actionCallback.code == TUIError.success) {
    //create success
}else{
	//create 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 success
}else{
	//enter error
} 

More features #

Switch camera #

var trtcCloud = (await TRTCCloud.sharedInstance())!;
var isFront = true;
trtcCloud.getDeviceManager().switchCamera(isFront);

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.

Communication and feedback #

If you have any suggestions or comments in the use process, you are welcome to join our tui_room_engine technical exchange QQ group: 770645461 for technical exchange and product communication.