API | Description |
Create SeatGridView object | |
Enable local microphone | |
Disable local microphone | |
Pause publishing local audio stream | |
Resume publishing local audio stream | |
Anchor creates live room and starts streaming | |
Anchor stops streaming and destroys live room | |
Audience joins an anchor's live room | |
Audience leaves an anchor's live room | |
Update Room Mic Mode | |
Anchor Responds to Microphone Application/Audience Responds to Microphone Invitation | |
Anchor Cancels Microphone Invitation/Audience Cancels Microphone Application | |
Connect Mic | |
Disconnect Mic | |
Disconnect Mic | |
Anchor Invites User to Connect Mic | |
Anchor Kicks User off Mic | |
Anchor Locks Mic Position (including position lock, audio status lock, and video status lock) | |
Anchor Sets Layout Mode for Mic List | |
Set the proxy for seat view | |
Set event callbacks | |
Remove event callbacks |
SeatGridView()
func startMicrophone(onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func stopMicrophone()
func muteMicrophone()
func unmuteMicrophone(onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func startVoiceRoom(roomInfo: TUIRoomInfo,onSuccess: @escaping SGOnRoomSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
roomInfo | TUIRoomInfo | Information for creating a live streaming room |
onSuccess | SGOnRoomSuccess | Success callback (with new live room information) |
onError | SGOnError | The failure callback |
func stopVoiceRoom(onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func joinVoiceRoom(roomId: String,onSuccess: @escaping SGOnRoomSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
roomId | String | Live Streaming Room ID |
onSuccess | SGOnRoomSuccess | Success callback (with live room information) |
onError | SGOnError | The failure callback |
func leaveVoiceRoom(onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func updateRoomSeatMode(seatMode: TUISeatMode,onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
seatMode | TUISeatMode | freeToTake: Free seat mode, audience can connect to seat freely without application; applyToTake: Apply seat mode, audience needs the anchor's approval to connect to seat. |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func responseRemoteRequest(userId: String,agree: Bool,onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
userId | String | Responding user's user ID, if the current role is an audience member, the ID can be left blank |
agree | Bool | Whether to accept the request, true: accept the request, false: reject the request |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func cancelRequest(userId: String,onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
userId | String | Cancelled user's ID, if the current role is an audience member, the ID can be left blank |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func takeSeat(index: Int,timeout: Int,onAccepted: @escaping SGOnRequestAccepted,onRejected: @escaping SGOnRequestRejected,onCancelled: @escaping SGOnRequestCancelled,onTimeout: @escaping SGOnRequestTimeout,onError: @escaping SGOnRequestError)
Parameter | Type | Meaning |
index | Int | Mic position number for connecting |
timeout | Int | Timeout period, unit: seconds. If set to 0, the SDK will not perform a timeout check or trigger a timeout callback |
onAccepted | SGOnRequestAccepted | Application for seat has been approved callback |
onRejected | SGOnRequestRejected | Application for seat has been rejected callback |
onCancelled | SGOnRequestCancelled | Application for seat has been canceled callback |
onTimeout | SGOnRequestTimeout | Application for seat has timed out callback |
onError | SGOnRequestError | Application for seat error callback |
func moveToSeat(index: Int,onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
index | Int | Mic position number to move to |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func leaveSeat(onSuccess: @escaping SGOnSuccess, onError: @escaping SGOnError)
Parameter | Type | Meaning |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func takeUserOnSeatByAdmin(index: Int,userId: String,onAccepted: @escaping SGOnRequestAccepted,onRejected: @escaping SGOnRequestRejected,onCancelled: @escaping SGOnRequestCancelled,onTimeout: @escaping SGOnRequestTimeout,onError: @escaping SGOnRequestError)
Parameter | Type | Meaning |
index | Int | Invited Mic position number |
userId | String | Invited user ID |
timeout | Int | Timeout period, unit: seconds. If set to 0, the SDK will not perform a timeout check or trigger a timeout callback |
onAccepted | SGOnRequestAccepted | Invite to speak request approved callback |
onRejected | SGOnRequestRejected | Invite to speak request rejected callback |
onCancelled | SGOnRequestCancelled | Invite to speak request canceled callback |
onTimeout | SGOnRequestTimeout | Invite to speak request timeout callback |
onError | SGOnRequestError | Invite to speak request error callback |
func kickUserOffSeatByAdmin(userId: String,onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
userId | String | User ID kicked off the Mic |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func lockSeat(index: Int,lockMode: TUISeatLockParams,onSuccess: @escaping SGOnSuccess,onError: @escaping SGOnError)
Parameter | Type | Meaning |
seatIndex | int | Mic position number to be locked |
params | TUISeatLockParams | Microphone Mute Parameters. See details: TUIRoomDefine.SeatLockParams |
onSuccess | SGOnSuccess | The success callback |
onError | SGOnError | The failure callback |
func setLayoutMode(layoutMode: SGLayoutMode,layoutConfig: SeatViewLayoutConfig? = nil)
Parameter | Type | Meaning |
layoutModel | Layout mode of the mic list, supports element layout, grid layout, vertical layout, and free layout. | |
layoutConfig | Layout configuration information, effective only in free layout mode. |
func setSeatViewDelegate(_ delegate: SGSeatViewDelegate)
Parameter | Type | Meaning |
delegate | Seat view delegate |
func addObserver(observer: SeatGridViewObserver)
Parameter | Type | Meaning |
observer | Callback object of core component |
func removeObserver(observer: SeatGridViewObserver)
Parameter | Type | Meaning |
observer | Callback object of core component |
Type | Description |
Layout modes of the seat list support element layout, grid layout, vertical layout, and custom layout | |
Alignment of seat layout | |
Request type (apply to speak and invite to take seat) | |
Microphone position layout configuration information | |
Seating Layout Row Configuration Information | |
Seat view delegate |
Type | Description |
focus | Element Layout |
grid | Grid Layout |
vertical | Vertical layout |
free | Customized Layout |
Type | Description |
start | Microphone position near the start |
end | Microphone position near the end |
center | Microphone position near the middle |
spaceBetween | No space before the first and after the last seats, evenly distribute the remaining space between other seats |
spaceAround | Distribute half of the space before the first and after the last seats, evenly distribute the remaining space between other seats |
spaceEvenly | Evenly distribute the remaining space between all seats |
Type | Description |
applyToTakeSeat | Apply to take seat |
inviteToTakeSeat | Invite to take seat |
Type | Description |
rowConfigs | |
rowSpacing | Seat row spacing |
Type | Description |
count | Number of seats displayed in this row |
seatSpacing | Horizontal spacing of each seat in this row (effective only when the alignment is START, END, or CENTER) |
seatSize | Size of the seat layout in this row |
alignment |
API | Description |
Callback when creating a single seat layout. | |
Callback when updating the seat view. | |
Callback when updating user volume. |
onAccepted: (_ userInfo: TUIUserInfo) -> Void
Parameter | Type | Description |
userInfo | TUIUserInfo | Response to the current request's user information |
onRejected: (_ userInfo: TUIUserInfo) -> Void
Parameter | Type | Description |
userInfo | TUIUserInfo | Response to the current request's user information |
onCancelled: (_ userInfo: TUIUserInfo) -> Void
Parameter | Type | Description |
userInfo | TUIUserInfo | User information for the canceled request |
onTimeout: (_ userInfo: TUIUserInfo) -> Void
Parameter | Type | Description |
userInfo | UserInfo | User information for the initiated request |
onError: (_ userInfo: TUIUserInfo, _ code: Int, _ message: String) -> Void
Parameter | Type | Description |
userInfo | TUIUserInfo | User information for the initiated request |
error | TUICommonDefine.Error | Error code |
message | String | Error message |
func seatGridView(_ view: SeatGridView, createSeatView seatInfo: TUISeatInfo) -> UIView?
Parameter | Type | Description |
seatGridView | SeatGridView | Core components of voice chat room |
seatInfo | SeatInfo | Seat information |
func seatGridView(_ view: SeatGridView, updateSeatView seatInfo: TUISeatInfo, seatView: UIView)
Parameter | Type | Description |
seatGridView | SeatGridView | Core components of voice chat room |
seatInfo | TUISeatInfo | Seat information |
seatView | UIView | Current updated seat view |
func seatGridView(_ view: SeatGridView, updateUserVolume volume: CGFloat, seatView: UIView)
Parameter | Type | Description |
seatGridView | SeatGridView | Core components of voice chat room |
volume | CGFloat | Mic position volume information |
seatView | UIView | Current seat layout view with volume changes |
Function List | Description |
Event of Room Termination Received | |
Event of Being Kicked Out of the Room Received | |
Event of Request for Speaking/Invitation to Speak Received | |
Event of Request for Speaking/Invitation to Speak Canceled | |
Event of User Kicked Off Seat Received | |
Event of User Audio Status Changed | |
Seat View Click Event |
func onRoomDismissed(roomId: String)
Parameter | Type | Description |
roomId | String | Room ID |
func onKickedOutOfRoom(roomId: String,reason: TUIKickedOutOfRoomReason,message: String)
Parameter | Type | Description |
roomId | String | Room ID |
reason | TUIKickedOutOfRoomReason | Reason for Being Kicked Out |
message | String | Description of Being Kicked Out |
func onSeatRequestReceived(type: SGRequestType,userInfo: TUIUserInfo)
Parameter | Type | Description |
type | Request type (Request for Speaking, Invitation to Speak) | |
userInfo | TUIUserInfo | Information of the user who sent the request |
func onSeatRequestCancelled(type: SGRequestType,userInfo: TUIUserInfo)
Parameter | Type | Description |
type | Request type (Request for Speaking, Invitation to Speak) | |
userInfo | TUIUserInfo | Information of the user who canceled the request |
func onKickedOffSeat(userInfo: TUIUserInfo)
Parameter | Type | Description |
userInfo | TUIUserInfo | Information of the host who kicked the user off the seat |
func onUserAudioStateChanged(userInfo: TUIUserInfo,hasAudio: Bool,reason: TUIChangeReason)
Parameter | Type | Description |
userInfo | TUIUserInfo | User Information |
hasAudio | Bool | Is there an audio stream |
reason | TUIChangeReason | Reason for audio stream change |
func onSeatViewClicked(seatView: UIView, seatInfo: TUISeatInfo)
Parameter | Type | Description |
seatView | View | Currently clicked seat view object |
seatInfo | TUISeatInfo | Seat information |
Was this page helpful?