API | Description |
Create LiveCoreView object. | |
Start camera capture and display the captured video on LiveCoreView. | |
Turn on the local microphone | |
Pause publishing local audio stream | |
Turns the local camera off | |
Turn off the local microphone | |
Anchor creates a live streaming room and starts streaming | |
Anchor stops streaming and destroys the live room | |
Audience member joins an anchor's live streaming room | |
Audience member leaves an anchor's live streaming room | |
Audience member requests to connect with the anchor | |
Audience member cancels the request to connect with the anchor | |
Anchor responds to the audience member's request for connection | |
Anchor disconnects the connected audience member | |
Audience member stops the connection with the anchor themselves | |
Anchor requests to connect with another anchor in a different live room | |
Anchor cancels the request to connect with another anchor in a different live room | |
Anchor responds to the connection request | |
Anchor disconnects the connection | |
Register a connection event callback | |
Unregister a connection event callback | |
Set the layout mode of the connected broadcaster's video screen | |
Set a view adapter for adding widgets to the broadcaster's video screen |
LiveCoreView()
func startCamera(useFrontCamera: Bool, onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
useFrontCamera | Bool | true: use front camera, false: use rear camera |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func startMicrophone(onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func muteMicrophone(mute: Bool)
Parameters | Type | Meaning |
mute | Bool | true: Pause video stream publishing, false: Normal video stream publishing |
func stopCamera()
func stopMicrophone()
func startLiveStream(roomInfo: TUIRoomInfo,onSuccess: @escaping TUIRoomInfoBlock,onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
roomInfo | TUIRoomInfo | Create live room information |
onSuccess | TUIRoomInfoBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func stopLiveStream(onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func joinLiveStream(roomId: String,onSuccess: @escaping TUIRoomInfoBlock,onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
roomId | String | Live room ID |
onSuccess | TUIRoomInfoBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func leaveLiveStream(onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func requestIntraRoomConnection(userId: String, timeOut: Int, openCamera: Bool,onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
userId | String | User ID, if the anchor ID is passed in, it means the audience is requesting to connect with the anchor (if an empty string is passed in, it means the anchor UserID by default). If it is another user's UserID, it means the anchor is inviting the audience with the corresponding userId to connect. |
timeout | int | Request timeout duration, unit: seconds. |
openCamera | Bool | Whether to turn on the camera after a successful mic connection. true: video connect, false: voice connect. |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func cancelIntraRoomConnection(userId: String,onSuccess: @escaping TUISuccessBlock,onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
userId | String | User ID to cancel the connection, if the anchor ID is passed in, it means the audience is canceling the request to connect with the anchor (if an empty string is passed in, it means the anchor UserID by default). If it is another user's UserID, it means the anchor is canceling the invitation to connect with the corresponding userId. |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func respondIntraRoomConnection(userId: String, isAccepted: Bool,onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
userId | String | Audience user ID to respond to the host's invitation to connect. If the anchor's User ID is passed in, it means the audience is responding to the anchor's invitation to connect (if an empty string is passed in, it means the anchor UserID by default). |
isAccepted | isAccepted | Whether to accept the mic connect request. true: accept the mic connect request, false: reject the mic connect request. |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func disconnectUser(userId: String, onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
userId | String | The user ID that the anchor needs to disconnect. |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func terminateIntraRoomConnection()
func requestCrossRoomConnection(roomId: String, timeOut: Int,onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
roomId | String | The Room ID for cross-room connection request. |
timeout | int | Request timeout duration, unit: seconds. |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func cancelCrossRoomConnection(roomId: String, onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
roomId | String | Room ID for canceling the connection. |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func respondToCrossRoomConnection(roomId: String, isAccepted: Bool,onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters | Type | Meaning |
roomId | String | Room ID for responding to the connection request. |
isAccepted | boolean | Whether to accept the connection. true: accept the connection, false: reject the connection. |
onSuccess | TUISuccessBlock | The success callback |
onError | TUIErrorBlock | The failure callback |
func terminateCrossRoomConnection()
func registerConnectionObserver(observer: ConnectionObserver)
Parameters | Type | Meaning |
observer | Callback object for connection events. |
func unregisterConnectionObserver(observer: ConnectionObserver)
Parameters | Type | Meaning |
observer | Callback object for connection events. |
func setLayoutMode(layoutMode: LayoutMode, layoutJson: String? = nil)
Parameters | Type | Meaning |
layoutModel | Layout mode during connection, supporting grid layout, floating window layout, and custom layout. | |
layoutJson | String |
public weak var videoViewDelegate: VideoViewDelegate?
Parameters | Type | Meaning |
viewAdapter | View Delegate for Adding Widgets to Live Stream Video |
Type | Description |
Set callback events for core control connections. | |
Layout mode during connection, supporting grid layout, floating window layout, and custom layout. | |
Connection view adapter interface, which allows you to add widgets to each audio and video stream view by implementing this interface. |
Type | Description |
Callback for changes in the list of connected users. | |
Callback for receiving a connection request. | |
Callback for receiving a request to cancel the connection. | |
Callback for connection request approval. | |
Callback for connection request rejection. | |
Callback for connection request timeout. | |
Callback for the host disconnecting the connection with this viewer. | |
Callback for the viewer actively disconnecting. | |
Callback for changes in the cross-room connection room list. | |
Callback for receiving a cross-room connection request. | |
Callback for receiving a request to cancel the cross-room connection. | |
Received callback for consent to cross-room connection | |
Received callback for cross-room connection rejection | |
Received callback for cross-room connection timeout. | |
Received callback for cross-room disconnection. | |
Received callback for room termination. |
Type | Description |
gridLayout | Grid Layout. |
floatLayout | Floating Window Layout. |
freeLayout | Custom Layout. |
API | Description |
Callback when creating a connected audience view. The View created through this API will be displayed on the connected audience's view. | |
Callback when updating the connected audience view. | |
Callback when creating a connected host view, the View created through this API will be displayed on the connected host's view. | |
Callback when updating the connected host view. |
func onConnectedUsersUpdated(userList: [TUIUserInfo], joinList: [TUIUserInfo], leaveList: [TUIUserInfo])
Parameter | Type | Description |
userList | List of connected users | |
joinList | Newly connected users | |
leaveList | Users who have left the connection |
func onUserConnectionRequest(inviterUser: TUIUserInfo)
Parameter | Type | Description |
inviterUser | Information of the user applying for connection |
func onUserConnectionCancelled(inviterUser: TUIUserInfo)
Parameter | Type | Description |
inviterUser | Information of the user canceling the connection |
func onUserConnectionAccepted(userInfo: TUIUserInfo)
Parameter | Type | Description |
userInfo | Information of users who agreed to the connection |
func onUserConnectionRejected(userInfo: TUIUserInfo)
Parameter | Type | Description |
userInfo | Information of users who rejected the connection |
func onUserConnectionTimeout(userInfo: TUIUserInfo)
Parameter | Type | Description |
userInfo | Information of users whose connection request timed out |
func onUserConnectionTerminated()
func onUserConnectionExited(userInfo: TUIUserInfo)
Parameter | Type | Description |
userInfo | Information of users disconnected from the seat |
func onConnectedRoomsUpdated(hostUserList: [TUIConnectionUser])
Parameter | Type | Description |
hostUserList | List of room owners of the connected room |
func onCrossRoomConnectionRequest(hostUser: TUIConnectionUser)
Parameter | Type | Description |
hostUser | Information on the live streaming room owner requesting a connection |
func onCrossRoomConnectionCancelled(hostUser: TUIConnectionUser)
Parameter | Type | Description |
hostUser | Cancel the information of the live streaming room owner requesting a connection |
func onCrossRoomConnectionAccepted(hostUser: TUIConnectionUser)
Parameter | Type | Description |
hostUser | Information on the live streaming room owner agreeing to the connection |
func onCrossRoomConnectionRejected(hostUser: TUIConnectionUser)
Parameter | Type | Description |
hostUser | Information on the live streaming room owner rejecting the connection |
func onCrossRoomConnectionTimeout(inviter: TUIConnectionUser, invitee: TUIConnectionUser)
Parameter | Type | Description |
inviter | Information on the live streaming room owner requesting a connection | |
invitee | Information on the live streaming room owner being invited to connect |
func onCrossRoomConnectionExited(hostUser: TUIConnectionUser)
Parameter | Type | Description |
hostUser | Information of the live streaming room exiting the connection |
func onRoomDismissed(roomId: String)
Parameter | Type | Description |
roomId | String | Room ID |
func createCoGuestView(userInfo: TUIUserInfo) -> UIView?
Parameter | Type | Description |
userInfo | User information of users connected to the microphone |
func updateCoGuestView(userInfo: TUIUserInfo, coGuestView: UIView)
Parameter | Type | Description |
userInfo | User information of users connected to the microphone | |
coGuestView | UIView |
func createCoHostView(connectionUser: TUIConnectionUser) -> UIView?
Parameter | Type | Description |
connectionUser | User information of the connected host |
func updateCoHostView(connectionUser: TUIConnectionUser, coHostView: UIView)
Parameter | Type | Description |
connectionUser | Information of the connected host | |
coHostView | UIView |
Was this page helpful?