TRTCChorusRoom
is based on Tencent Real-Time Communication (TRTC) and Instant Messaging (IM). Its features include:
TRTCChorusRoom
is an open-source class depending on two closed-source Tencent Cloud SDKs. For the specific implementation process, please see Duet (Android).
AVChatRoom
feature of the IM SDK is used to implement chat rooms. The attribute APIs of IM are used to store room information such as the seat list, and invitation signaling is used to send requests to speak or invite others to speak.TRTCChorusRoom
API OverviewAPI | Description |
---|---|
sharedInstance | Gets a singleton object. |
destroySharedInstance | Terminates a singleton object. |
setDelegate | Sets event callbacks. |
delegateQueue | Sets the thread where event callbacks are. |
login | Logs in. |
logout | Logs out. |
setSelfProfile | Sets the profile. |
API | Description |
---|---|
createRoom | Creates a room (called by room owner). If the room does not exist, the system will automatically create a room. |
destroyRoom | Terminates a room (called by room owner). |
enterRoom | Enters a room (called by listener). |
exitRoom | Exits a room (called by listener). |
getRoomInfoList | Gets room list details. |
getUserInfoList | Gets the user information of the specified userId . If the value is nil , the information of all users in the room is obtained. |
API | Description |
---|---|
startPlayMusic | Starts music playback. |
stopPlayMusic | Stops music playback. |
pausePlayMusic | Pauses music playback. |
resumePlayMusic | Resumes music playback. |
API | Description |
---|---|
enterSeat | Becomes a speaker (called by room owner or listener). |
leaveSeat | Becomes a listener (called by speaker). |
pickSeat | Places a user in a seat (called by room owner). |
kickSeat | Removes a speaker (called by room owner). |
closeSeat | Blocks/Unblocks a seat (called by room owner). |
API | Description |
---|---|
startMicrophone | Starts mic capturing. |
stopMicrophone | Stops mic capturing. |
setAudioQuality | Sets audio quality. |
muteLocalAudio | Mutes/Unmutes local audio. |
setSpeaker | Sets whether to use the speaker or receiver. |
setAudioCaptureVolume | Sets mic capturing volume. |
setAudioPlayoutVolume | Sets playback volume. |
setVoiceEarMonitorEnable | Enables/Disables in-ear monitoring. |
API | Description |
---|---|
getAudioEffectManager | Gets the background music and audio effect management object TXAudioEffectManager. |
API | Description |
---|---|
sendRoomTextMsg | Broadcasts a text message in a room. This API is generally used for on-screen comments. |
sendRoomCustomMsg | Sends a custom text message. |
API | Description |
---|---|
sendInvitation | Sends an invitation. |
acceptInvitation | Accepts an invitation. |
rejectInvitation | Declines an invitation. |
cancelInvitation | Cancels an invitation. |
API | Description |
---|---|
onError | Error |
onWarning | Warning |
onDebugLog | Log |
API | Description |
---|---|
onRoomDestroy | The room was terminated. |
onRoomInfoChange | The room information changed. |
onUserVolumeUpdate | User volume |
API | Description |
---|---|
onSeatListChange | All seat changes |
onAnchorEnterSeat | Someone became a speaker or was made a speaker by the room owner. |
onAnchorLeaveSeat | Someone became a listener or was moved to listeners by the room owner. |
onUserMicrophoneMute | Whether a user’s mic is muted |
onSeatClose | The room owner blocked a seat. |
API | Description |
---|---|
onAudienceEnter | A listener entered the room. |
onAudienceExit | A listener exited the room. |
API | Description |
---|---|
onRecvRoomTextMsg | A text message was received. |
onRecvRoomCustomMsg | A custom message was received. |
API | Description |
---|---|
onReceiveNewInvitation | A new invitation was received. |
onInviteeAccepted | The invitee accepted the invitation. |
onInviteeRejected | The invitee declined the invitation. |
onInvitationCancelled | The inviter canceled the invitation. |
API | Description |
---|---|
onMusicProgressUpdate | Music playback progress |
onMusicPrepareToPlay | Music playback is ready. |
onMusicCompletePlaying | Music playback was completed. |
onReceiveAnchorSendChorusMsg | The room owner sent a duet message. |
This API is used to get a TRTCChorus singleton object.
/**
* Get a `TRTCChorus` singleton object
*
* - returns: `TRTCChorus` instance
* - note: You can call {@link TRTCChorus#destroySharedInstance()} to terminate a singleton object.
*/
+ (instancetype)sharedInstance NS_SWIFT_NAME(shared());
This API is used to terminate a TRTCChorus singleton object.
Note:After the instance is terminated, the externally cached
TRTCChorus
instance can no longer be used. You need to call sharedInstance again to get a new instance.
/**
* Terminate a `TRTCChorus` singleton object
*
* - note: After the instance is terminated, the externally cached `TRTCChorus` instance can no longer be used. You need to call {@link TRTCChorus#sharedInstance()} again to get a new instance.
*/
+ (void)destroySharedInstance NS_SWIFT_NAME(destroyShared());
This API is used to set the event callbacks of TRTCChorus. You can use TRTCChorusDelegate
to get different status notifications of TRTCChorus.
/**
* Set the event callbacks of the component
*
* You can use `TRTCChorusDelegate` to get different status notifications of `TRTCChorus`.
*
* - parameter delegate Callback API
* - note: Event callbacks in `TRTCChorus` are sent to you in the main queue by default. If you need to specify a queue for event callbacks, please use {@link TRTCChorus#setDelegateQueue(queue)}.
*/
- (void)setDelegate:(id<TRTCChorusDelegate>)delegate NS_SWIFT_NAME(setDelegate(delegate:));
Note:
setDelegate
is the delegate callback ofTRTCChorus
.
This API is used to set the thread queue for event callbacks. The main thread (MainQueue) is used by default.
/**
* Set the queue for event callbacks
*
* - parameter queue. The status notifications of `TRTCChorus` will be sent to the queue you specify.
*/
- (void)setDelegateQueue:(dispatch_queue_t)queue NS_SWIFT_NAME(setDelegateQueue(queue:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
queue | dispatch_queue_t | The status notifications of TRTCChorus will be sent to the thread queue you specify. |
This API is used to log in.
- (void)login:(int)sdkAppID
userId:(NSString *)userId
userSig:(NSString *)userSig
callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(login(sdkAppID:userId:userSig:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
sdkAppId | int | You can view SDKAppID in Application Management > Application Info of the TRTC console. |
userId | String | 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 more information on how to get it, please see UserSig. |
callback | ActionCallback | Callback for login. The code is 0 if login succeeds. |
This API is used to log out.
- (void)logout:(ActionCallback _Nullable)callback NS_SWIFT_NAME(logout(callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
callback | ActionCallback | Callback for logout. The code is 0 if logout succeeds. |
This API is used to set the profile.
- (void)setSelfProfile:(NSString *)userName avatarURL:(NSString *)avatarURL callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(setSelfProfile(userName:avatarURL:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userName | String | Username |
avatarURL | String | Profile photo URL |
callback | ActionCallback | Callback for profile setting. The code is 0 if the operation succeeds. |
This API is used to create a room (called by room owner).
- (void)createRoom:(int)roomID roomParam:(RoomParam *)roomParam callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(createRoom(roomID:roomParam:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
roomId | int | Room ID. You need to assign and manage the IDs in a centralized manner. Multiple roomID values can be aggregated into a room list. Currently, Tencent Cloud does not provide management services for room lists. Please manage the list on your own. |
roomParam | TRTCCreateRoomParam | Room information, such as room name, seat list information, and cover information. To manage seats, you must enter the number of seats in the room. |
callback | ActionCallback | Callback for room creation. The code is 0 if the operation succeeds. |
The process of creating a room and becoming a speaker is as follows:
createRoom
to create a room, passing in room attributes (e.g., room ID, whether listeners need room owner’s consent to speak, number of seats).enterSeat
to become a speaker.onSeatListChanget
notification about the change of the seat list, and can update the change to the UI.onAnchorEnterSeat
notification that someone became a speaker, and mic capturing will be enabled automatically.This API is used to terminate a room (called by room owner).
- (void)destroyRoom:(ActionCallback _Nullable)callback NS_SWIFT_NAME(destroyRoom(callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
callback | ActionCallback | Callback for room termination. The code is 0 if the operation succeeds. |
This API is used to enter a room (called by listener).
- (void)enterRoom:(NSInteger)roomID callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(enterRoom(roomID:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
roomId | int | Room ID |
callback | ActionCallback | Callback for room entry. The code is 0 if the operation succeeds. |
The process of entering a room as a listener is as follows:
roomId
and room information of multiple rooms.enterRoom
with the room ID passed in to enter.onRoomInfoChange
notification about room attribute change from the component. The attributes can be recorded, and corresponding changes can be made to the UI, including room name, whether room owner’s consent is required for listeners to speak, etc.onSeatListChange
notification about the change of the seat list and can update the change to the UI.onAnchorEnterSeat
notification that someone became a speaker.This API is used to exit a room.
- (void)exitRoom:(ActionCallback _Nullable)callback NS_SWIFT_NAME(exitRoom(callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
callback | ActionCallback | Callback for room exit. The code is 0 if the operation succeeds. |
This API is used to get room list details. The room name and cover are set by the room owner via roomInfo
when calling createRoom()
.
Note:You don’t need this API if both the room list and room information are managed on your server.
- (void)getRoomInfoList:(NSArray<NSNumber *> *)roomIdList callback:(ChorusInfoCallback _Nullable)callback NS_SWIFT_NAME(getRoomInfoList(roomIdList:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
roomIdList | List<Integer> | Room ID list |
callback | RoomInfoCallback | Callback of room details |
This API is used to get the user information of a specified userId
.
- (void)getUserInfoList:(NSArray<NSString *> * _Nullable)userIDList callback:(ChorusUserListCallback _Nullable)callback NS_SWIFT_NAME(getUserInfoList(userIDList:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIdList | List<String> | IDs of the users to query. If this parameter is null , the information of all users in the room is queried. |
userlistcallback | UserListCallback | Callback of user details |
This API is used to play music (called after mic-on).
Note:
- After music playback starts, you will receive an
onMusicPrepareToPlay
notification.- During music playback, all members in the room will keep receiving an
onMusicProgressUpdate
notification.- After music playback stops, you will receive an
onMusicCompletePlaying
notification.
- (void)startPlayMusic:(int32_t)musicID url:(NSString *)url NS_SWIFT_NAME(startPlayMusic(musicID:url:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
musicID | int32_t | Music ID |
url | String | Absolute path of the music track |
After this API is called, the song being played will stop.
This API is used to stop music (called during music playback).
Note:After music playback stops, you will receive an
onMusicCompletePlaying
notification.
- (void)stopPlayMusic NS_SWIFT_NAME(stopPlayMusic());
This API is used to pause music (called during music playback).
Note:
- The
onMusicProgressUpdate
notification will be paused.- No
onMusicCompletePlaying
notification will be received.
- (void)pausePlayMusic NS_SWIFT_NAME(pausePlayMusic());
This API is used to resume music (called after pause).
Note:No
onMusicPrepareToPlay
notification will be received.
- (void)resumePlayMusic NS_SWIFT_NAME(resumePlayMusic());
This API is used to become a speaker (called by room owner or listener).
Note:After a user becomes a speaker, all members in the room will receive an
onSeatListChange
notification and anonAnchorEnterSeat
notification.
- (void)enterSeat:(NSInteger)seatIndex callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(enterSeat(seatIndex:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
seatIndex | int | The number of the seat to take |
callback | ActionCallback | Callback for the operation |
Calling this API will immediately modify the seat list. In cases where listeners need the room owner’s consent to speak, you can call sendInvitation
first to send a request and, after receiving onInvitationAccept
, call enterSeat
.
This API is used to become a listener (called by speaker).
Note:After a speaker becomes a listener, all members in the room will receive an
onSeatListChange
notification and anonAnchorLeaveSeat
notification.
- (void)leaveSeat:(ActionCallback _Nullable)callback NS_SWIFT_NAME(leaveSeat(callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
callback | ActionCallback | Callback for the operation |
This API is used to place a user in a seat (called by room owner).
Note:After the room owner places a user in a seat, all members in the room will receive an
onSeatListChange
notification and anonAnchorEnterSeat
notification.
- (void)pickSeat:(NSInteger)seatIndex userId:(NSString *)userId callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(pickSeat(seatIndex:userId:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
seatIndex | int | The number of the seat to place the listener in |
userId | String | User ID |
callback | ActionCallback | Callback for the operation |
Calling this API will immediately modify the seat list. In cases where the room owner needs listeners’ consent to make them speakers, you can call sendInvitation
first to send a request and, after receiving onInvitationAccept
, call pickSeat
.
This API is used to remove a speaker (called by room owner).
Note:After a speaker is removed, all members in the room will receive an
onSeatListChange
notification and anonAnchorLeaveSeat
notification.
- (void)kickSeat:(NSInteger)seatIndex callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(kickSeat(seatIndex:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
seatIndex | int | The number of the seat to remove the speaker from |
callback | ActionCallback | Callback for the operation |
Calling this API will immediately modify the seat list.
This API is used to mute/unmute a seat (called by room owner).
Note:After a seat is muted/unmuted, all members in the room will receive an
onSeatListChange
notification and anonSeatMute
notification.
- (void)muteSeat:(NSInteger)seatIndex isMute:(BOOL)isMute callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(muteSeat(seatIndex:isMute:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
seatIndex | int | The number of the seat to mute/unmute |
isMute | boolean | true : mute; false : unmute |
callback | ActionCallback | Callback for the operation |
Calling this API will immediately modify the seat list. The speaker on the seat specified by seatIndex
will call muteAudio
to mute/unmute his or her audio.
This API is used to block/unblock a seat (called by room owner).
Note:After a seat is blocked/unblocked, all members in the room will receive an
onSeatListChange
notification and anonSeatClose
notification.
- (void)closeSeat:(NSInteger)seatIndex isClose:(BOOL)isClose callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(closeSeat(seatIndex:isClose:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
seatIndex | int | The number of the seat to block/unblock |
isClose | boolean | true : block; false : unblock |
callback | ActionCallback | Callback for the operation |
Calling this API will immediately modify the seat list. The speaker on the seat specified by seatIndex
will leave the seat.
This API is used to start mic capturing.
- (void)startMicrophone;
This API is used to stop mic capturing.
- (void)stopMicrophone;
This API is used to set audio quality.
- (void)setAuidoQuality:(NSInteger)quality NS_SWIFT_NAME(setAuidoQuality(quality:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
quality | int | Audio quality. For more information, please see setAudioQuality(). |
This API is used to mute/unmute local audio.
- (void)muteLocalAudio:(BOOL)mute NS_SWIFT_NAME(muteLocalAudio(mute:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
mute | boolean | Whether to mute or unmute audio. For more information, please see muteLocalAudio(). |
This API is used to set whether to use the speaker or receiver.
- (void)setSpeaker:(BOOL)userSpeaker NS_SWIFT_NAME(setSpeaker(userSpeaker:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
useSpeaker | boolean | true : speaker; false : receiver |
This API is used to set the mic capturing volume.
- (void)setAudioCaptureVolume:(NSInteger)voluem NS_SWIFT_NAME(setAudioCaptureVolume(volume:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
volume | int | Capturing volume. Value range: 0-100 (default: 100) |
This API is used to set the playback volume.
- (void)setAudioPlayoutVolume:(NSInteger)volume NS_SWIFT_NAME(setAudioPlayoutVolume(volume:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
volume | int | Playback volume. Value range: 0-100 (default: 100) |
This API is used to mute/unmute a specified user.
- (void)muteRemoteAudio:(NSString *)userId mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteAudio(userId:mute:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userId | String | User ID |
mute | boolean | true : mute; false : unmute |
This API is used to mute/unmute all users.
- (void)muteAllRemoteAudio:(BOOL)isMute NS_SWIFT_NAME(muteAllRemoteAudio(isMute:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
mute | boolean | true : mute; false : unmute |
This API is used to enable/disable in-ear monitoring.
- (void)setVoiceEarMonitorEnable:(BOOL)enable NS_SWIFT_NAME(setVoiceEarMonitor(enable:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
enable | boolean | true : enable; false : disable |
This API is used to get the background music and audio effect management object TXAudioEffectManager.
- (TXAudioEffectManager * _Nullable)getAudioEffectManager;
This API is used to broadcast a text message in a room, which is generally used for on-screen comments.
- (void)sendRoomTextMsg:(NSString *)message callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(sendRoomTextMsg(message:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
message | String | Text message |
callback | ActionCallback | Callback for the operation |
This API is used to send a custom text message.
- (void)sendRoomCustomMsg:(NSString *)cmd message:(NSString *)message callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(sendRoomCustomMsg(cmd:message:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
cmd | String | Custom command word used to distinguish between different message types |
message | String | Text message |
callback | ActionCallback | Callback for the operation |
This API is used to send an invitation.
- (NSString *)sendInvitation:(NSString *)cmd
userId:(NSString *)userId
content:(NSString *)content
callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(sendInvitation(cmd:userId:content:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
cmd | String | Custom command of business |
userId | String | Invitee’s user ID |
content | String | Invitation content |
callback | ActionCallback | Callback for the operation |
Response parameters:
Returned Value | Type | Description |
---|---|---|
inviteId | String | Invitation ID |
This API is used to accept an invitation.
- (void)acceptInvitation:(NSString *)identifier callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(acceptInvitation(identifier:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
id | String | Invitation ID |
callback | ActionCallback | Callback for the operation |
This API is used to decline an invitation.
- (void)rejectInvitation:(NSString *)identifier callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(rejectInvitation(identifier:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
id | String | Invitation ID |
callback | ActionCallback | Callback for the operation |
This API is used to cancel an invitation.
- (void)cancelInvitation:(NSString *)identifier callback:(ActionCallback _Nullable)callback NS_SWIFT_NAME(cancelInvitation(identifier:callback:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
id | String | Invitation ID |
callback | ActionCallback | Callback for the operation |
TRTCChorusDelegate
Event Callback APIsCallback for error.
Note:This callback indicates that the SDK encountered an unrecoverable error. Such errors must be listened for, and UI reminders should be sent to users if necessary.
- (void)onError:(int)code
message:(NSString*)message
NS_SWIFT_NAME(onError(code:message:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
code | int | Error code |
message | String | Error message |
Callback for warning.
- (void)onWarning:(int)code
message:(NSString *)message
NS_SWIFT_NAME(onWarning(code:message:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
code | int | Error code |
message | String | Warning message |
Callback for log.
- (void)onDebugLog:(NSString *)message
NS_SWIFT_NAME(onDebugLog(message:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
message | String | Log information |
Callback for room termination. When the owner terminates the room, all users in the room will receive this callback.
- (void)onRoomDestroy:(NSString *)message
NS_SWIFT_NAME(onRoomDestroy(message:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
roomId | String | Room ID |
Callback for change of room information. This callback is sent after successful room entry. The information in roomInfo
is passed in by the room owner during room creation.
- (void)onRoomInfoChange:(ChorusInfo *)roomInfo
NS_SWIFT_NAME(onRoomInfoChange(roomInfo:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
roomInfo | RoomInfo | Room information |
Callback of the volume of each member in the room after the volume reminder is enabled.
- (void)onUserVolumeUpdate:(NSArray<TRTCVolumeInfo *> *)userVolumes totalVolume:(NSInteger)totalVolume
NS_SWIFT_NAME(onUserVolumeUpdate(userVolumes:totalVolume:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userVolumes | List | List of user volumes |
totalVolume | int | Total volume. Value range: 0-100 |
Callback for all seat changes.
- (void)onSeatInfoChange:(NSArray<ChorusSeatInfo *> *)seatInfolist
NS_SWIFT_NAME(onSeatListChange(seatInfoList:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
seatInfoList | List<SeatInfo> | Full seat list |
Someone became a speaker or was made a speaker by the owner.
- (void)onAnchorEnterSeat:(NSInteger)index
user:(ChorusUserInfo *)user
NS_SWIFT_NAME(onAnchorEnterSeat(index:user:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
index | int | The seat taken |
user | UserInfo | Details of the user who took the seat |
A speaker became a listener or was moved to listeners by the room owner.
- (void)onAnchorLeaveSeat:(NSInteger)index
user:(ChorusUserInfo *)user
NS_SWIFT_NAME(onAnchorLeaveSeat(index:user:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
index | int | The seat previously occupied by the speaker |
user | UserInfo | Details of the user who took the seat |
The room owner muted/unmuted a seat.
- (void)onSeatMute:(NSInteger)index
isMute:(BOOL)isMute
NS_SWIFT_NAME(onSeatMute(index:isMute:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
index | int | The seat muted/unmuted |
isMute | boolean | true : muted; false : unmuted |
The room owner blocked/unblocked a seat.
- (void)onSeatClose:(NSInteger)index
isClose:(BOOL)isClose
NS_SWIFT_NAME(onSeatClose(index:isClose:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
index | int | The seat blocked/unblocked |
isClose | boolean | true : blocked; false : unblocked |
A listener entered the room.
- (void)onAudienceEnter:(ChorusUserInfo *)userInfo
NS_SWIFT_NAME(onAudienceEnter(userInfo:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userInfo | UserInfo | Information of the listener who entered the room |
A listener exited the room.
- (void)onAudienceExit:(ChorusUserInfo *)userInfo
NS_SWIFT_NAME(onAudienceExit(userInfo:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userInfo | UserInfo | Information of the listener who exited the room |
A text message was received.
- (void)onRecvRoomTextMsg:(NSString *)message
userInfo:(ChorusUserInfo *)userInfo
NS_SWIFT_NAME(onRecvRoomTextMsg(message:userInfo:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
message | String | Text message |
userInfo | UserInfo | Information of the sender |
A custom message was received.
- (void)onRecvRoomCustomMsg:(NSString *)cmd
message:(NSString *)message
userInfo:(ChorusUserInfo *)userInfo
NS_SWIFT_NAME(onRecvRoomCustomMsg(cmd:message:userInfo:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
command | String | Custom command word used to distinguish between different message types |
message | String | Text message |
userInfo | UserInfo | Information of the sender |
An invitation was received.
- (void)onReceiveNewInvitation:(NSString *)identifier
inviter:(NSString *)inviter
cmd:(NSString *)cmd
content:(NSString *)content
NS_SWIFT_NAME(onReceiveNewInvitation(identifier:inviter:cmd:content:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
id | String | Invitation ID |
inviter | String | Inviter’s user ID |
cmd | String | Custom command word specified by business |
content | UserInfo | Content specified by business |
The invitee accepted the invitation
- (void)onInviteeAccepted:(NSString *)identifier
invitee:(NSString *)invitee
NS_SWIFT_NAME(onInviteeAccepted(identifier:invitee:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
id | String | Invitation ID |
invitee | String | Invitee’s user ID |
The invitee declined the invitation
- (void)onInviteeRejected:(NSString *)identifier
invitee:(NSString *)invitee
NS_SWIFT_NAME(onInviteeRejected(identifier:invitee:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
id | String | Invitation ID |
invitee | String | Invitee’s user ID |
The inviter canceled the invitation.
- (void)onInvitationCancelled:(NSString *)identifier
invitee:(NSString *)invitee NS_SWIFT_NAME(onInvitationCancelled(identifier:invitee:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
id | String | Invitation ID |
inviter | String | Inviter’s user ID |
Music playback is ready.
- (void)onMusicPrepareToPlay:(int32_t)musicID
NS_SWIFT_NAME(onMusicPrepareToPlay(musicID:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
musicID | int32_t | musicID passed in for playback |
Music playback progress.
- (void)onMusicProgressUpdate:(int32_t)musicID
progress:(NSInteger)progress total:(NSInteger)total
NS_SWIFT_NAME(onMusicProgressUpdate(musicID:progress:total:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
musicID | int32_t | musicID passed in for playback |
progress | NSInteger | Current playback progress in ms |
total | NSInteger | Total duration in ms |
Music playback was completed.
- (void)onMusicCompletePlaying:(int32_t)musicID
NS_SWIFT_NAME(onMusicCompletePlaying(musicID:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
musicID | int32_t | musicID passed in for playback |
The room owner sent a duet message.
- (void)onReceiveAnchorSendChorusMsg:(NSString *)musicId startDelay:(NSInteger)startDelay
NS_SWIFT_NAME(onReceiveAnchorSendChorusMsg(musicId:startDelay:));
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
musicId | NSString | musicID of the song to sing |
startDelay | NSInteger | Time (s) to wait before the song is played |
Was this page helpful?