TRTCLiveRoom
is based on Tencent Real-Time Communication (TRTC) and Tencent Cloud Chat. With TRTCLiveRoom:TRTCLiveRoom
is an open-source class depending on two closed-source Tencent Cloud SDKs. For the specific implementation process, please see Interactive Live Video Streaming (iOS).AVChatRoom
feature of the Chat SDK is used to implement chat rooms, and Chat messages are used to facilitate the co-anchoring process.API | Description |
Sets event callbacks. | |
Logs in. | |
Logs out. | |
Sets the profile. |
API | Description |
Creates a room (called by anchor). If the room does not exist, the system will create the room automatically. | |
Terminates a room (called by anchor). | |
Enters a room (called by audience). | |
Exits a room (called by audience). | |
Gets room list details. | |
Gets the anchors and co-anchoring viewers in a room. This API works only if it is called after enterRoom() . | |
Gets the information of all audience members in a room. This API works only if it is called after enterRoom() . |
API | Description |
Enables preview of the local video. | |
Stops local video capturing and preview. | |
Starts live streaming (pushing streams). | |
Stops live streaming (pushing streams). | |
Plays a remote video. This API can be called in common playback and co-anchoring scenarios. | |
Stops rendering a remote video. |
API | Description |
Requests co-anchoring (called by audience). | |
Responds to a co-anchoring request (called by anchor). | |
Removes a user from co-anchoring (called by anchor). |
API | Description |
Sends a cross-room communication request (called by anchor). | |
Responds to a cross-room communication request (called by anchor). | |
Quits cross-room communication. |
API | Description |
Switches between the front and rear cameras. | |
Sets the mirror mode. | |
Mutes/Unmutes the local user. | |
Mutes/Unmutes a remote user. | |
Mutes/Unmutes all remote users. |
API | Description |
API | Description |
API | Description |
Broadcasts a text message in a room. This API is generally used for on-screen comments. | |
Sends a custom text message. |
API | Description |
Specifies whether to display debugging information on the UI. |
API | Description |
Callback for error. | |
Callback for warning. | |
Callback of log. |
API | Description |
The room was terminated. | |
The room information changed. |
API | Description |
There is a new anchor/co-anchoring viewer in the room. | |
An anchor/co-anchoring viewer quit co-anchoring. | |
An audience member entered the room. | |
An audience member left the room. |
API | Description |
A co-anchoring request was received. | |
A user was removed from co-anchoring. |
API | Description |
A cross-room communication request was received. | |
Cross-room communication ended. |
API | Description |
A text message was received. | |
A custom message was received. |
TRTCLiveRoomDelegate
to get the callbacks.@property(nonatomic, weak)id<TRTCLiveRoomDelegate> delegate;
delegate
is the delegate callback of TRTCLiveRoom
./// Log in to the component./// - Parameters:/// - sdkAppID: You can view `SDKAppID` in **[Application Management](https://console.tencentcloud.com/trtc/app)** > **Application Info** of the TRTC console./// - userID: ID of the current user, which is a string that can contain only letters (a-z and A-Z), digits (0-9), hyphens (-), and underscores (\\_)/// - userSig: Tencent Cloud's proprietary security signature. For how to calculate and use it, see [FAQs > UserSig](https://www.tencentcloud.com/document/product/647/35166)./// - config: global configuration information, which should be initialized during login and cannot be modified afterward. Use `isAttachedTUIKit` to specify whether to import TUIKit into your project./// - callback: Callback for login. The return code is `0` if login is successful./// - Note:/// - We recommend setting the validity period of `userSig` to 7 days to avoid cases where message sending/receiving and co-anchoring fail due to expired `userSig`.- (void)loginWithSdkAppID:(int)sdkAppIDuserID:(NSString *)userIDuserSig:(NSString *)userSigconfig:(TRTCLiveRoomConfig *)configcallback:(Callback _Nullable)callbackNS_SWIFT_NAME(login(sdkAppID:userID:userSig:config:callback:));
Parameter | Type | Description |
sdkAppId | Int | |
userID | String | The ID of the 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 how to calculate and use it, see FAQs > UserSig. |
config | TRTCLiveRoomConfig | Global configuration information, which needs to be initialized during login and cannot be modified afterward. useCDNFirst : specifies the way audience watch live streams. true means watching over CDNs, which is cost-efficient but has high latency. false means watching under the low latency mode, the cost of which is between that of CDN live streaming and co-anchoring, but the latency is lower than 1 second. CDNPlayDomain : specifies the domain name for CDN live streaming. It takes effect only if useCDNFirst is set to true . You can set it in Domain Management of the CSS console. |
callback | (_ code: Int, _ message: String?) -> Void | Callback for login. The code is 0 if login is successful. |
// Log out/// - Parameter callback: Callback for logout. The code is `0` if logout is successful.- (void)logout:(Callback _Nullable)callbackNS_SWIFT_NAME(logout(_:));
Parameter | Type | Description |
callback | (_ code: Int, _ message: String?) -> Void | Callback for logout. The code is 0 if logout is successful. |
/// Set user profiles. The information will be stored in Tencent Cloud Chat./// - Parameters:/// - name: username/// - avatarURL: profile picture URL/// - callback: Callback for setting user profiles. The code is `0` if the operation is successful.- (void)setSelfProfileWithName:(NSString *)nameavatarURL:(NSString * _Nullable)avatarURLcallback:(Callback _Nullable)callbackNS_SWIFT_NAME(setSelfProfile(name:avatarURL:callback:));
Parameter | Type | Description |
name | String | Username |
avatarURL | String | Profile picture URL |
callback | (_ code: Int, _ message: String?) -> Void | Callback for setting user profiles. The code is 0 if the operation is successful. |
/// Create a room (called by anchor). If the room does not exist, the system will create the room automatically./// The process of creating a room and starting live streaming as an anchor is as follows:/// 1. A user calls `startCameraPreview()` to enable camera preview and set beauty filters./// 2. The user calls `createRoom()` to create a room, the result of which is returned via a callback./// 3. The user calls `starPublish()` to push streams./// - Parameters:/// - roomID: The room ID. You need to assign and manage the IDs in a centralized manner. Multiple `roomID` values can be aggregated into a live room list. Currently, Tencent Cloud does not provide list management services. Please manage your own room lists./// - roomParam: room information, such as room name and cover information. If both the room list and room information are managed by yourself, you can ignore this parameter./// - callback: Callback for room entry. The code is `0` if room entry is successful./// - Note:/// - This API is called by an anchor to start live streaming. An anchor can create a room he or she created before.- (void)createRoomWithRoomID:(UInt32)roomIDroomParam:(TRTCCreateRoomParam *)roomParamcallback:(Callback _Nullable)callbackNS_SWIFT_NAME(createRoom(roomID:roomParam:callback:));
Parameter | Type | Description |
roomID | UInt32 | The room ID. You need to assign and manage the IDs in a centralized manner. Multiple roomId values can be aggregated into a live room list. Currently, Tencent Cloud does not provide list management services. Please manage your own room lists. |
roomParam | TRTCCreateRoomParam | Room information, such as room name and cover information. If both the room list and room information are managed by yourself, you can ignore this parameter. |
callback | (_ code: Int, _ message: String?) -> Void | Callback for room creation. The code is 0 if the operation is successful. |
startCameraPreview()
to enable camera preview and set beauty filters. createRoom()
to create a room, the result of which is returned via a callback.starPublish()
to push streams./// Terminate a room (called by anchor)/// After creating a room, an anchor can call this API to terminate it./// - parameter callback: callback for room termination. The code is `0` if the operation is successful./// - Note:/// - After creating a room, an anchor can call this API to terminate it- (void)destroyRoom:(Callback _Nullable)callbackNS_SWIFT_NAME(destroyRoom(callback:));
Parameter | Type | Description |
callback | (_ code: Int, _ message: String?) -> Void | Callback for room termination. The code is 0 if the operation is successful. |
/// Enter a room (called by audience)/// The process of entering a room and starting playback as an audience member is as follows:/// 1. A user gets the latest room list from your server. The list may contain the `roomID` and other information of multiple rooms./// 2. The user selects a room and calls `enterRoom()` to enter the room./// 3. If the room list managed by your server contains the `userID` of the anchor of each room, after entering the room, the user can call `startPlay(userID)` to play the anchor’s video./// If the room list contains `roomID` only, upon room entry, the user will receive the `onAnchorEnter(userID)` callback from `TRTCLiveRoomDelegate`./// The user can then call `startPlay(userID)`, passing in the `userID` obtained from the callback, to play the anchor’s video./// - Parameters:/// - roomID: The room ID./// - useCDNFirst: whether to play streams via CDNs whenever possible/// - cdnDomain: CDN domain name/// - callback: Callback for room entry. The code is `0` if room entry is successful./// - Note:/// - This API is called by a user to enter a room./// - An anchor cannot use this API to enter a room he or she created, but must use createRoom instead.- (void)enterRoomWithRoomID:(UInt32)roomIDuseCDNFirst:(BOOL)useCDNFirstcdnDomain:(NSString * _Nullable)cdnDomaincallback:(Callback)callbackNS_SWIFT_NAME(enterRoom(roomID:useCDNFirst:cdnDomain:callback:));
Parameter | Type | Description |
roomID | UInt32 | The room ID. |
callback | (_ code: Int, _ message: String?) -> Void | Callback for room entry. The code is 0 if the operation is successful. |
roomID
and other information of multiple rooms.enterRoom()
to enter the room.startPlay(userID)
, passing in the anchor’s userID
to start playback.userID
, the user can call startPlay(userID)
to start playback.userID
before room entry, he or she can find it in the onAnchorEnter(userID)
callback of TRTCLiveRoomDelegate
, which is returned after room entry, and can then call startPlay(userID)
to start playback./// Leave a room (called by audience)/// - Parameter callback: callback for room exit. The code is `0` if the operation is successful./// - Note:/// - This API is called by an audience member to leave a room./// - An anchor cannot use this API to leave a room.- (void)exitRoom:(Callback _Nullable)callbackNS_SWIFT_NAME(exitRoom(callback:));
Parameter | Type | Description |
callback | (_ code: Int, _ message: String?) -> Void | Callback for room exit. The code is 0 if the operation is successful. |
roomInfo
when they call createRoom()
./// Get room details/// The information is provided by anchors via the `roomInfo` parameter when they call `createRoom()`. You don’t need this API if both the room list and room information are managed by yourself./// - Parameter roomIDs: The list of room IDs./// - Parameter callback: Callback of room details.- (void)getRoomInfosWithRoomIDs:(NSArray<NSNumber *> *)roomIDscallback:(RoomInfoCallback _Nullable)callbackNS_SWIFT_NAME(getRoomInfos(roomIDs:callback:));
Parameter | Type | Description |
roomIDs | [UInt32] | List of room IDs |
callback | (_ code: Int, _ message: String?, _ roomList: [TRTCLiveRoomInfo]) -> Void | Callback of room details |
enterRoom()
./// Get the anchors and co-anchoring viewers in a room. This API takes effect only if it is called after `enterRoom()`./// - Parameter callback: Callback of user details.- (void)getAnchorList:(UserListCallback _Nullable)callbackNS_SWIFT_NAME(getAnchorList(callback:));
Parameter | Type | Description |
callback | (_ code: Int, _ message: String, _ userList: [TRTCLiveUserInfo]) -> Void | Callback of user details |
enterRoom()
./// Get the information of all audience members in a room. This API takes effect only if it is called after `enterRoom()`./// - Parameter callback: Callback of user details.- (void)getAudienceList:(UserListCallback _Nullable)callbackNS_SWIFT_NAME(getAudienceList(callback:));
Parameter | Type | Description |
callback | (_ code: Int, _ message: String, _ userList: [TRTCLiveUserInfo]) -> Void | Callback of user details |
/// Enable local video preview/// - Parameters:/// - frontCamera: `true`: Front camera; `false`: Rear camera/// - view: The control that loads video images./// - callback: Callback for the operation- (void)startCameraPreviewWithFrontCamera:(BOOL)frontCameraview:(UIView *)viewcallback:(Callback _Nullable)callbackNS_SWIFT_NAME(startCameraPreview(frontCamera:view:callback:));
Parameter | Type | Description |
frontCamera | Bool | true : Front camera; false : Rear camera |
view | UIView | The control that loads video images |
callback | (_ code: Int, _ message: String?) -> Void | Callback for the operation |
/// Stop local video capturing and preview- (void)stopCameraPreview;
/// Start live streaming (push streams). This API can be called in the following scenarios:/// 1. An anchor starts live streaming./// 2. An audience member starts co-anchoring./// - Parameters:/// - streamID: the `streamID` used to bind live streaming CDNs. You need to set it to the `streamID` of the anchor if you want the audience to receive the anchor’s stream via CDNs./// - callback: Callback for the operation- (void)startPublishWithStreamID:(NSString *)streamIDcallback:(Callback _Nullable)callbackNS_SWIFT_NAME(startPublish(streamID:callback:));
Parameter | Type | Description |
streamID | String | The streamID used to bind live streaming CDNs. You need to set it to the streamID of the anchor if you want the audience to receive the anchor’s stream via CDNs. |
callback | (_ code: Int, _ message: String?) -> Void | Callback for the operation |
/// Stop live streaming (pushing streams). This API can be called in the following scenarios:/// 1. An anchor ends live streaming./// 2. An audience member ends co-anchoring./// - Parameter callback: Callback for the operation.- (void)stopPublish:(Callback _Nullable)callbackNS_SWIFT_NAME(stopPublish(callback:));
Parameter | Type | Description |
callback | (_ code: Int, _ message: String?) -> Void | Callback for the operation |
/// Play a remote video. This API can be called in common playback and co-anchoring scenarios./// Common playback scenario/// 1. If the room list managed by your server contains the `userID` of the anchor of each room, after entering a room, a user can call `startPlay(userID)` to play the anchor’s video./// 2. If the room list contains `roomID` only, upon room entry, a user will receive the `onAnchorEnter(userID)` callback from `TRTCLiveRoomDelegate`./// The user can then call `startPlay(userID)`, passing in the `userID` obtained from the callback, to play the anchor’s video./// Co-anchoring scenario/// After co-anchoring starts, the anchor will receive the `onAnchorEnter(userID)` callback from `TRTCLiveRoomDelegate` and can call `startPlay(userID)`, passing in the `userID` obtained from the callback to play the co-anchoring user’s video./// - Parameters:/// - userID: The ID of the user whose video is to be played./// - view: The control that loads video images./// - callback: Callback for the operation- (void)startPlayWithUserID:(NSString *)userIDview:(UIView *)viewcallback:(Callback _Nullable)callbackNS_SWIFT_NAME(startPlay(userID:view:callback:));
Parameter | Type | Description |
userID | String | ID of the user whose video is to be played |
view | UIView | The control that loads video images |
callback | (_ code: Int, _ message: String?) -> Void | Callback for the operation |
userID
, after entering a room, a user can call startPlay(userID)
to play the anchor's video.userID
before room entry, he or she can find it in the onAnchorEnter(userID)
callback of TRTCLiveRoomDelegate
, which is returned after room entry, and can then call startPlay(userID)
to play the anchor’s video.onAnchorEnter(userID)
callback from TRTCLiveRoomDelegate
and can call startPlay(userID), passing in the
userID` obtained from the callback to play the co-anchoring user’s video.onAnchorExit()
callback is received./// Stop rendering a remote video/// - Parameters:/// - userID: The ID of the remote user./// - callback: Callback for the operation/// - Note:/// - Call this API after receiving the `onAnchorExit` callback.- (void)stopPlayWithUserID:(NSString *)userIDcallback:(Callback _Nullable)callbackNS_SWIFT_NAME(stopPlay(userID:callback:));
Parameter | Type | Description |
userID | String | ID of the remote user |
callback | (_ code: Int, _ message: String?) -> Void | Callback for the operation |
/// Send a co-anchoring request/// - Parameters:/// - reason: reason for co-anchoring/// - responseCallback: callback of the response/// - Note: After an audience member sends a co-anchoring request, the anchor will receive the `onRequestJoinAnchor` callback.- (void)requestJoinAnchor:(NSString *)reasontimeout:(double)timeoutresponseCallback:(ResponseCallback _Nullable)responseCallbackNS_SWIFT_NAME(requestJoinAnchor(reason:timeout:responseCallback:));
Parameter | Type | Description |
reason | String | Reason for co-anchoring |
timeout | long | Timeout period for the co-anchoring request |
responseCallback | (_ agreed: Bool, _ reason: String?) -> Void | Callback of the anchor’s response |
requestJoinAnchor()
to send a co-anchoring request to the anchor.onRequestJoinAnchor()
callback of TRTCLiveRoomDelegate
.responseJoinAnchor()
to accept or reject the co-anchoring request.responseCallback
callback, which carries the anchor’s response.startCameraPreview()
to enable local camera preview.startPublish()
to push streams.onAnchorEnter()
callback of TRTCLiveRoomDelegate
.startPlay()
to play the co-anchoring viewer’s video.onAnchorEnter()
callback and can call startPlay()
to play other co-anchoring viewers’ video.onRequestJoinAnchor()
callback of TRTCLiveRoomDelegate
./// Respond to a co-anchoring request/// - Parameters:/// - user: user ID of the viewer/// - agree: `true`: Accept; `false`: Reject/// - reason: reason for accepting/rejecting the request/// - Note: After the anchor responds to the request, the viewer will receive the `responseCallback` passed in to `requestJoinAnchor`.- (void)responseJoinAnchor:(NSString *)userIDagree:(BOOL)agreereason:(NSString *)reasonNS_SWIFT_NAME(responseJoinAnchor(userID:agree:reason:));
Parameter | Type | Description |
userID | String | The user ID of the audience member. |
agree | Bool | true : accept; false : reject |
reason | String? | Reason for accepting/rejecting the request |
onKickoutJoinAnchor()
callback of TRTCLiveRoomDelegate
./// Remove a user from co-anchoring/// - Parameters:/// - userID: ID of the user to remove from co-anchoring/// - callback: Callback for the operation/// - Note: After the anchor calls this API to remove a user from co-anchoring, the user will receive the `trtcLiveRoomOnKickoutJoinAnchor()` callback.- (void)kickoutJoinAnchor:(NSString *)userIDcallback:(Callback _Nullable)callbackNS_SWIFT_NAME(kickoutJoinAnchor(userID:callback:));
Parameter | Type | Description |
userID | String | The ID of the user to remove from co-anchoring. |
callback | (_ code: Int, _ message: String?) -> Void | Callback for the operation |
/// Request cross-room communication/// - Parameters:/// - roomID: room ID of the anchor to invite/// - userID: user ID of the anchor to invite/// - responseCallback: callback of the response/// - Note: After a cross-room communication request is sent, the invited anchor will receive the `onRequestRoomPK` callback.- (void)requestRoomPKWithRoomID:(UInt32)roomIDuserID:(NSString *)userIDresponseCallback:(ResponseCallback _Nullable)responseCallbackNS_SWIFT_NAME(requestRoomPK(roomID:userID:responseCallback:));
Parameter | Type | Description |
roomID | UInt32 | room ID of the anchor to invite |
userID | String | user ID of the anchor to invite |
responseCallback | (_ agreed: Bool, _ reason: String?) -> Void | Callback of the response |
requestRoomPK()
to send a cross-room communication to anchor B.onRequestRoomPK()
callback of TRTCLiveRoomDelegate
.responseRoomPK()
to respond to the cross-room communication request.onAnchorEnter()
callback of TRTCLiveRoomDelegate
and call startPlay()
to play anchor A's video.responseCallback
callback, which carries anchor B’s response.onAnchorEnter()
callback of TRTCLiveRoomDelegate
and calls startPlay()
to play anchor B’s video.responseCallback
passed in to requestRoomPK
./// Respond to a cross-room communication request/// Respond to a communication request from another anchor/// - Parameters:/// - user: user ID of the request sending anchor/// - agree: `true`: Accept; `false`: Reject/// - reason: reason for accepting/rejecting the request/// - Note: After the anchor responds to the request, the anchor sending the request will receive the `responseCallback` passed in to `requestRoomPK`.- (void)responseRoomPKWithUserID:(NSString *)userIDagree:(BOOL)agreereason:(NSString *)reasonNS_SWIFT_NAME(responseRoomPK(userID:agree:reason:));
Parameter | Type | Description |
userID | String | User ID of the request sending anchor |
agree | Bool | true : accept; false : reject |
reason | String? | Reason for accepting/rejecting the request |
trtcLiveRoomOnQuitRoomPK()
callback of TRTCLiveRoomDelegate
./// End cross-room communication/// - Parameter callback: Callback for ending cross-room communication// - Note: If either anchor ends cross-room communication, the other anchor will receive the `trtcLiveRoomOnQuitRoomPK` callback.- (void)quitRoomPK:(Callback _Nullable)callbackNS_SWIFT_NAME(quitRoomPK(callback:));
Parameter | Type | Description |
callback | (_ code: Int, _ message: String?) -> Void | Callback for the operation |
/// Switch between the front and rear cameras- (void)switchCamera;
/// Specify whether to mirror video/// - Parameter isMirror: Enable/Disable mirroring- (void)setMirror:(BOOL)isMirrorNS_SWIFT_NAME(setMirror(isMirror:));
Parameter | Type | Description |
isMirror | Bool | Enable/Disable mirroring |
/// Mute or unmute the local user/// - Parameter isMuted: `true`: Mute; `false`: Unmute- (void)muteLocalAudio:(BOOL)isMutedNS_SWIFT_NAME(muteLocalAudio(isMuted:));
Parameter | Type | Description |
isMuted | Bool | true : mute; false : unmute |
/// Mute or unmute a remote user/// - Parameters:/// - userID: ID of the remote user/// - isMuted: `true`: Mute; `false`: Unmute- (void)muteRemoteAudioWithUserID:(NSString *)userID isMuted:(BOOL)isMutedNS_SWIFT_NAME(muteRemoteAudio(userID:isMuted:));
Parameter | Type | Description |
userID | String | ID of the remote user |
isMuted | Bool | true : mute; false : unmute |
/// Mute or unmute all remote users/// - Parameter isMuted: `true`: Mute; `false`: Unmute- (void)muteAllRemoteAudio:(BOOL)isMutedNS_SWIFT_NAME(muteAllRemoteAudio(_:));
Parameter | Type | Description |
isMuted | Bool | true : mute; false : unmute |
/// Set audio quality. Valid values: `1` (low), `2` (average), `3` (high)/// - Parameter quality: audio quality- (void)setAudioQuality:(NSInteger)qualityNS_SWIFT_NAME(setAudioiQuality(quality:));
Parameter | Type | Description |
quality | NSInteger | 1 : speech; 2 : standard; 3 : music |
/// Get the audio effect management object- (TXAudioEffectManager *)getAudioEffectManager;
/* 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.*/- (TXBeautyManager *)getBeautyManager;
TXBeautyManager
:/// Send a text chat message that can be seen by all users in a room/// - Parameters:/// - message: text chat message/// - callback: Callback for message sending- (void)sendRoomTextMsg:(NSString *)message callback:(Callback _Nullable)callbackNS_SWIFT_NAME(sendRoomTextMsg(message:callback:));
Parameter | Type | Description |
message | String | Text message |
callback | (_ code: Int, _ message: String?) -> Void | Callback for message sending |
/// Send a custom message/// - Parameters:/// - command: custom command word used to distinguish between different message types/// - message: text message/// - callback: Callback for message sending- (void)sendRoomCustomMsgWithCommand:(NSString *)command message:(NSString *)message callback:(Callback _Nullable)callbackNS_SWIFT_NAME(sendRoomCustomMsg(command:message:callback:));
Parameter | Type | Description |
command | String | Custom command word used to distinguish between different message types |
message | String | Custom text message |
callback | (_ code: Int, _ message: String?) -> Void | Callback for message sending |
/// Specify whether to display debugging information on the UI/// - Parameter isShow: show/hide debugging information- (void)showVideoDebugLog:(BOOL)isShowNS_SWIFT_NAME(showVideoDebugLog(_:));
Parameter | Type | Description |
isShow | Bool | Show/Hide debugging information |
TRTCLiveRoomDelegate
Event Callback APIs- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonError:(NSInteger)codemessage:(NSString *)messageNS_SWIFT_NAME(trtcLiveRoom(_:onError:message:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
code | Int | Error code |
message | String? | Error message |
- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonWarning:(NSInteger)codemessage:(NSString *)messageNS_SWIFT_NAME(trtcLiveRoom(_:onWarning:message:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
code | Int | TRTCWarningCode |
message | String? | Warning message |
- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonDebugLog:(NSString *)logNS_SWIFT_NAME(trtcLiveRoom(_:onDebugLog:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
log | String | Log information |
- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonRoomDestroy:(NSString *)roomIDNS_SWIFT_NAME(trtcLiveRoom(_:onRoomDestroy:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
roomID | String | room ID |
- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonRoomInfoChange:(TRTCLiveRoomInfo *)infoNS_SWIFT_NAME(trtcLiveRoom(_:onRoomInfoChange:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
info | TRTCLiveRoomInfo | room information |
startPlay()
of TRTCLiveRoom
to play the video of the anchor/co-anchoring viewer.- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonAnchorEnter:(NSString *)userIDNS_SWIFT_NAME(trtcLiveRoom(_:onAnchorEnter:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
userID | String | User ID of the new anchor/co-anchoring viewer |
stopPlay()
of TRTCLiveRoom
to stop playing the video of the anchor/co-anchoring viewer.- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonAnchorExit:(NSString *)userIDNS_SWIFT_NAME(trtcLiveRoom(_:onAnchorExit:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
userID | String | User ID of the anchor/co-anchoring viewer |
- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonAudienceEnter:(TRTCLiveUserInfo *)userNS_SWIFT_NAME(trtcLiveRoom(_:onAudienceEnter:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
user | TRTCLiveUserInfo | Information of the user who entered the room |
- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonAudienceExit:(TRTCLiveUserInfo *)userNS_SWIFT_NAME(trtcLiveRoom(_:onAudienceExit:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
user | TRTCLiveUserInfo | Information of the user who left the room |
- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonRequestJoinAnchor:(TRTCLiveUserInfo *)userreason:(NSString * _Nullable)reasontimeout:(double)timeoutNS_SWIFT_NAME(trtcLiveRoom(_:onRequestJoinAnchor:reason:timeout:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
user | TRTCLiveUserInfo | Information of the user who requested co-anchoring |
reason | String? | Reason for co-anchoring |
timeout | Double | Timeout period for response from the anchor |
stopPublish()
of TRTCLiveRoom
to quit co-anchoring.- (void)trtcLiveRoomOnKickoutJoinAnchor:(TRTCLiveRoom *)liveRoomNS_SWIFT_NAME(trtcLiveRoomOnKickoutJoinAnchor(_:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
onAnchorEnter()
callback of TRTCLiveRoomDelegate
and call startPlay()
to play the other anchor’s video.- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonRequestRoomPK:(TRTCLiveUserInfo *)usertimeout:(double)timeoutNS_SWIFT_NAME(trtcLiveRoom(_:onRequestRoomPK:timeout:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
user | TRTCLiveUserInfo | Information of the anchor who requested communication. |
timeout | Double | Timeout period for response from the anchor |
- (void)trtcLiveRoomOnQuitRoomPK:(TRTCLiveRoom *)liveRoomNS_SWIFT_NAME(trtcLiveRoomOnQuitRoomPK(_:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonRecvRoomTextMsg:(NSString *)messagefromUser:(TRTCLiveUserInfo *)userNS_SWIFT_NAME(trtcLiveRoom(_:onRecvRoomTextMsg:fromUser:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
message | String | Text message |
user | TRTCLiveUserInfo | Information of the sender |
- (void)trtcLiveRoom:(TRTCLiveRoom *)trtcLiveRoomonRecvRoomCustomMsgWithCommand:(NSString *)commandmessage:(NSString *)messagefromUser:(TRTCLiveUserInfo *)userNS_SWIFT_NAME(trtcLiveRoom(_:onRecvRoomCustomMsg:message:fromUser:));
Parameter | Type | Description |
trtcLiveRoom | TRTCLiveRoomImpl | Current TRTCLiveRoom component instance |
command | String | Custom command word used to distinguish between different message types |
message | String | Text message |
user | TRTCLiveUserInfo | Information of the sender |
Was this page helpful?