tencent cloud

Feedback

TUIRoom (Android)

Last updated: 2022-07-22 15:13:43
    1. TUIRoom is based on Tencent Real-Time Communication (TRTC) and Instant Messaging (IM). Its features include:
    • A host can create a room, and users can enter the room ID to join the room.
    • Room members 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 IM. When you activate TRTC, the IM SDK Trial Edition will be activated by default, which will support up to 100 DAUs. For IM billing details, see Pricing.

    TUIRoom is an open-source class depending on two closed-source Tencent Cloud SDKs. For the specific implementation process, see Group Audio/Video Room (Android).

    • TRTC SDK: The TRTC SDK is used as a low-latency audio/video room component.
    • IM SDK: The IM SDK for Android is used to implement the chat room feature.

    TUIRoom API Overview

    Basic functions of TUIRoomCore

    API Description
    getInstance Gets a singleton object.
    destroyInstance Terminates a singleton object.
    setListener Sets event callbacks.

    Room APIs

    API Description
    createRoom Creates a room (called by host).
    destroyRoom Closes the room (called by host).
    enterRoom Enters a room (called by a member)
    leaveRoom Exits a room (called by other room members).
    getRoomInfo Gets the room information.
    getRoomUsers Gets the information of all users in the room.
    getUserInfo Gets the information of a user.
    transferRoomMaster Transfers the host permissions to another user (called by host).

    Local audio/video operation APIs

    API Description
    startCameraPreview Enables the preview image of local video.
    stopCameraPreview Stops local video capturing and preview.
    startLocalAudio Enables mic capturing.
    stopLocalAudio Stops mic capturing.
    setVideoMirror Sets the mirror mode for local preview.
    setSpeaker Sets whether to play sound from the device’s speaker or receiver.

    Remote user APIs

    API Description
    startRemoteView Subscribes to and plays back the video of a specified remote member.
    stopRemoteView Unsubscribes from and stops the playback of a remote video image.

    Chat message sending APIs

    API Description
    sendChatMessage Sends a chat message.
    sendCustomMessage Sends a custom message.

    Room control APIs

    API Description
    muteUserMicrophone Enables/Disables the mic of a specified user.
    muteAllUsersMicrophone Enables/Disables the mic of all users and syncs the status to room information.
    muteUserCamera Enables/Disables the camera of a specified user.
    muteAllUsersCamera Enables/Disables the camera of all users and syncs the status to room information.
    muteChatRoom Turns on/off chat (called by host).
    kickOffUser Removes a specified user from the room (called by host).
    startCallingRoll Starts a roll call (called by host).
    stopCallingRoll Stops a roll call (called by host).
    replyCallingRoll Replies to a roll call (called by a member).
    sendSpeechInvitation Sends a speech invitation to a member (called by host).
    cancelSpeechInvitation Cancels a speech invitation sent to a member (called by host).
    replySpeechInvitation Accepts/Rejects the speech invitation of the host (called by a member).
    sendSpeechApplication Sends a speech request (called by a member).
    replySpeechApplication Approves/Rejects the speech request of a member (called by host).
    forbidSpeechApplication Disables requests to speak (called by host).
    sendOffSpeaker Stops the speech of a member (called by host).
    sendOffAllSpeakers Stops the speech of all members in the room (called by host).
    exitSpeechState Stops speaking and becomes an audience member.

    Screen sharing APIs

    API Description
    startScreenCapture Starts screen sharing.
    stopScreenCapture Stops screen sharing.

    Beauty filter APIs

    API Description
    getBeautyManager Gets the beauty filter management object TXBeautyManager.

    Settings APIs

    API Description
    setVideoQosPreference Sets network QoS control parameters.

    SDK version APIs

    API Description
    getSDKVersion Gets the SDK version.

    TUIRoomCoreListener API Overview

    Callbacks for error events

    API Description
    onError Callback for error.

    Basic event callbacks

    API Description
    onDestroyRoom The room was closed.
    onUserVoiceVolume Volume level.
    onRoomMasterChanged The host changed.

    Remote user event callbacks

    API Description
    onRemoteUserEnter A remote user entered the room.
    onRemoteUserLeave A remote user exited the room.
    onRemoteUserCameraAvailable Whether a remote user enabled the camera.
    onRemoteUserScreenVideoAvailable Whether a remote user enabled screen sharing.
    onRemoteUserAudioAvailable Whether a remote user enabled sending audio.
    onRemoteUserEnterSpeechState A remote user started speaking.
    onRemoteUserExitSpeechState A remote user stopped speaking.

    Message event callback APIs

    API Description
    onReceiveChatMessage A text chat message was received.
    onReceiveRoomCustomMsg A custom message was received.

    Room control event callbacks

    API Description
    onReceiveSpeechInvitation A member received a speech invitation from the host.
    onReceiveInvitationCancelled The speech invitation sent to a member was canceled by the host.
    onReceiveSpeechApplication The host received a speech request from a member.
    onSpeechApplicationCancelled A member canceled a speech request.
    onSpeechApplicationForbidden The host disabled requests to speak.
    onOrderedToExitSpeechState A member was asked to stop speaking.
    onCallingRollStarted The host started a roll call.
    onCallingRollStopped The host stopped a roll call.
    onMemberReplyCallingRoll A member replied to the roll call.
    onChatRoomMuted The host turned on/off chat.
    onMicrophoneMuted The host disabled mic use.
    onCameraMuted The host disabled camera use.
    onReceiveKickedOff The host removed a member from the room.

    Callback APIs for statistics on network quality and technical metrics

    API Description
    onStatistics Statistics on technical metrics.
    onNetworkQuality Network quality.

    Screen sharing event callbacks

    API Description
    onScreenCaptureStarted Screen sharing started.
    onScreenCaptureStopped Screen sharing stopped.

    Basic Functions of TUIRoomCore

    getInstance

    This API is used to get the TUIRoomCore singleton object.

    public static TUIRoomCore getInstance(Context context);
    

    The parameters are described below:

    Parameter Type Description
    context Context Android context, which will be converted to ApplicationContext for the system APIs to call.

    destroyInstance

    void destroyInstance();
    

    setListener

    This API is used to get the event callback of TUIRoomCore. You can use TRTCVoiceRoomDelegate to get various status notifications of TUIRoomCore.

    void setListener(TUIRoomCoreListener listener);
    

    The parameters are described below:

    Parameter Type Description
    listener TUIRoomCoreListener Event callback class.

    createRoom

    This API is used to create a room (called by the host).

    void createRoom(String roomId, TUIRoomCoreDef.SpeechMode speechMode, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    roomId String The room ID. You need to assign and manage the IDs in a centralized manner.
    speechMode TUIRoomCoreDef.SpeechMode The speech mode.
    callback TUIRoomCoreCallback.ActionCallback The result of room creation.

    Generally, the host calls the APIs in the following steps:

    1. The host calls createRoom() to create a room, the result of which is returned via TUIRoomCoreCallback.ActionCallback.
    2. The host calls startCameraPreview() to enable camera capturing and preview.
    3. The host calls startLocalAudio() to enable the local mic.

    destroyRoom

    This API is used to close a room (called by the host).

    void destroyRoom(TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    callback UIRoomCoreCallback.ActionCallback Room termination result.

    enterRoom

    This API is used to enter a room (called by a member).

    void enterRoom(String roomId, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    roomId String The room ID.
    callback UIRoomCoreCallback.ActionCallback Result.

    Generally, a member enters a room in the following steps:

    1. The member calls enterRoom and passes in roomId to enter the room.
    2. The member calls startCameraPreview() to enable camera preview and calls startLocalAudio()` to enable mic capturing.
    3. The member receives the onRemoteUserCameraAvailable event and calls startRemoteView() to start playback.

    leaveRoom

    This API is used to exit a room (called by a member).

    void leaveRoom(TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    callback UIRoomCoreCallback.ActionCallback Result.

    getRoomInfo

    This API is used to get the room information.

    TUIRoomCoreDef.RoomInfo getRoomInfo();
    

    getRoomUsers

    This API is used to get the information of all users in the room.

    List<TUIRoomCoreDef.UserInfo> getRoomUsers();
    

    getUserInfo

    This API is used to get the information of a user in the room.

    void getUserInfo(String userId, TUIRoomCoreCallback.UserInfoCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The user ID.
    callback UIRoomCoreCallback.UserInfoCallback Room member details.

    setSelfProfile

    This API is used to set user profile.

    void setSelfProfile(String userName, String avatarURL, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userName String The username.
    avatarURL String The URL of the user profile photo.
    callback TUIRoomCoreCallback.ActionCallback Whether the setting succeeded.

    transferRoomMaster

    This API is used to transfer a room to another user.

    void transferRoomMaster(String userId, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The user ID.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    Local Push APIs

    startCameraPreview

    This API is used to start the preview of the local camera.

    void startCameraPreview(boolean isFront, TXCloudVideoView view);
    

    The parameters are described below:

    Parameter Type Description
    isFront boolean true: Front camera; false: Rear camera
    view TXCloudVideoView The control that loads video images.

    stopCameraPreview

    This API is used to stop the preview of the local camera.

    void stopCameraPreview();
    

    startLocalAudio

    This API is used to start mic capturing.

    void startLocalAudio(int quality);
    

    The parameters are described below:

    Parameter Type Description
    quality int Captured sound quality:
  • TRTC_AUDIO_QUALITY_MUSIC
  • TRTC_AUDIO_QUALITY_DEFAULT
  • TRTC_AUDIO_QUALITY_SPEECH
  • stopLocalAudio

    This API is used to stop mic capturing.

    void stopLocalAudio();
    

    setVideoMirror

    This API is used to set the mirror mode for local preview.

    void setVideoMirror(int type);
    

    The parameters are described below:

    Parameter Type Description
    type int Mirroring type.

    setSpeaker

    This API is used to set whether to play sound from the device’s speaker or receiver.

    void setSpeaker(boolean isUseSpeaker);
    

    The parameters are described below:

    Parameter Type Description
    isUseSpeaker boolean true: Speaker; false: Receiver.

    Remote User APIs

    startRemoteView

    This API is used to subscribe to a remote user's video stream.

    void startRemoteView(String userId, TXCloudVideoView view, TUIRoomCoreDef.SteamType streamType, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The ID of the user whose video image is to be played back.
    view TXCloudVideoView The control that loads video images.
    streamType TUIRoomCoreDef.SteamType The stream type.
    callback TUIRoomCoreCallback.ActionCallback Result.

    stopRemoteView

    This API is used to unsubscribe from and stop the playback of a remote video image.

    void stopRemoteView(String userId, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The ID of the user whose video image is to be stopped.
    callback TUIRoomCoreCallback.ActionCallback Result.

    switchCamera

    This API is used to switch between the front and rear cameras.

    void switchCamera(boolean isFront);
    

    The parameters are described below:

    Parameter Type Description
    isFront boolean true: Front camera; false: Rear camera.

    Message Sending APIs

    sendChatMessage

    Broadcast a text chat message in the room. This API is generally used for text chat.

    void sendChatMessage(String message, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    message String Message content.
    callback TUIRoomCoreCallback.ActionCallback Callback of the operation.

    sendCustomMessage

    This API is used to send a custom message.

    void sendCustomMessage(String data, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    data String Message content.
    callback TUIRoomCoreCallback.ActionCallback Callback of the operation.

    Room Control APIs

    muteUserMicrophone

    This API is used to enable/disable the mic of the specified user.

    void muteUserMicrophone(String userId, boolean mute, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    mute boolean Whether to disable.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    muteAllUsersMicrophone

    This API is used to enable/disable the mics of all users.

    void muteAllUsersMicrophone(boolean mute, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    mute boolean Whether to disable.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    muteUserCamera

    This API is used to enable/disable the cameras of the specified user.

    void muteUserCamera(String userId, boolean mute, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    mute boolean Whether to disable.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    muteAllUsersCamera

    This API is used to enable/disable the cameras of all users.

    void muteAllUsersCamera(boolean mute, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    mute boolean Whether to disable.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    muteChatRoom

    This API is used to forbid/allow text chat.

    void muteChatRoom(boolean mute, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    mute boolean Whether to disable.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    kickOffUser

    This API is used by the host to remove a member from the room.

    void kickOffUser(String userId, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    startCallingRoll

    This API is used by the host to start a roll call.

    void startCallingRoll(TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    stopCallingRoll

    This API is used by the host to stop a roll call.

    void stopCallingRoll(TUIRoomCoreCallback.ActionCallback callback);
    
    

    The parameters are described below:

    Parameter Type Description
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    replyCallingRoll

    This API is used by a member to reply to the roll call.

    void replyCallingRoll(TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    sendSpeechInvitation

    This API is used by the host to invite a member to speak.

    void sendSpeechInvitation(String userId, TUIRoomCoreCallback.InvitationCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    callback TUIRoomCoreCallback.InvitationCallback Result.

    cancelSpeechInvitation

    This API is used by the host to cancel the speech invitation sent to a member.

    void cancelSpeechInvitation(String userId, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    replySpeechInvitation

    This API is used by a member to accept/reject an invitation to speak by the host.

    void replySpeechInvitation(boolean agree, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    agree boolean Whether to approve.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    sendSpeechApplication

    This API is used by a member to request to speak.

    void sendSpeechApplication(TUIRoomCoreCallback.InvitationCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    callback TUIRoomCoreCallback.InvitationCallback Result.

    cancelSpeechApplication

    This API is used by a member to cancel their request to speak.

    void cancelSpeechApplication(TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    replySpeechApplication

    This API is used by the host to approve/reject a speech request sent by a member.

    void replySpeechApplication(boolean agree, String userId, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    agree boolean Whether to approve.
    userId String The User ID.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    forbidSpeechApplication

    This API is used by the host to disable requests to speak.

    void forbidSpeechApplication(boolean forbid, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    forbid boolean Whether to disable.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    sendOffSpeaker

    This API is used by the host to stop the speech of the specified member.

    void sendOffSpeaker(String userId, TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    sendOffAllSpeakers

    This API is used by the host to stop the speech of all members.

    void sendOffAllSpeakers(TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    exitSpeechState

    This API is used to stop speaking and become an audience member.

    void exitSpeechState(TUIRoomCoreCallback.ActionCallback callback);
    

    The parameters are described below:

    Parameter Type Description
    callback TUIRoomCoreCallback.ActionCallback Callback of the result.

    Screen Sharing APIs

    startScreenCapture

    This API is used to start screen sharing.

    void startScreenCapture(TRTCCloudDef.TRTCVideoEncParam encParams, TRTCCloudDef.TRTCScreenShareParams screenShareParams);
    

    The parameters are described below:

    Parameter Type Description
    encParams TRTCCloudDef.TRTCVideoEncParam Screen sharing encoding parameters. We recommend you use the above configuration. If you set encParams to null, the encoding parameter settings before startScreenCapture is called will be used.
    screenShareParams TRTCCloudDef.TRTCScreenShareParams Special screen sharing configuration. We recommend you set floatingView which can prevent the application from being killed by the system and help protect user privacy.
    Note:

    For more information, see TRTC SDK.

    stopScreenCapture

    This API is used to stop screen capturing.

    void stopScreenCapture();
    

    Beauty Filter APIs

    getBeautyManager

    This API is used to get the beauty filter management object TXBeautyManager.

    TXBeautyManager getBeautyManager();
    

    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.

    Settings APIs

    setVideoQosPreference

    This API is used to set QoS parameters.

    void setVideoQosPreference(TRTCCloudDef.TRTCNetworkQosParam preference);
    

    The parameters are described below:

    Parameter Type Description
    preference TRTCCloudDef.TRTCNetworkQosParam Network QoS control policy.

    setAudioQuality

    This API is used to set audio quality.

    void setAudioQuality(int quality);
    

    The parameters are described below:

    Parameter Type Description
    quality int Audio quality. For more information, see TRTC SDK.

    setVideoResolution

    This API is used to set the resolution.

    void setVideoResolution(int resolution);
    

    The parameters are described below:

    Parameter Type Description
    resolution int Video resolution. For more information, see TRTC SDK.

    setVideoFps

    This API is used to set the frame rate.

    void setVideoFps(int fps);
    

    The parameters are described below:

    Parameter Type Description
    fps int Video capturing frame rate.
    Note:

    Recommended value: 15 or 20 fps. Video will stutter severely if the frame rate is lower than 5 fps and slightly if it is lower than 10 fps. Setting the frame rate to higher than 20 fps would be a waste of resources (the frame rate of films is 24 fps).

    setVideoBitrate

    This API is used to set the bitrate.

    void setVideoBitrate(int bitrate);
    

    The parameters are described below:

    Parameter Type Description
    bitrate int Bitrate. The SDK encodes streams at the target video bitrate and will actively reduce the bitrate only if the network conditions are poor. For more information, see TRTC SDK.
    Note:

    Recommended value: See the optimal bitrate for each tier in TRTCVideoResolution. You can also slightly increase the optimal bitrate. For example, TRTC_VIDEO_RESOLUTION_1280_720 corresponds to the target bitrate of 1,200 Kbps, and you can also set the bitrate to 1,500 Kbps for higher definition.

    enableAudioEvaluation

    This API is used to enable the volume reminder.

    void enableAudioEvaluation(boolean enable);
    

    The parameters are described below:

    Parameter Type Description
    enable boolean true: Enable; false: Disable.
    Note:

    After this feature is enabled, the result of volume evaluation by the SDK will be obtained in onUserVolumeUpdate.

    setAudioPlayVolume

    This API is used to set the playback volume.

    void setAudioPlayVolume(int volume);
    

    The parameters are described below:

    Parameter Type Description
    volume int Playback volume. Value range: 0–100. Default value: 100.

    setAudioCaptureVolume

    This API is used to set the mic capturing volume.

    void setAudioCaptureVolume(int volume);
    

    The parameters are described below:

    Parameter Type Description
    volume int Capture volume. Value range: 0–100. Default value: 100.

    startFileDumping

    This API is used to start audio recording.

    void startFileDumping(TRTCCloudDef.TRTCAudioRecordingParams trtcAudioRecordingParams);
    

    The parameters are described below:

    Parameter Type Description
    trtcAudioRecordingParams TRTCCloudDef.TRTCAudioRecordingParams Audio recording parameters. For more information, see TRTC SDK.
    Note:

    After this API is called, the SDK will record all audios of a call, including the local audio, remote audios, and background music, into a single file. This API works regardless of whether you are in the room or not. When leaveRoom is called, audio recording will stop automatically.

    stopFileDumping

    This API is used to stop audio recording.

    void stopFileDumping();
    

    SDK Version APIs

    getSdkVersion

    This API is used to get SDK version information.

    int getSdkVersion();
    

    Error Event Callbacks

    onError

    void onError(int code, String message);
    

    The parameters are described below:

    Parameter Type Description
    code int Error code
    message String Error message

    Basic Event Callbacks

    onDestroyRoom

    The room was closed.

    void onDestroyRoom();
    

    onUserVoiceVolume

    User volume level.

    void onUserVoiceVolume(String userId, int volume);
    

    The parameters are described below:

    Parameter Type Description
    userID String The User ID.
    volume int User volume level. Value range: 0–100.

    onRoomMasterChanged

    The host changed.

    void onRoomMasterChanged(String previousUserId, String currentUserId);
    

    The parameters are described below:

    Parameter Type Description
    previousUserId String Host’s user ID before the change.
    currentUserId String Host’s user ID after the change.

    Remote User Callbacks

    onRemoteUserEnter

    A remote user entered the room.

    void onRemoteUserEnter(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.

    onRemoteUserLeave

    A remote user exited the room.

    void onRemoteUserLeave(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.

    onRemoteUserCameraAvailable

    Whether a remote user enabled the camera.

    void onRemoteUserCameraAvailable(String userId, boolean available);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    available boolean true: Enabled; false: Disabled.

    onRemoteUserScreenVideoAvailable

    A member enabled/disabled video sharing.

    void onRemoteUserScreenVideoAvailable(String userId, boolean available);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    available boolean Whether screen sharing stream data is available.

    onRemoteUserAudioAvailable

    Whether a remote user is sending audio.

    void onRemoteUserAudioAvailable(String userId, boolean available);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    available boolean Whether audio data is available.

    onRemoteUserEnterSpeechState

    A remote user started speaking.

    void onRemoteUserEnterSpeechState(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.

    onRemoteUserExitSpeechState

    A remote user stopped speaking.

    void onRemoteUserExitSpeechState(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.

    Chat Room Message Event Callbacks

    onReceiveChatMessage

    A text chat message was received.

    void onReceiveChatMessage(String userId, String message);
    

    The parameters are described below:

    Parameter Type Description
    userID String The User ID.
    message String Text message

    onReceiveRoomCustomMsg

    A custom message was received.

    void onReceiveRoomCustomMsg(String userId, String data);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.
    message String Custom message.

    Room Control Message Callbacks

    onReceiveSpeechInvitation

    A member received a speech invitation from the host.

    void onReceiveSpeechInvitation(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The host's user ID.

    onReceiveInvitationCancelled

    The speech invitation sent to a member was canceled by the host.

    void onReceiveInvitationCancelled(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The host's user ID.

    onReceiveSpeechApplication

    The host received a speech request from a member.

    void onReceiveSpeechApplication(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.

    onSpeechApplicationCancelled

    A user canceled a speech request.

    void onSpeechApplicationCancelled(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.

    onSpeechApplicationForbidden

    The host disabled requests to speak.

    void onSpeechApplicationForbidden(boolean isForbidden);
    

    The parameters are described below:

    Parameter Type Description
    isForbidden boolean Whether to disable.

    onOrderedToExitSpeechState

    A member was asked to stop speaking.

    void onOrderedToExitSpeechState(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The host's user ID.

    onCallingRollStarted

    The host started a roll call.

    void onCallingRollStarted(String userId);
    

    onCallingRollStopped

    The host stopped a roll call.

    void onCallingRollStopped(String userId);
    

    onMemberReplyCallingRoll

    A member replied to the roll call.

    void onMemberReplyCallingRoll(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The User ID.

    onChatRoomMuted

    The host turned on/off chat.

    void onChatRoomMuted(boolean muted);
    

    The parameters are described below:

    Parameter Type Description
    muted boolean Whether to disable.

    onMicrophoneMuted

    The host disabled mic use.

    void onMicrophoneMuted(boolean muted);
    

    The parameters are described below:

    Parameter Type Description
    muted boolean Whether to disable.

    onCameraMuted

    The host disabled camera use.

    void onCameraMuted(boolean muted);
    

    The parameters are described below:

    Parameter Type Description
    muted boolean Whether to disable.

    onReceiveKickedOff

    The host removed a member from the room.

    void onReceiveKickedOff(String userId);
    

    The parameters are described below:

    Parameter Type Description
    userId String The user ID of the host/admin.

    Statistics Collection and Quality Callbacks

    onStatistics

    Callback of technical metric statistics.

    void onStatistics(TRTCStatistics statistics);
    

    The parameters are described below:

    Parameter Type Description
    statis TRTCStatistics Statistics.

    onNetworkQuality

    Network quality.

    void onNetworkQuality(TRTCCloudDef.TRTCQuality localQuality, List<TRTCCloudDef.TRTCQuality> remoteQuality);
    

    The parameters are described below:

    Parameter Type Description
    localQuality TRTCCloudDef.TRTCQuality Upstream network quality.
    remoteQuality List<TRTCCloudDef.TRTCQuality> Downstream network quality.
    Note:

    For more information, see TRTC SDK.

    Screen Sharing Event Callbacks

    onScreenCaptureStarted

    Screen sharing started.

    void onScreenCaptureStarted();
    

    onScreenCaptureStopped

    Screen sharing stopped.

    void onScreenCaptureStopped(int reason);
    

    The parameters are described below:

    Parameter Type Description
    reason int Reason for stop. 0: The user stopped screen sharing; 1: Interrupted by another application.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support