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 an empty string is passed, it means the audience requests to connect with the host. If not empty, it means the host invites the user 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 mic connect. If an empty string is passed, it means the audience cancels the request to connect with the host. If not empty, it means the host cancels the invitation for the user with the corresponding userId to connect. |
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 an empty string is passed, it means the audience responds to the host's invitation to connect. |
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 |
Was this page helpful?