tencent cloud

Feedback

TUIRoom (iOS)

Last updated: 2022-09-26 10:48:49
    TUIRoom is based on Tencent Real-Time Communication (TRTC) and Instant Messaging (IM). Its features include:
    The 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.
    explain
    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 (iOS).
    TRTC SDK: The TRTC SDK is used as a low-latency audio/video room component.
    IM SDK: The IM SDK for iOS is used to implement the chat room feature.

    TUIRoom API Overview

    Basic functions of TUIRoomCore

    API
    Description
    Gets a singleton object.
    Terminates a singleton object.
    Sets event callbacks.

    Room APIs

    API
    Description
    Creates a room (called by host).
    Closes the room (called by host).
    Enters a room (called by a member)
    Exits a room (called by other room members).
    Gets the room information.
    Gets the information of all users in the room.
    Gets the information of a user.
    Transfers the host permissions to another user (called by host).

    Local audio/video operation APIs

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

    Remote user APIs

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

    Chat message sending APIs

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

    Room control APIs

    API
    Description
    Enables/Disables the mic of a specified user.
    Enables/Disables the mic of all users and syncs the status to room information.
    Enables/Disables the camera of a specified user.
    Enables/Disables the camera of all users and syncs the status to room information.
    Turns on/off chat (called by host).
    Removes a specified user from the room (called by host).
    Starts a roll call (called by host).
    Stops a roll call (called by host).
    Replies to a roll call (called by a member).
    Sends a speech invitation to a member (called by host).
    Cancels a speech invitation sent to a member (called by host).
    Accepts/Rejects the speech invitation of the host (called by a member).
    Sends a speech request (called by a member).
    Approves/Rejects the speech request of a member (called by host).
    Disables requests to speak (called by host).
    Stops the speech of a member (called by host).
    Stops the speech of all members in the room (called by host).
    Stops speaking and becomes an audience member.

    Screen sharing APIs

    API
    Description
    Starts screen sharing.
    Stops screen sharing.

    Beauty filter APIs

    API
    Description
    Gets the beauty filter management object TXBeautyManager.

    Settings APIs

    API
    Description
    Sets network QoS control parameters.

    SDK version acquisition APIs

    API
    Description
    Gets the SDK version.

    TUIRoomCoreDelegate API Overview

    Callbacks for error events

    API
    Description
    Callback for error.

    Basic event callbacks

    API
    Description
    The room was closed.
    Volume level.
    The host changed.

    Remote user event callbacks

    API
    Description
    A remote user entered the room.
    A remote user exited the room.
    Whether a remote user enabled the camera.
    Whether a remote user enabled screen sharing.
    Whether a remote user enabled sending audio.
    A remote user started speaking.
    A remote user stopped speaking.

    Message event callback APIs

    API
    Description
    A text chat message was received.

    Room control event callbacks

    API
    Description
    A member received a speech invitation from the host.
    The speech invitation sent to a member was canceled by the host.
    The host received a speech request from a member.
    A member canceled a speech request.
    The host rejected a speech request sent by a member.
    A member was asked to stop speaking.
    The host started a roll call.
    The host stopped a roll call.
    A member replied to the roll call.
    The host turned on/off chat.
    The host disabled mic use.
    The host disabled camera use.
    The host removed a member from the room.

    Callback APIs for statistics on network quality and technical metrics

    API
    Description
    Statistics on technical metrics.
    Network quality.

    Screen sharing event callbacks

    API
    Description
    Screen sharing started.
    Screen sharing stopped.

    Basic Functions of TUIRoomCore

    getInstance

    This API is used to get the TUIRoomCore singleton object.
    + (instancetype)shareInstance;

    destroyInstance

    + (void)destroyInstance;

    setDelegate

    This API is used to get the event callback of TUIRoomCore. You can use TRTCVoiceRoomDelegate to get various status notifications of TUIRoomCore.
    - (void)setDelegate:(id<TUIRoomCoreDelegate>)delegate;
    The parameters are described below:
    Parameter
    Type
    Description
    delegate
    TUIRoomCoreDelegate
    Event callback class.

    createRoom

    This API is used to create a room (called by the host).
    - (void)createRoom:(NSString *)roomId
    speechMode:(TUIRoomSpeechMode)speechMode
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    roomId
    NSString
    The room ID. You need to assign and manage the IDs in a centralized manner.
    speechMode
    TUIRoomSpeechMode
    The speech mode.
    callback
    TUIRoomActionCallback
    Room creation result.
    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 TUIRoomActionCallback.
    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:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    callback
    TUIRoomActionCallback
    Room termination result.

    enterRoom

    This API is used to enter a room (called by a member).
    - (void)enterRoom:(NSString *)roomId
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    roomId
    NSString
    The room ID.
    callback
    TUIRoomActionCallback
    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:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    callback
    TUIRoomActionCallback
    Result.

    getRoomInfo

    This API is used to get the room information.
    - (nullable TUIRoomInfo *)getRoomInfo;

    getRoomUsers

    This API is used to get the information of all users in the room.
    - (nullable NSArray<TUIRoomUserInfo *> *)getRoomUsers;

    getUserInfo

    This API is used to get the information of a user in the room.
    - (void)getUserInfo:(NSString *)userId
    callback:(TUIRoomUserInfoCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    The user ID.
    callback
    TUIRoomUserInfoCallback
    Room member details.

    setSelfProfile

    This API is used to set user profile.
    - (void)setSelfProfile:(NSString *)userName
    avatarURL:(NSString *)avatarURL
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userName
    NSString
    The username.
    avatarURL
    NSString
    The URL of the user profile photo.
    callback
    TUIRoomActionCallback
    Whether the setting succeeded.

    transferRoomMaster

    This API is used to transfer a room to another user.
    - (void)transferRoomMaster:(NSString *)userId
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    The user ID.
    callback
    TUIRoomActionCallback
    Result.

    Local Push APIs

    startCameraPreview

    This API is used to start the preview of the local camera.
    - (void)startCameraPreview:(BOOL)isFront
    view:(UIView *)view;
    The parameters are described below:
    Parameter
    Type
    Description
    isFront
    BOOL
    YES: Front camera; NO: Rear camera.
    view
    UIView
    Control that carries the video image.

    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:(TRTCAudioQuality)quality;
    The parameters are described below:
    Parameter
    Type
    Description
    quality
    TRTCAudioQuality
    Captured sound quality.

    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:(TRTCVideoMirrorType)type;
    The parameters are described below:
    Parameter
    Type
    Description
    type
    TRTCVideoMirrorType
    Mirroring type.

    setSpeaker

    This API is used to set whether to play sound from the device’s speaker or receiver.
    - (void)setSpeaker:(BOOL)isUseSpeaker;
    The parameters are described below:
    Parameter
    Type
    Description
    isUseSpeaker
    BOOL
    YES: Speaker; NO: Receiver.

    Remote User APIs

    startRemoteView

    This API is used to subscribe to a remote user's video stream.
    - (void)startRemoteView:(NSString *)userId
    view:(UIView *)view
    streamType:(TUIRoomStreamType)streamType
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    The ID of the user whose video image is to be played back.
    view
    UIView
    The control that loads video images
    streamType
    TUIRoomStreamType
    The stream type.
    callback
    TUIRoomActionCallback
    Result.

    stopRemoteView

    This API is used to unsubscribe from and stop the playback of a remote video image.
    - (void)stopRemoteView:(NSString *)userId
    streamType:(TUIRoomStreamType)streamType
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    The ID of the user whose video image is to be stopped.
    streamType
    TUIRoomStreamType
    The stream type.
    callback
    TUIRoomActionCallback
    Result.

    switchCamera

    This API is used to switch between the front and rear cameras.
    - (void)switchCamera:(BOOL)isFront;
    
    The parameters are described below:
    Parameter
    Type
    Description
    isFront
    BOOL
    YES: Front camera; NO: Rear camera.

    Message Sending APIs

    sendChatMessage

    Broadcast a text chat message in the room. This API is generally used for text chat.
    - (void)sendChatMessage:(NSString *)message
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    message
    NSString
    Message content.
    callback
    TUIRoomActionCallback
    Callback of the operation.

    Room Control APIs

    muteUserMicrophone

    This API is used to enable/disable the mic of the specified user.
    - (void)muteUserMicrophone:(NSString *)userId
    mute:(BOOL)mute
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    mute
    BOOL
    Whether to disable.
    callback
    TUIRoomActionCallback
    Result.

    muteAllUsersMicrophone

    This API is used to enable/disable the mics of all users.
    - (void)muteAllUsersMicrophone:(BOOL)mute
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    mute
    BOOL
    Whether to disable.
    callback
    TUIRoomActionCallback
    Result.

    muteUserCamera

    This API is used to enable/disable the camera of the specified user.
    - (void)muteUserCamera:(NSString *)userId
    mute:(BOOL)mute
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    mute
    BOOL
    Whether to disable.
    callback
    TUIRoomActionCallback
    Result.

    muteAllUsersCamera

    This API is used to enable/disable the cameras of all users.
    - (void)muteAllUsersCamera:(BOOL)mute
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    mute
    BOOL
    Whether to disable.
    callback
    TUIRoomActionCallback
    Result.

    muteChatRoom

    This API is used to forbid/allow text chat.
    - (void)muteChatRoom:(BOOL)mute
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    mute
    BOOL
    Whether to disable.
    callback
    TUIRoomActionCallback
    Result.

    kickOffUser

    This API is used by the host to remove a member from the room.
    - (void)kickOffUser:(NSString *)userId
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    callback
    TUIRoomActionCallback
    Result.

    startCallingRoll

    This API is used by the host to start a roll call.
    - (void)startCallingRoll:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    callback
    TUIRoomActionCallback
    Result.

    stopCallingRoll

    This API is used by the host to stop a roll call.
    - (void)stopCallingRoll:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    callback
    TUIRoomActionCallback
    Result.

    replyCallingRoll

    This API is used by a member to reply to the roll call.
    - (void)replyCallingRoll:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    callback
    TUIRoomActionCallback
    Result.

    sendSpeechInvitation

    This API is used by the host to invite a member to speak.
    - (void)sendSpeechInvitation:(NSString *)userId
    callback:(TUIRoomInviteeCallback)callback
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    callback
    TUIRoomInviteeCallback
    Result.

    cancelSpeechInvitation

    This API is used by the host to cancel the speech invitation sent to a member.
    - (void)cancelSpeechInvitation:(NSString *)userId
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    callback
    TUIRoomActionCallback
    Result.

    replySpeechInvitation

    This API is used by a member to accept/reject the invitation to speak sent by the host.
    - (void)replySpeechInvitation:(BOOL)agree
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    agree
    BOOL
    Whether to approve.
    callback
    TUIRoomActionCallback
    Result.

    sendSpeechApplication

    This API is used by a member to request to speak.
    - (void)sendSpeechApplication:(TUIRoomInviteeCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    callback
    TUIRoomInviteeCallback
    Result.

    cancelSpeechApplication

    This API is used by a member to cancel their request to speak.
    - (void)cancelSpeechApplication:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    callback
    TUIRoomActionCallback
    Result.

    replySpeechApplication

    This API is used by the host to approve/reject a speech request sent by a member.
    - (void)replySpeechApplication:(BOOL)agree
    userId:(NSString *)userId
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    agree
    BOOL
    Whether to approve.
    userId
    NSString
    User ID.
    callback
    TUIRoomActionCallback
    Result.

    forbidSpeechApplication

    This API is used by the host to disable requests to speak.
    - (void)forbidSpeechApplication:(BOOL)forbid
    callback:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    forbid
    BOOL
    Whether to disable.
    callback
    TUIRoomActionCallback
    Result.

    sendOffSpeaker

    This API is used by the host to stop the speech of the specified member.
    - (void)sendOffSpeaker:(NSString *)userId
    callback:(TUIRoomInviteeCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    callback
    TUIRoomInviteeCallback
    Result.

    sendOffAllSpeakers

    This API is used by the host to stop the speech of all members.
    - (void)sendOffAllSpeakers:(TUIRoomInviteeCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    callback
    TUIRoomInviteeCallback
    Result.

    exitSpeechState

    This API is used to stop speaking and become an audience member.
    - (void)exitSpeechState:(TUIRoomActionCallback)callback;
    The parameters are described below:
    Parameter
    Type
    Description
    callback
    TUIRoomActionCallback
    Result.

    Screen Sharing APIs

    startScreenCapture

    This API is used to start screen sharing.
    - (void)startScreenCapture:(TRTCVideoEncParam *)encParam API_AVAILABLE(ios(11.0));
    The parameters are described below:
    Parameter
    Type
    Description
    encParams
    TRTCVideoEncParam
    Encoding parameters for screen sharing.
    explain
    For more information, see TRTC SDK.

    stopScreenCapture

    This API is used to stop screen capturing.
    - (void)stopScreenCapture API_AVAILABLE(ios(11.0));

    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:(TRTCNetworkQosParam *)preference;
    The parameters are described below:
    Parameter
    Type
    Description
    preference
    TRTCNetworkQosParam
    Network QoS control policy.

    setAudioQuality

    This API is used to set audio quality.
    - (void)setAudioQuality:(TRTCAudioQuality)quality;
    The parameters are described below:
    Parameter
    Type
    Description
    quality
    TRTCAudioQuality
    Audio quality. For more information, see TRTC SDK.

    setVideoResolution

    This API is used to set the resolution.
    - (void)setVideoResolution:(TRTCVideoResolution)resolution;
    The parameters are described below:
    Parameter
    Type
    Description
    resolution
    TRTCVideoResolution
    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.
    explain
    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.
    explain
    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:(BOOL)enable;
    The parameters are described below:
    Parameter
    Type
    Description
    enable
    BOOL
    YES: Enable. NO: Disable.
    explain
    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:(NSInteger)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:(NSInteger)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:(TRTCAudioRecordingParams *)params;
    The parameters are described below:
    Parameter
    Type
    Description
    params
    TRTCAudioRecordingParams
    Audio recording parameters. For more information, see TRTC SDK.
    explain
    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 Acquisition APIs

    getSdkVersion

    This API is used to get SDK version information.
    - (NSInteger)getSdkVersion;

    Error Event Callbacks

    onError

    - (void)onError:(NSInteger)code message:(NSString *)message;
    The parameters are described below:
    Parameter
    Type
    Description
    code
    NSInteger
    Error code.
    message
    NSString
    Error message.

    Basic Event Callbacks

    onDestroyRoom

    The room was closed.
    - (void)onDestroyRoom;

    onUserVoiceVolume

    User volume level.
    - (void)onUserVoiceVolume:(NSString *)userId volume:(NSInteger)volume;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    volume
    NSInteger
    User volume level. Value range: 0–100.

    onRoomMasterChanged

    The host changed.
    - (void)onRoomMasterChanged:(NSString *)previousUserId
    currentUserId:(NSString *)currentUserId;
    The parameters are described below:
    Parameter
    Type
    Description
    previousUserId
    NSString
    The host’s user ID before the change.
    currentUserId
    NSString
    The host's user ID after the change.

    Remote User Callbacks

    onRemoteUserEnter

    A remote user entered the room.
    - (void)onRemoteUserEnter:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID

    onRemoteUserLeave

    A remote user exited the room.
    - (void)onRemoteUserLeave:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID

    onRemoteUserCameraAvailable

    Whether a remote user enabled the camera.
    - (void)onRemoteUserCameraAvailable:(NSString *)userId
    available:(BOOL)available;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    available
    BOOL
    YES: Enabled; NO: Disabled.

    onRemoteUserScreenVideoAvailable

    A member enabled/disabled video sharing.
    - (void)onRemoteUserScreenVideoAvailable:(NSString *)userId
    available:(BOOL)available;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    available
    BOOL
    Whether screen sharing stream data is available.

    onRemoteUserAudioAvailable

    Whether a remote user is sending audio.
    - (void)onRemoteUserAudioAvailable:(NSString *)userId
    available:(BOOL)available;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    available
    BOOL
    Whether audio data is available.

    onRemoteUserEnterSpeechState

    A remote user started speaking.
    - (void)onRemoteUserEnterSpeechState:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID

    onRemoteUserExitSpeechState

    A remote user stopped speaking.
    - (void)onRemoteUserExitSpeechState:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID

    Chat Event Callbacks

    onReceiveChatMessage

    A text chat message was received.
    - (void)onReceiveChatMessage:(NSString *)userId message:(NSString *)message;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID.
    message
    NSString
    Text message

    Room Control Message Callbacks

    onReceiveSpeechInvitation

    A member received a speech invitation from the host.
    - (void)onReceiveSpeechInvitation:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    The host's user ID.

    onReceiveInvitationCancelled

    The speech invitation sent to a member was canceled by the host.
    - (void)onReceiveInvitationCancelled:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    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
    NSString
    User ID

    onSpeechApplicationCancelled

    A user canceled a speech request.
    - (void)onSpeechApplicationCancelled:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID

    onSpeechApplicationForbidden

    The host disabled requests to speak.
    - (void)onSpeechApplicationForbidden:(BOOL)isForbidden userId:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    isForbidden
    BOOL
    Whether to disable.
    userId
    NSString
    User ID

    onOrderedToExitSpeechState

    A member was asked to stop speaking.
    - (void)onOrderedToExitSpeechState:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    The host's user ID.

    onCallingRollStarted

    The host started a roll call.
    - (void)onCallingRollStarted:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    The host's user ID.

    onCallingRollStopped

    The host stopped a roll call.
    - (void)onCallingRollStopped:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    The host's user ID.

    onMemberReplyCallingRoll

    A member replied to the roll call.
    - (void)onMemberReplyCallingRoll:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    User ID

    onChatRoomMuted

    The host turned on/off chat.
    - (void)onChatRoomMuted:(BOOL)muted userId:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    muted
    BOOL
    Whether to disable.
    userId
    NSString
    The host's user ID.

    onMicrophoneMuted

    The host disabled mic use.
    - (void)onMicrophoneMuted:(BOOL)muted userId:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    muted
    BOOL
    Whether to disable.
    userId
    NSString
    The host's user ID.

    onCameraMuted

    The host disabled camera use.
    - (void)onCameraMuted:(BOOL)muted userId:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    muted
    BOOL
    Whether to disable.
    userId
    NSString
    The host's user ID.

    onReceiveKickedOff

    The host removed a member from the room.
    - (void)onReceiveKickedOff:(NSString *)userId;
    The parameters are described below:
    Parameter
    Type
    Description
    userId
    NSString
    Host/Admin's user ID.

    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:(TRTCQualityInfo *)localQuality remoteQuality:(NSArray<TRTCQualityInfo *> *)remoteQuality;
    
    The parameters are described below:
    Parameter
    Type
    Description
    localQuality
    TRTCQualityInfo
    Upstream network quality.
    remoteQuality
    NSArray<TRTCQualityInfo *>
    Downstream network quality.
    explain
    For more information, see TRTC SDK.

    Screen Sharing Event Callbacks

    onScreenCaptureStarted

    Screen sharing started.
    - (void)onScreenCaptureStarted;

    onScreenCaptureStopped

    Screen sharing stopped.
    - (void)onScreenCaptureStopped:(NSInteger)reason;
    The parameters are described below:
    Parameter
    Type
    Description
    reason
    NSInteger
    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