TRTCMeeting has the following features based on Tencent Real-Time Communication (TRTC) and Tencent Cloud Chat:
The host can create a meeting room, and participants can enter the room ID to join the meeting.
The participants can share their screens with each other.
All users can send various text and custom messages.
Note
The TUIKit series of components are based on two basic PaaS services of Tencent Cloud, namely TRTC and Chat. When you activate TRTC, the Chat SDK Trial Edition will be activated by default, which will support up to 100 DAUs. For ICha billing details, see Pricing. TRTCMeeting is an open-source class depending on two closed-source Tencent Cloud SDKs. For the specific implementation process, see Group Audio/Video Room (Flutter).The TRTC SDK is used as the low-latency video conferencing component. The MeetingRoom feature of the Chat SDK is used to implement chat rooms in meetings.
TRTCMeeting API Overview
Basic SDK APIs
|
| |
| Terminates a singleton object. |
| |
| Terminates an event listener. |
| |
| |
| |
Meeting room APIs
|
| Creates meeting room (called by host). |
| Closes the meeting room (called by host). |
| Enters meeting room (called by participant). |
| Leaves meeting room (called by participant). |
| Gets the list of all users in the room. It takes effect only if it is called after enterMeeting(). |
| Gets the details of a specified user in the room. It takes effect only if it is called after enterMeeting(). |
Remote user APIs
|
| Plays back the video of a specified remote member. |
| Stops playing back the video of a specified remote member. |
| Sets the rendering parameters of a remote video. |
| Mutes/Unmutes a specified remote member's audio. |
| Mutes/Unmutes all remote users. |
| Pauses/Resumes a specified remote member's video stream. |
| Pauses/Resumes receiving all remote video streams. |
Local video operation APIs
|
| Enables preview of the local video. |
| Stops local video capturing and preview. |
| Switches between the front and rear cameras. |
| Sets video encoder parameters. |
| Sets the mirror mode for local preview. |
Local audio APIs
|
| |
| |
| Mutes/Unmutes local audio. |
| Sets whether to play sound from the device’s speaker or receiver. |
| Sets mic capturing volume. |
| |
| |
| |
| |
Screen sharing APIs
Management object acquisition APIs
Message sending APIs
|
| Broadcasts a text chat message in a meeting, which is generally used for chat. |
| Sends a custom text chat message. |
TRTCLiveRoomDelegate API Overview
Common event callbacks
|
| |
| |
| You were kicked offline because another user logged in with the same account. |
Meeting room event callbacks
|
| The meeting room was closed. |
| |
| |
Member entry/exit event callbacks
|
| |
| |
| A new member joined the meeting. |
| A member left the meeting. |
Member audio/video event callbacks
|
| A member turned their mic on/off. |
| A member turned their camera on/off. |
| A member enabled/disabled the substream image. |
Message event callback APIs
|
| A text chat message was received. |
| A custom message was received. |
Screen sharing event callbacks
Basic SDK APIs
sharedInstance
This API is used to get the TRTCMeeting singleton object. static Future<TRTCMeeting> sharedInstance();
destroySharedInstance
This API is used to terminate the TRTCMeeting singleton object. static void destroySharedInstance();
Note
After the instance is terminated, the externally cached TRTCMeeting instance can no longer be used. You need to call sharedInstance again to get a new instance. registerListener
This API is used to set an event listener. You can use TRTCMeetingDelegate to get various status notifications of TRTCMeeting. void registerListener(MeetingListenerFunc func);
Note
func is the delegation callback of TRTCMeeting.
unRegisterListener
This API is used to terminate an event listener.
void unRegisterListener(MeetingListenerFunc func);
login
Login
Future<ActionCallback> login(int sdkAppId, String userId, String userSig);
The parameters are described below:
|
| | |
| | The ID of current user, which is a string that can contain only letters (a-z and A-Z), digits (0–9), hyphens (-), and underscores (_). |
| | Tencent Cloud's proprietary security signature. For how to calculate and use it, see FAQs > UserSig. |
logout
Log out
Future<ActionCallback> logout();
setSelfProfile
This API is used to set the profile.
Future<ActionCallback> setSelfProfile(String userName, String avatarURL);
The parameters are described below:
Meeting Room APIs
createMeeting
This API is used to create a meeting (called by the host).
Future<ActionCallback> createMeeting(int roomId);
The parameters are described below:
|
| | The meeting room ID. You need to assign and manage the IDs in a centralized manner. |
Generally, the host calls the APIs in the following steps:
1. The host calls createMeeting() and passes in roomId to create a meeting, the result of which is returned via ActionCallback.
2. The host calls startCameraPreview() to enable camera preview. At this time, the beauty filter parameters can be adjusted.
3. The host calls startMicrophone() to enable mic capturing.
destroyMeeting
This API is used to close a meeting room (called by the host). After creating a meeting, the host can call this API to terminate it.
Future<ActionCallback> destroyMeeting(int roomId);
The parameters are described below:
|
| | The meeting room ID. You need to assign and manage the IDs in a centralized manner. |
enterMeeting
This API is used to enter a meeting room (called by a member).
Future<ActionCallback> enterMeeting(int roomId);
The parameters are described below:
Generally, a participant joins a meeting in the following steps:
1. The participant calls enterMeeting() and passes in roomId to enter the meeting room.
2. The participant calls startCameraPreview() to enable camera preview and calls startMicrophone() to enable mic capturing.
3. The participant receives the onUserVideoAvailable event and calls startRemoteView() and passes in the userId of the target member to start playback.
leaveMeeting
This API is used to leave a meeting room (called by participant).
Future<ActionCallback> leaveMeeting();
getUserInfoList
This API is used to get the list of all users in the room. It takes effect only if it is called after enterMeeting().
Future<UserListCallback> getUserInfoList(List<String> userIdList);
The parameters are described below:
|
| | List of userId values to obtain. |
getUserInfo
This API is used to get the details of a specified user in the room. It takes effect only if it is called after enterMeeting().
Future<UserListCallback> getUserInfo(String userId);
The parameters are described below:
Remote User APIs
startRemoteView
This API is used to play back the video of a specified remote member.
Future<void> startRemoteView(String userId, int streamType, int viewId);
The parameters are described below:
|
| | |
| | The type of the video stream to watch. For more information, see TRTC SDK. |
| | viewId generated by TRTCCloudVideoView
|
stopRemoteView
This API is used to stop playing back the video of a specified remote member.
Future<void> stopRemoteView(String userId, int streamType);
The parameters are described below:
|
| | |
| | The type of the video stream to watch. For more information, see TRTC SDK. |
setRemoteViewParam
This API is used to set the rendering parameters of a specified remote member’s video.
Future<void> setRemoteViewParam(String userId, int streamType,
{int fillMode, int rotation, int mirrorType});
The parameters are described below:
|
| | |
| | The type of the video stream to watch. For more information, see TRTC SDK. |
| | The video image rendering mode. Valid values: Fill (default) or Fit. For more information, see TRTC SDK. |
| | Clockwise video image rotation angle. For more information, see TRTC SDK. |
| | The mirroring mode of the video. For more information, see TRTC SDK. |
muteRemoteAudio
This API is used to mute/unmute a specified remote member.
Future<void> muteRemoteAudio(String userId, bool mute);
The parameters are described below:
|
| | |
| | true: Mute; false: Unmute
|
muteAllRemoteAudio
This API is used to mute/unmute all remote members.
Future<void> muteAllRemoteAudio(bool mute);
The parameters are described below:
|
| | true: Mute; false: Unmute
|
muteRemoteVideoStream
This API is used to pause/resume a specified remote member's video stream.
Future<void> muteRemoteVideoStream(String userId, bool mute);
The parameters are described below:
|
| | |
| | true: Pause; false: Resume |
muteAllRemoteVideoStream
This API is used to pause/resume all remote video streams.
Future<void> muteAllRemoteVideoStream(bool mute);
The parameters are described below:
|
| | true: Pause; false: Resume |
Local Video Operation APIs
startCameraPreview
This API is used to enable local video preview.
Future<void> startCameraPreview(bool isFront, int viewId);
The parameters are described below:
|
| | true: Front camera; false: Rear camera. |
| | viewId generated by TRTCCloudVideoView
|
stopCameraPreview
This API is used to stop local video capturing and preview.
Future<void> stopCameraPreview();
switchCamera
This API is used to switch between the front and rear cameras.
Future<void> switchCamera(bool isFront);
The parameters are described below:
|
| | true: Front camera; false: Rear camera. |
setVideoEncoderParam
This API is used to set video encoder parameters.
Future<void> setVideoEncoderParam({
int videoFps,
int videoBitrate,
int videoResolution,
int videoResolutionMode,
});
The parameters are described below:
|
| | Video capturing frame rate. |
| | The video bitrate. The SDK encodes streams at the target video bitrate and will actively reduce the bitrate only if the network conditions are poor. |
| | |
| | |
setLocalViewMirror
This API is used to set the mirror mode for local preview.
Future<void> setLocalViewMirror(bool isMirror);
The parameters are described below:
|
| | Whether to enable mirroring preview mode. true: Yes; false: No. |
Local Audio APIs
startMicrophone
This API is used to start mic capturing.
Future<void> startMicrophone({int quality});
The parameters are described below:
|
| | The audio quality mode. For more information, see TRTC SDK. |
stopMicrophone
This API is used to stop mic capturing.
Future<void> stopMicrophone();
muteLocalAudio
This API is used to mute/unmute local audio.
Future<void> muteLocalAudio(bool mute);
The parameters are described below:
|
| | true: Mute; false: Unmute
|
setSpeaker
This API is used to set whether to play sound from the device’s speaker or receiver.
Future<void> setSpeaker(bool useSpeaker);
The parameters are described below:
|
| | true: Speaker; false: Receiver
|
setAudioCaptureVolume
This API is used to set the mic capturing volume.
Future<void> setAudioCaptureVolume(int volume);
The parameters are described below:
|
| | The capture volume. Value range: 0–100. Default value: 100. |
setAudioPlayoutVolume
This API is used to set the playback volume.
Future<void> setAudioPlayoutVolume(int volume);
The parameters are described below:
|
| | The playback volume. Value range: 0–100. Default value: 100. |
startAudioRecording
This API is used to start audio recording.
Future<int?> startAudioRecording(String filePath);
The parameters are described below:
|
| | The storage path of the audio recording file. Specify the path according to your specific needs and ensure that the specified path exists and is writable. This path must be accurate to the file name and extension. The extension determines the format of the audio recording file. Currently, supported formats include PCM, WAV, and AAC. |
stopAudioRecording
This API is used to stop audio recording.
Future<void> stopAudioRecording();
enableAudioVolumeEvaluation
This API is used to enable the volume reminder.
Future<void> enableAudioVolumeEvaluation(int intervalMs);
The parameters are described below:
|
| | Sets the interval in ms for triggering the onUserVoiceVolume callback. The minimum interval is 100 ms. If the value is smaller than 0, the callback will be disabled. We recommend you set this parameter to 300 ms. |
Screen Sharing APIs
startScreenCapture
This API is used to start screen sharing.
Future<void> startScreenCapture({
int videoFps,
int videoBitrate,
int videoResolution,
int videoResolutionMode,
String appGroup,
});
The parameters are described below:
|
| | The frame rate for video capturing. |
| | The video bitrate. The SDK encodes streams at the target video bitrate and will actively reduce the bitrate only if the network conditions are poor. |
| | |
| | |
| | This parameter takes effect only for iOS and can be ignored for Android. It is the Application Group Identifier shared by the primary app and broadcast process. |
stopScreenCapture
This API is used to stop screen capturing.
Future<void> stopScreenCapture();
pauseScreenCapture
This API is used to pause screen capturing.
Future<void> pauseScreenCapture();
resumeScreenCapture
This API is used to resume screen capturing.
Future<void> resumeScreenCapture();
Management Object Acquisition APIs
getDeviceManager
getBeautyManager
This API is used to get the beauty filter management object TXBeautyManager. You can do the following using TXBeautyManager:
Set the beauty filter style and apply effects including skin brightening, rosy skin, eye enlarging, face slimming, chin slimming, chin lengthening/shortening, face shortening, nose narrowing, eye brightening, teeth whitening, eye bag removal, wrinkle removal, and smile line removal.
Adjust the hairline, eye spacing, eye corners, lip shape, nose wings, nose position, lip thickness, and face shape.
Apply animated effects such as face widgets (materials).
Add makeup effects.
Recognize gestures.
Message Sending APIs
sendRoomTextMsg
This API is used to broadcast a text chat message in a meeting, which is generally used for chat.
Future<ActionCallback> sendRoomTextMsg(String message);
The parameters are described below:
sendRoomCustomMsg
This API is used to send a custom text message.
Future<ActionCallback> sendRoomCustomMsg(String cmd, String message);
The parameters are described below:
|
| | A custom command word used to distinguish between different message types. |
| | |
TRTCMeetingDelegate Event Callback APIs
Common Event Callback APIs
onError
Callback for error.
This callback indicates that the SDK encountered an unrecoverable error. Such errors must be listened for, and UI reminders should be sent to users depending if necessary.
The parameters are described below:
|
| | |
| | |
| | Extended field. Certain error codes may carry extra information for troubleshooting. |
onWarning
Callback for warning.
The parameters are described below:
|
| | |
| | |
| | Extended field. Certain error codes may carry extra information for troubleshooting. |
onKickedOffline
Callback for being kicked offline because another user logged in to the same account.
Meeting Room Event Callback APIs
onRoomDestroy
Callback for meeting room termination. When the host leaves the room, all users in the room will receive this callback.
The parameters are described below:
onNetworkQuality
Callback for network status.
The parameters are described below:
|
| | The upstream network quality. |
| List<TRTCCloudDef.TRTCQuality> | The downstream network quality. |
onUserVolumeUpdate
Call volume of a user.
The parameters are described below:
|
| | Volume of every currently speaking user in the room. Value range: 0-100. |
| | Total volume level of all remote members. Value range: 0–100. |
Member Entry/Exit Event Callbacks
onEnterRoom
You joined the meeting.
The parameters are described below:
|
| | A value greater than 0 indicates the time (in ms) at which the meeting was joined. A value smaller than 0 indicates the error code thrown while joining the meeting. |
onLeaveRoom
You left the meeting.
The parameters are described below:
|
| | The reason for leaving the meeting. 0: The user actively called leaveMeeting to leave the meeting; 1: The user was kicked out of the meeting by the server; 2: The meeting was closed. |
onUserEnterRoom
A new member joined the meeting.
The parameters are described below:
|
| | The user ID of the new member who enters the room. |
onUserLeaveRoom
A member left the meeting.
The parameters are described below:
|
| | The user ID of the member who leaves the room. |
Member Audio/Video Event Callbacks
onUserAudioAvailable
A member turned their mic on/off.
The parameters are described below:
|
| | |
| | true: The mic is enabled; false: The mic is disabled. |
onUserVideoAvailable
A member turned their camera on/off.
The parameters are described below:
|
| | |
| | true: The camera is enabled; false: The camera is disabled. |
onUserSubStreamAvailable
A member enabled/disabled the substream image.
The parameters are described below:
|
| | |
| | true: The substream is enabled; false: The substream is disabled. |
Message Event Callback APIs
onRecvRoomTextMsg
A text chat message was received.
The parameters are described below:
|
| | |
| | The message sender's user ID. |
| | The sender's profile photo. |
| | |
onRecvRoomCustomMsg
A custom message was received.
The parameters are described below:
|
| | A custom command word used to distinguish between different message types. |
| | |
| | |
| | The sender's profile photo. |
| | |
Screen Sharing Event Callbacks
onScreenCaptureStarted
Screen sharing started.
onScreenCapturePaused
Screen sharing paused.
onScreenCaptureResumed
Screen sharing resumed.
onScreenCaptureStoped
Screen sharing stopped.
The parameters are described below:
|
| | The reason screen sharing stopped. 0: The user actively stopped; 1: Screen sharing stopped as the shared window was closed. |