이 페이지는 현재 영어로만 제공되며 한국어 버전은 곧 제공될 예정입니다. 기다려 주셔서 감사드립니다.

LiveCoreView

API Overview

LiveCoreView is a fundamental control developed for our video live streaming UIKit. This core control provides rich APIs such as preview before broadcasting, start video live streaming, stop video live streaming, live streaming room connection with audience, and cross-room connection with other anchors.

API Overview

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
delegate
Set a view adapter for adding widgets to the broadcaster's video screen

API Details

LiveCoreView

Create an instance of the LiveCoreView object.
LiveCoreView()

startCamera

Start camera capture and display the captured video on the LiveCoreView view.
func startCamera(useFrontCamera: Bool, onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
Parameters
Type
Meaning
useFrontCamera
Bool
true: use front camera, false: use rear camera
onSuccess
TUISuccessBlock
The success callback
onError
TUIErrorBlock
The failure callback

startMicrophone

Enable the local microphone.
func startMicrophone(onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
Parameters
Type
Meaning
onSuccess
TUISuccessBlock
The success callback
onError
TUIErrorBlock
The failure callback

muteMicrophone

Pause publishing the local audio stream.
func muteMicrophone(mute: Bool)
Parameters:
Parameters
Type
Meaning
mute
Bool
true: Pause video stream publishing, false: Normal video stream publishing

stopCamera

Turns the local camera off.
func stopCamera()

stopMicrophone

Turn off the local microphone.
func stopMicrophone()

startLiveStream

Anchor creates a live streaming room and starts streaming.
func startLiveStream(roomInfo: TUIRoomInfo,
onSuccess: @escaping TUIRoomInfoBlock,
onError: @escaping TUIErrorBlock)
Parameters:
Parameters
Type
Meaning
roomInfo
TUIRoomInfo
Create live room information
onSuccess
TUIRoomInfoBlock
The success callback
onError
TUIErrorBlock
The failure callback

stopLiveStream

Anchor stops streaming and destroys the live room.
func stopLiveStream(onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
Parameters
Type
Meaning
onSuccess
TUISuccessBlock
The success callback
onError
TUIErrorBlock
The failure callback

joinLiveStream

Audience member joins an anchor's live streaming room.
func joinLiveStream(roomId: String,
onSuccess: @escaping TUIRoomInfoBlock,
onError: @escaping TUIErrorBlock)
Parameters:
Parameters
Type
Meaning
roomId
String
Live room ID
onSuccess
TUIRoomInfoBlock
The success callback
onError
TUIErrorBlock
The failure callback

leaveLiveStream

Audience member leaves an anchor's live streaming room.
func leaveLiveStream(onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
Parameters
Type
Meaning
onSuccess
TUISuccessBlock
The success callback
onError
TUIErrorBlock
The failure callback

requestIntraRoomConnection

Audience member requests to connect with the anchor.
func requestIntraRoomConnection(userId: String, timeOut: Int, openCamera: Bool,
onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
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

cancelIntraRoomConnection

Audience cancels the request to connect with the host.
func cancelIntraRoomConnection(userId: String,
onSuccess: @escaping TUISuccessBlock,
onError: @escaping TUIErrorBlock)
Parameters:
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

respondIntraRoomConnection

Anchor responds to the audience's request to connect.
func respondIntraRoomConnection(userId: String, isAccepted: Bool,
onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
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

disconnectUser

The anchor disconnects the audience.
func disconnectUser(userId: String, onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
Parameters
Type
Meaning
userId
String
The user ID that the anchor needs to disconnect.
onSuccess
TUISuccessBlock
The success callback
onError
TUIErrorBlock
The failure callback

terminateIntraRoomConnection

The audience stops the connection with the anchor.
func terminateIntraRoomConnection()

requestCrossRoomConnection

The anchor requests to connect with another room's anchor.
func requestCrossRoomConnection(roomId: String, timeOut: Int,
onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
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

cancelCrossRoomConnection

Anchor cancels the request to connect with another host in a different room.
func cancelCrossRoomConnection(roomId: String, onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
Parameters
Type
Meaning
roomId
String
Room ID for canceling the connection.
onSuccess
TUISuccessBlock
The success callback
onError
TUIErrorBlock
The failure callback

respondToCrossRoomConnection

Anchor responds to the connection request.
func respondToCrossRoomConnection(roomId: String, isAccepted: Bool,
onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock)
Parameters:
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

terminateCrossRoomConnection

The anchor disconnects the connection.
func terminateCrossRoomConnection()

registerConnectionObserver

Register a connection event callback.
func registerConnectionObserver(observer: ConnectionObserver)
Parameters:
Parameters
Type
Meaning
observer
Callback object for connection events.

unregisterConnectionObserver

Unregister a connection event callback.
func unregisterConnectionObserver(observer: ConnectionObserver)
Parameters:
Parameters
Type
Meaning
observer
Callback object for connection events.

setLayoutMode

Set the layout mode for the connected host's video.
func setLayoutMode(layoutMode: LayoutMode, layoutJson: String? = nil)
Parameters:
Parameters
Type
Meaning
layoutModel
Layout mode during connection, supporting grid layout, floating window layout, and custom layout.
layoutJson
String
JSON string for the layout. For specific settings, refer to Setting Custom Layout.

delegate

Set the view delegate for adding widgets to the connected host's video.
public weak var videoViewDelegate: VideoViewDelegate?
Parameters:
Parameters
Type
Meaning
viewAdapter
View Delegate for Adding Widgets to Live Stream Video


Type Definition

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.

ConnectionObserver

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.

LayoutMode

Layout mode during connection
Type
Description
gridLayout
Grid Layout.
floatLayout
Floating Window Layout.
freeLayout
Custom Layout.

VideoViewDelegate

Connection view delegate interface, which allows you to add widgets to each audio and video stream view by implementing this interface.
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.

Callback Event Details

onConnectedUsersUpdated

Callback for changes in the list of connected users.
func onConnectedUsersUpdated(userList: [TUIUserInfo], joinList: [TUIUserInfo], leaveList: [TUIUserInfo])
Parameters:
Parameter
Type
Description
userList
List of connected users
joinList
Newly connected users
leaveList
Users who have left the connection

onUserConnectionRequest

Callback for receiving a connection request.
func onUserConnectionRequest(inviterUser: TUIUserInfo)
Parameters:
Parameter
Type
Description
inviterUser
Information of the user applying for connection

onUserConnectionCancelled

Callback for receiving a request to cancel the connection.
func onUserConnectionCancelled(inviterUser: TUIUserInfo)
Parameters:
Parameter
Type
Description
inviterUser
Information of the user canceling the connection

onUserConnectionAccepted

Callback for connection request approval.
func onUserConnectionAccepted(userInfo: TUIUserInfo)
Parameters:
Parameter
Type
Description
userInfo
Information of users who agreed to the connection

onUserConnectionRejected

Callback for connection request rejection.
func onUserConnectionRejected(userInfo: TUIUserInfo)
Parameters:
Parameter
Type
Description
userInfo
Information of users who rejected the connection

onUserConnectionTimeout

Callback for connection request timeout.
func onUserConnectionTimeout(userInfo: TUIUserInfo)
Parameters:
Parameter
Type
Description
userInfo
Information of users whose connection request timed out

onUserConnectionTerminated

The callback for the anchor disconnecting the mic connect with this audience.
func onUserConnectionTerminated()

onUserConnectionExited

The callback for the user disconnecting from the seat.
func onUserConnectionExited(userInfo: TUIUserInfo)
Parameters:
Parameter
Type
Description
userInfo
Information of users disconnected from the seat

onConnectedRoomsUpdated

The callback for changes in the room list of connections.
func onConnectedRoomsUpdated(hostUserList: [TUIConnectionUser])
Parameters:
Parameter
Type
Description
hostUserList
List of room owners of the connected room

onCrossRoomConnectionRequest

The callback for receiving a cross-room connection request.
func onCrossRoomConnectionRequest(hostUser: TUIConnectionUser)
Parameters:
Parameter
Type
Description
hostUser
Information on the live streaming room owner requesting a connection

onCrossRoomConnectionCancelled

Callback for receiving a cancellation request for a cross-room connection.
func onCrossRoomConnectionCancelled(hostUser: TUIConnectionUser)
Parameters:
Parameter
Type
Description
hostUser
Cancel the information of the live streaming room owner requesting a connection

onCrossRoomConnectionAccepted

Callback for receiving an approval for a cross-room connection request.
func onCrossRoomConnectionAccepted(hostUser: TUIConnectionUser)
Parameters:
Parameter
Type
Description
hostUser
Information on the live streaming room owner agreeing to the connection

onCrossRoomConnectionRejected

Callback for receiving a rejection of a cross-room connection request.
func onCrossRoomConnectionRejected(hostUser: TUIConnectionUser)
Parameters:
Parameter
Type
Description
hostUser
Information on the live streaming room owner rejecting the connection

onCrossRoomConnectionTimeout

Callback for a timeout in receiving a room connection request.
func onCrossRoomConnectionTimeout(inviter: TUIConnectionUser, invitee: TUIConnectionUser)
Parameters:
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

onCrossRoomConnectionExited

Callback for changes in the connected users list.
func onCrossRoomConnectionExited(hostUser: TUIConnectionUser)
Parameters:
Parameter
Type
Description
hostUser
Information of the live streaming room exiting the connection

onRoomDismissed

Callback of live streaming room termination.
func onRoomDismissed(roomId: String)
Parameters:
Parameter
Type
Description
roomId
String
Room ID

createCoGuestView

Create a pendant view for audience connection, which will be added to the user's video stream.
func createCoGuestView(userInfo: TUIUserInfo) -> UIView?
Parameters:
Parameter
Type
Description
userInfo
User information of users connected to the microphone
Return value: UIView?

updateCoGuestView

Callback for updating the pendant view. In general, you don't need to concern yourself with this callback. You can update your set pendant view based on the state of your pendant data unless your pendant depends on changes in userInfo.
func updateCoGuestView(userInfo: TUIUserInfo, coGuestView: UIView)
Parameters:
Parameter
Type
Description
userInfo
User information of users connected to the microphone
coGuestView
UIView
The pendant view you created using the createCoGuestView API

createCoHostView

Create a pendant view for the host's connection, which will be added to the connected host's video stream.
func createCoHostView(connectionUser: TUIConnectionUser) -> UIView?
Parameters:
Parameter
Type
Description
connectionUser
User information of the connected host
Return value: UIView?

updateCoHostView

Callback for updating the pendant view. In general, you don't need to concern yourself with this callback. You can update your set pendant view based on the state of your pendant data unless your pendant depends on changes in connectionUser.
func updateCoHostView(connectionUser: TUIConnectionUser, coHostView: UIView)
Parameters:
Parameter
Type
Description
connectionUser
Information of the connected host
coHostView
UIView
The pendant view you created using the createCoHostView API