TestMeetingRoom and click Create.
/lib/debug/GenerateTestUserSig.dart.GenerateTestUserSig.dart as follows.
UserSig is to configure the secret key in the client code. In this method, the secret key is vulnerable to decompilation and reverse engineering. Once your secret key is leaked, attackers can steal your Tencent Cloud traffic. Therefore, this method is only suitable for locally running a demo project and debugging.UserSig into your server and provide an application-oriented API. When UserSig is needed, your application can send a request to your server for a dynamic UserSig. For more information, see How do I calculate UserSig during production?.flutter pub get.\\ios project in the source code directory with Xcode (11.0 or above).flutter run.TRTCMeetingDemo folder in the source code contains two subfolders: ui and model. The ui subfolder contains UI code. The table below lists the files (folders) and the UI views they represent. You can refer to it when making UI changes.File or Folder | Description |
TRTCMeetingIndex.dart | The view for meeting creation or join |
TRTCMeetingRoom.dart | The main view for video conferencing |
TRTCMeetingMemberList.dart | The view for the participant list |
TRTCMeetingSetting.dart | The view for video conferencing parameter settings |
TRTCMeetingDemo folder in the source code contains two subfolders: ui and model. The model subfolder contains the reusable open-source component TRTCMeeting. You can find the component's APIs in TRTCMeeting.dart and use them to customize your own UI.

TRTCMeeting depends on the TRTC SDK and Chat SDK. You can configure pubspec.yaml to download their updates automatically.pubspec.yaml of your project.dependencies:tencent_trtc_cloud: latest version numbertencent_im_sdk_plugin: latest version number
Info.plist:<key>NSMicrophoneUsageDescription</key><string>Audio calls are possible only with mic access.</string>
/android/app/src/main/AndroidManifest.xml.xmlns:tools="http://schemas.android.com/tools" to manifest.tools:replace="android:label" to application.
TRTCMeeting component.lib/TRTCMeetingDemo/model/
sharedInstance API to create an instance of the TRTCMeeting component.registerListener function to register event callbacks of the component.login API to log in to the component, and set the key parameters as described below.Parameter | Description |
SDKAppID | |
userId | ID of the current user, which is a string that can contain letters (a-z and A-Z), digits (0-9), hyphens (-), and underscores (_). We recommend you set it based on your business account system. |
userSig |
TRTCMeeting trtcMeeting = TRTCMeeting.sharedInstance();trtcMeeting.registerListener(onListener);ActionCallback res = await trtcMeeting.login(GenerateTestUserSig.sdkAppId,userId,GenerateTestUserSig.genTestSig(userId),);if (res.code == 0) {// Login succeeded}
setSelfProfile to set your username and profile photo as a host.createMeeting to create a meeting room.startCameraPreview to capture video and startMicrophone to capture audio.getBeautyManager.
// 1. Set your username and profile photo as a hosttrtcMeeting.setSelfProfile('my_name', 'my_avatar');// 2. The host creates a meeting.ActionCallback res = await trtcMeeting.createMeeting(roomId);if (res.code == 0) {// Created the meeting successfully// 3. The host turns the camera on and enables audio capturing.trtcMeeting.startCameraPreview(true, TRTCCloudVideoViewId);trtcMeeting.startMicrophone();// 4. Set the beauty filter.trtcMeeting.getBeautyManager().setBeautyStyle(TRTCCloudDef.TRTC_BEAUTY_STYLE_PITU);trtcMeeting.getBeautyManager().setBeautyLevel(6);}
setSelfProfile to set your username and profile photo as a participant.enterMeeting, passing in the conference room ID to enter the room.startCameraPreview to capture video and startMicrophone to capture audio.onUserVideoAvailable notification, and can call startRemoteView and pass in the userId to play the attendee’s video.
// 1. Set your username and profile photo as a participant.trtcMeeting.setSelfProfile('my_name', 'my_avatar');// 2. Call `enterMeeting` to enter the meeting room.ActionCallback res = await trtcMeeting.enterMeeting(roomId);if (res.code == 0) {// Joined the meeting successfully// 3. The host turns the camera on and enables audio capturing.trtcMeeting.startCameraPreview(true, TRTCCloudVideoViewId);trtcMeeting.startMicrophone();// 4. Set the beauty filter.trtcMeeting.getBeautyManager().setBeautyStyle(TRTCCloudDef.TRTC_BEAUTY_STYLE_PITU);trtcMeeting.getBeautyManager().setBeautyLevel(6);}// 5. Receive the notification that another member enabled the camera and start playback.trtcMeeting.registerListener(onListener);onListener(TRTCMeetingDelegate type, param) {switch (type) {case TRTCMeetingDelegate.onUserVideoAvailable:if (param['available']) {trtcMeeting.startCameraPreview(param['userId'],TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG,TRTCCloudVideoViewId);} else {trtcMeeting.stopRemoteView(param['userId'],TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG);}break;}}
startScreenCapture and pass in encoding parameters and the floating window during screen recording to start screen sharing. For more information, see TRTC SDK.onUserVideoAvailable event notification.stopCameraPreview to disable camera capturing. For more information, please see TRTC SDK.await trtcMeeting.stopCameraPreview();trtcMeeting.startScreenCapture(videoFps: 10,videoBitrate: 1600,videoResolution: TRTCCloudDef.TRTC_VIDEO_RESOLUTION_1280_720,videoResolutionMode: TRTCCloudDef.TRTC_VIDEO_RESOLUTION_MODE_PORTRAIT,appGroup: iosAppGroup,);
sendRoomTextMsg to send text messages. All participants in the meeting will receive the onRecvRoomTextMsg callback. Chat has its default content moderation rules. Text chat messages that contain restricted terms will not be forwarded by the cloud.// Sender: Sends text chat messagestrtcMeeting.sendRoomTextMsg('Hello Word!');// Receiver: Listens for text chat messagestrtcMeeting.registerListener(onListener);onListener(TRTCMeetingDelegate type, param) {switch (type) {case TRTCMeetingDelegate.onRecvRoomTextMsg:print('Received a message from' + param['userName'] + ':' + param['message']);break;}}
sendRoomCustomMsg to send custom (signaling) messages, and all participants in the meeting will receive the onRecvRoomCustomMsg callback. Custom messages are often used to transfer custom signals, such as muting notifications and notifications about other meeting controls.// Sender: Customize CMD to distinguish a muting notification// For example, use "CMD_MUTE_AUDIO" to indicate muting notificationstrtcMeeting.sendRoomCustomMsg('CMD_MUTE_AUDIO', '1');// Receiver: Listens for custom messagestrtcMeeting.registerListener(onListener);onListener(TRTCMeetingDelegate type, param) {switch (type) {case TRTCMeetingDelegate.onRecvRoomCustomMsg:if (param['command'] == 'CMD_MUTE_AUDIO') {// Receive a muting notification.print('Received a muting notification from' + param['userName'] + ':' + param['message']);trtcMeeting.muteLocalAudio(message == '1');}break;}}
Feedback