TRTCMeeting
has the following features based on Tencent Real-Time Communication (TRTC) and Instant Messaging (IM):
TRTCMeeting
is an open-source class depending on two closed-source Tencent Cloud SDKs. For the specific implementation process, see Group Audio/Video Room (for Flutter).
MeetingRoom
feature of the IM SDK is used to implement chat rooms in meetings.API | Description |
---|---|
sharedInstance | Gets a singleton object. |
destroySharedInstance | Terminates a singleton object. |
registerListener | Sets event listener. |
unRegisterListener | Terminates event listener. |
login | Logs in. |
logout | Logs out. |
setSelfProfile | Sets the profile. |
API | Description |
---|---|
createMeeting | Creates a meeting room (called by anchor). |
destroyMeeting | Terminates a meeting room (called by anchor). |
enterMeeting | Enters a meeting room (called by participant). |
leaveMeeting | Leaves a meeting room (called by participant). |
getUserInfoList | Gets the list of all users in room. This API will take effect only if it is called after enterMeeting() succeeds. |
getUserInfo | Gets the details of a specified user in the room. This API will take effect only if it is called after enterMeeting() succeeds. |
API | Description |
---|---|
startRemoteView | Plays back the remote video image of a specified member. |
stopRemoteView | Stops playing back the remote video image of a specified member. |
setRemoteViewParam | Sets the remote image rendering parameters of a specified member. |
muteRemoteAudio | Mutes/Unmutes a specified member's remote audio |
muteAllRemoteAudio | Mutes/Unmutes all members' remote audio. |
muteRemoteVideoStream | Pauses/Resumes a specified member's remote video stream. |
muteAllRemoteVideoStream | Pauses/Resumes all members' remote video streams. |
API | Description |
---|---|
startCameraPreview | Enables preview of the local video. |
stopCameraPreview | Stops local video capturing and preview. |
switchCamera | Switches between the front and rear cameras. |
setVideoEncoderParam | Sets video encoder parameters. |
setLocalViewMirror | Sets the mirroring preview mode of local image. |
API | Description |
---|---|
startMicrophone | Starts mic capturing. |
stopMicrophone | Stops mic capturing. |
muteLocalAudio | Mutes/Unmutes local audio. |
setSpeaker | Turns the device speaker or device receiver on. |
setAudioCaptureVolume | Sets mic capturing volume. |
setAudioPlayoutVolume | Sets playback volume. |
startAudioRecording | Starts audio recording. |
stopAudioRecording | Stops audio recording. |
enableAudioVolumeEvaluation | Enables volume reminder. |
API | Description |
---|---|
startScreenCapture | Starts screen sharing. |
stopScreenCapture | Stops screen sharing. |
pauseScreenCapture | Pauses screen sharing. |
resumeScreenCapture | Resumes screen sharing. |
API | Description |
---|---|
getDeviceManager | Gets the device management object TXDeviceManager. |
getBeautyManager | Gets the beauty filter management object TXBeautyManager. |
API | Description |
---|---|
sendRoomTextMsg | Broadcasts a text message in a meeting, which is generally used for chat. |
sendRoomCustomMsg | Sends a custom text message. |
TRTCLiveRoomDelegate
API OverviewAPI | Description |
---|---|
onError | Error |
onWarning | Warning |
onKickedOffline | Callback for being kicked offline because another user logged in to the account. |
API | Description |
---|---|
onRoomDestroy | Callback for meeting room termination. |
onNetworkQuality | Callback for network status. |
onUserVolumeUpdate | User volume |
API | Description |
---|---|
onEnterRoom | You entered the meeting. |
onLeaveRoom | You left the meeting. |
onUserEnterRoom | A new member joined the meeting. |
onUserLeaveRoom | A member left the meeting. |
API | Description |
---|---|
onUserAudioAvailable | A member turned the mic on/off. |
onUserVideoAvailable | A member turned the camera on/off. |
onUserSubStreamAvailable | A member enabled/disabled the substream image. |
API | Description |
---|---|
onRecvRoomTextMsg | A text message was received. |
onRecvRoomCustomMsg | A custom message was received. |
API | Description |
---|---|
onScreenCaptureStarted | Screen sharing started. |
onScreenCapturePaused | Screen sharing paused. |
onScreenCaptureResumed | Screen sharing resumed. |
onScreenCaptureStoped | Screen sharing stopped. |
This API is used to get the TRTCMeeting singleton object.
static Future sharedInstance();
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.
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 ofTRTCMeeting
.
This API is used to terminate an event listener.
void unRegisterListener(MeetingListenerFunc func);
This API is used to log in to the Tencent backend server.
Future login(int sdkAppId, String userId, String userSig);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
sdkAppId | int | You can view the SDKAppID via Application Management > Application Info in the TRTC console. |
userId | String | ID of current user, which is a string that can contain only letters (a-z and A-Z), digits (0–9), hyphens (-), and underscores (_). |
userSig | String | Tencent Cloud's proprietary security signature. For more information on how to get it, please see UserSig. |
This API is used to log out of the Tencent backend server.
Future logout();
This API is used to set the profile.
Future setSelfProfile(String userName, String avatarURL);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userName | String | Username. |
avatarURL | String | User profile photo URL. |
This API is used to create a meeting (called by the anchor).
Future createMeeting(int roomId);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
roomId | int | Meeting room ID. You need to assign and manage the IDs in a centralized manner. |
Generally, the anchor calls the APIs in the following steps:
createMeeting()
and passes in roomId
to create a meeting. No matter whether the room is successfully created, the result will be notified to the anchor through ActionCallback
. startCameraPreview()
to enable camera preview. At this time, the beauty filter parameters can be adjusted.startMicrophone()
to enable mic capturing.This API is used to terminate a meeting room (called by the anchor). After creating a meeting, the anchor can call this API to terminate it.
Future destroyMeeting(int roomId);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
roomId | int | Meeting room ID. You need to assign and manage the IDs in a centralized manner. |
This API is used to enter a meeting room (called by participant).
Future enterMeeting(int roomId);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
roomId | int | Meeting room ID. |
Generally, the participant joins a meeting in the following steps:
enterMeeting()
and passes in roomId
to enter the meeting room.startCameraPreview()
to enable camera preview and calls startMicrophone()
to enable mic capturing.onUserVideoAvailable
event and calls startRemoteView()
and passes in the userId
of the target member to start playback.This API is used to leave a meeting room (called by participant).
Future leaveMeeting();
This API is used to get the list of all users in the room. It will take effect only if it is called after enterMeeting()
succeeds.
Future getUserInfoList(List<String> userIdList);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIdList | List |
List of userId values to obtain. |
This API is used to get the details of a specified user in the room. It will take effect only if it is called after enterMeeting()
succeeds.
Future getUserInfo(String userId);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | Specified user ID. |
This API is used to play back the remote video image of a specified member.
Future<void> startRemoteView(String userId, int streamType, int viewId);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | Specified user ID. |
streamType | int | Type of the video stream to watch. For more information, please see TRTC SDK. |
viewId | int | viewId generated by TRTCCloudVideoView . |
This API is used to stop playing back the remote video image of a specified member.
Future<void> stopRemoteView(String userId, int streamType);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | Specified user ID. |
streamType | int | Type of the video stream to watch. For more information, please see TRTC SDK. |
This API is used to set the remote video image rendering parameters of a specified member.
Future<void> setRemoteViewParam(String userId, int streamType,
{int fillMode, int rotation, int mirrorType});
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | Specified user ID. |
streamType | int | Type of the video stream to watch. For more information, please see TRTC SDK. |
fillMode | int | Video image rendering mode: fill (default value) or fit. For more information, please see TRTC SDK. |
rotation | int | Clockwise video image rotation angle. For more information, please see TRTC SDK. |
mirrorType | int | Mirroring mode. For more information, please see TRTC SDK. |
This API is used to mute/unmute a specified member's remote audio.
Future<void> muteRemoteAudio(String userId, bool mute);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | Specified user ID. |
mute | boolean | true: mute; false: unmute. |
This API is used to mute/unmute all members' remote audio.
Future<void> muteAllRemoteAudio(bool mute);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
mute | boolean | true: mute; false: unmute. |
This API is used to pause/resume a specified member's remote video stream.
Future<void> muteRemoteVideoStream(String userId, bool mute);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | Specified user ID. |
mute | boolean | true: pause; false: resume. |
This API is used to pause/resume all members' remote video streams.
Future<void> muteAllRemoteVideoStream(bool mute);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
mute | boolean | true: pause; false: resume. |
This API is used to enable local video preview.
Future<void> startCameraPreview(bool isFront, int viewId);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
isFront | boolean | true: front camera; false: rear camera. |
viewId | int | viewId generated by TRTCCloudVideoView . |
This API is used to stop local video capturing and preview.
Future<void> stopCameraPreview();
This API is used to switch between the front and rear cameras.
Future<void> switchCamera(bool isFront);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
isFront | boolean | true: front camera; false: rear camera. |
This API is used to set video encoder parameters.
Future<void> setVideoEncoderParam({
int videoFps,
int videoBitrate,
int videoResolution,
int videoResolutionMode,
});
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
videoFps | int | Video capturing frame rate. |
videoBitrate | int | Bitrate. The SDK encodes streams at the target video bitrate and will actively reduce the bitrate only if the network conditions are poor. |
videoResolution | int | Resolution. |
videoResolutionMode | int | Resolution mode. |
Note:For more information, please see TRTC SDK.
This API is used to set the mirroring preview mode of local video image.
Future<void> setLocalViewMirror(bool isMirror);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
isMirror | boolean | Whether to enable mirroring preview mode. true : yes; false : no. |
This API is used to start mic capturing.
Future<void> startMicrophone({int quality});
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
quality | int | Audio quality. For more information, please see TRTC SDK. |
This API is used to stop mic capturing.
Future<void> stopMicrophone();
This API is used to mute/unmute local audio.
Future<void> muteLocalAudio(bool mute);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
mute | boolean | true: mute. false: unmute. |
This API is used to turn the speaker or receiver on.
Future<void> setSpeaker(bool useSpeaker);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
useSpeaker | boolean | true : speaker; false : receiver |
This API is used to set the mic capturing volume.
Future<void> setAudioCaptureVolume(int volume);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
volume | int | Capturing volume. Value range: 0-100 (default: 100) |
This API is used to set the playback volume.
Future<void> setAudioPlayoutVolume(int volume);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
volume | int | Playback volume. Value range: 0-100 (default: 100) |
This API is used to start audio recording.
Future<int?> startAudioRecording(String filePath);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
filePath | String | Storage path of the audio recording file. Please specify it by yourself 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. |
This API is used to stop audio recording.
Future<void> stopAudioRecording();
This API is used to enable the volume reminder.
Future<void> enableAudioVolumeEvaluation(int intervalMs);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
intervalMs | int | Determines 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. |
This API is used to start screen sharing.
Future<void> startScreenCapture({
int videoFps,
int videoBitrate,
int videoResolution,
int videoResolutionMode,
String appGroup,
});
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
videoFps | int | Video capturing frame rate. |
videoBitrate | int | Bitrate. The SDK encodes streams at the target video bitrate and will actively reduce the bitrate only if the network conditions are poor. |
videoResolution | int | Resolution. |
videoResolutionMode | int | Resolution mode. |
appGroup | String | 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. |
Note:For more information, please see TRTC SDK.
This API is used to stop screen capturing.
Future<void> stopScreenCapture();
This API is used to pause screen capturing.
Future<void> pauseScreenCapture();
This API is used to resume screen capturing.
Future<void> resumeScreenCapture();
This API is used to get the device management object TXDeviceManager.
getDeviceManager();
This API is used to get the beauty filter management object TXBeautyManager.
getBeautyManager();
You can do the following using TXBeautyManager
:
This API is used to broadcast a text message in a meeting, which is generally used for chat.
Future sendRoomTextMsg(String message);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
message | String | Text message |
This API is used to send a custom text message.
Future sendRoomCustomMsg(String cmd, String message);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
cmd | String | Custom command word used to distinguish between different message types |
message | String | Text message |
TRTCMeetingDelegate
Event CallbacksCallback 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 as detailed below:
Parameter | Type | Description |
---|---|---|
errCode | int | Error code. |
errMsg | String | Error message |
extraInfo | String | Extended field. Certain error codes may carry extra information for troubleshooting. |
Callback for warning.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
warningCode | int | Warning code. |
warningMsg | String | Warning message. |
extraInfo | String | Extended field. Certain error codes may carry extra information for troubleshooting. |
Callback for being kicked offline because another user logged in to the same account.
Callback for meeting room termination. When the anchor leaves the room, all users in the room will receive this callback.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
roomId | String | Meeting room ID. |
Callback for network status.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
localQuality | TRTCCloudDef.TRTCQuality | Upstream network quality. |
remoteQuality | List<TRTCCloudDef.TRTCQuality> | Downstream network quality. |
Call volume of a user.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userVolumes | List | Volume of every speaking user in the room. Value range: 0-100. |
totalVolume | int | Total volume of all remote users. Value range: 0-100. |
You joined the meeting.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
result | int | A value greater than 0 indicates the time used for joining the meeting, in ms. A value smaller than 0 indicates the error code for joining the meeting. |
You left the meeting.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
reason | int | 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 dismissed. |
A new member joined the meeting.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | User ID of the new member who joins the meeting. |
A member left the meeting.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | User ID of the member who leaves the meeting. |
A member turned the mic on/off.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | User ID |
available | boolean | true: the mic is enabled; false: the mic is disabled. |
A member turned the camera on/off.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | User ID |
available | boolean | true: the camera is enabled; false: the camera is disabled. |
A member enabled/disabled the substream image.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | User ID |
available | boolean | true: the substream image is enabled; false: the substream image is disabled. |
A text message was received.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
message | String | Text message |
sendId | String | Sender's user ID. |
userAvatar | String | Sender's profile photo. |
userName | String | Sender's nickname. |
A custom message was received.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
command | String | Custom command word used to distinguish between different message types |
message | String | Text message |
sendId | String | Sender's user ID. |
userAvatar | String | Sender's profile photo. |
userName | String | Sender's nickname. |
Screen sharing started.
Screen sharing paused.
Screen sharing resumed.
Screen sharing stopped.
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
reason | int | Reason for stop. 0: the user stopped proactively; 1: screen sharing stopped as the shared window was closed. |
Was this page helpful?