logo
On this page

API

ZegoLiveStreamingManager

addLiveManagerDelegate

You can call this interface to listen to live events, such as coHost request events, PK events

function prototype:

Untitled
/// Add live event listener
/// - Parameter delegate: Observer
public func addLiveManagerDelegate(_ delegate: ZegoLiveStreamingManagerDelegate)
1
Copied!

getHostID

You can call this interface to get the host ID of the current room

function prototype:

Untitled
/// Get host ID
/// - Returns: host id
public func getHostID() -> String
1
Copied!

isHost

You can call this interface to determine if the user is host

function prototype:

Untitled
/// Is the user a host?
/// - Parameter userID: Unique identifier for the user
/// - Returns: The result 'true' indicates that the person is a host, while 'false' indicates that they are not.
public func isHost(_ userID: String) -> Bool
1
Copied!

isCurrentUserHost

You can call this interface to determine if you are a host

function prototype:

Untitled
/// Is the current user a host?
/// - Returns: The return result 'true' represents yes, while 'false' represents no.
public func isCurrentUserHost() -> Bool
1
Copied!

isCurrentUserCoHost

You can call this interface to determine if you are a coHost

function prototype:

Untitled
/// Is the current user a cohost?
/// - Returns: The return result 'true' represents yes, while 'false' represents no.
public func isCurrentUserCoHost() -> Bool
1
Copied!

stopPKBattle

You can call this interface to send a stop pk request

function prototype:

Untitled
/// Sending stop pk request
public func stopPKBattle()
1
Copied!

acceptIncomingPKBattleRequest

You can call this interface to accept the received invitation PK request

You can pass some data to the inviter using the customData parameter

function prototype:

Untitled
/// Accept PK invitation
/// - Parameters:
///   - requestID: Unique ID for PK request
///   - anotherHostLiveID: Sender's live ID
///   - anotherHostUser: Sender
///   - customData: Custom data
public func acceptIncomingPKBattleRequest(_ requestID: String, 
                                          anotherHostLiveID: String, 
                                          anotherHostUser: ZegoUIKitUser, 
                                          customData: String)
1
Copied!

acceptIncomingPKBattleRequest

You can call this interface to accept the received invitation PK request

function prototype:

Untitled
/// Accept PK invitation
/// - Parameters:
///   - requestID: Unique ID for PK request
///   - anotherHostLiveID: Sender's live ID
///   - anotherHostUser: Sender
public func acceptIncomingPKBattleRequest(_ requestID: String, 
                                          anotherHostLiveID: String, 
                                          anotherHostUser: ZegoUIKitUser)
1
Copied!

rejectPKBattleStartRequest

You can call this interface to reject a pk invitation

function prototype:

Untitled
/// Refuse PK invitation
/// - Parameter requestID: Unique ID for PK request
public func rejectPKBattleStartRequest(_ requestID: String)
1
Copied!

muteAnotherHostAudio

You can call this interface to block or accept the audio stream from the PK user.

function prototype:

Untitled
/// Whether to block audio from other host
/// - Parameters:
///   - mute: true represents blocking, while false represents receiving.
///   - callback: Callback of operation result
public func muteAnotherHostAudio(_ mute: Bool, callback: ZegoUIKitCallBack?)
1
Copied!

sendPKBattleRequest

You can call this interface to send a PK invitation.

function prototype:

Untitled
/// Send PK invitation
/// - Parameters:
///   - anotherHostUserID: Inviting user's ID
///   - timeout: Request timeout limit, Default value is 60 seconds
///   - customData: Custom data that needs to be passed.
///   - callback: Callback for request results
public func sendPKBattleRequest(anotherHostUserID: String,
                                timeout: UInt32 = 60,
                                customData: String,
                                callback: UserRequestCallback?)
1
Copied!

sendPKBattleRequest

You can call this interface to send a PK invitation.

function prototype:

Untitled
/// Send PK invitation
/// - Parameters:
///   - anotherHostUserID: Inviting user's ID
///   - timeout: Request timeout limit, Default value is 60 seconds
///   - callback: Callback for request results
public func sendPKBattleRequest(anotherHostUserID: String,
                                timeout: UInt32 = 60,
                                callback: UserRequestCallback?)
1
Copied!

cancelPKBattleRequest

You can call this interface to cancel the pk request you issued.

function prototype:

Untitled
public func cancelPKBattleRequest(customData: String?, callback: UserRequestCallback?)
1
Copied!

leaveRoom

You can call this interface to exit the live broadcast room.

function prototype:

Untitled
/// Leave the room
public func leaveRoom()
1
Copied!

ZegoUIKitPrebuiltLiveStreamingVC

init

You must call this interface to initialize the live page

You can set a liveID for the current live stream by using the liveID parameter

You can configure the display and functions of the live broadcast page through the config parameter, such as the on-off status of the camera, the layout mode, and the display of the bottom bar

function prototype:

Untitled
public init(_ appID: UInt32, 
            appSign: String, 
            userID: String, 
            userName: String, 
            liveID: String, 
            config: ZegoUIKitPrebuiltLiveStreamingConfig) 
1
Copied!

addButtonToBottomMenuBar

You can add custom buttons to the bottom bar by calling this interface

You can control the identity scene displayed by the button by setting the role parameter position: Button placement. By default, the button is added on the left side.

function prototype:

Untitled
 public func addButtonToBottomMenuBar(_ button: UIButton, role: ZegoLiveStreamingRole, position: ZegoBottomMenuBarPosition = .lef)
1
Copied!

setStartLiveButton

You can call this interface to customize the start Live button

function prototype:

Untitled
public func setStartLiveButton(_ button: ZegoStartLiveButton) 
1
Copied!

clearBottomMenuBarExtendButtons

You can call this interface to empty the button added by addButtonToBottomMenuBar

function prototype:

Untitled
public func clearBottomMenuBarExtendButtons(_ role: ZegoLiveStreamingRole)
1
Copied!

setBackgroundView

You can call this interface to customize the background view of the live page

function prototype:

Untitled
public func setBackgroundView(_ view: UIView)
1
Copied!

leaveRoom

You can use this interface to exit the live streaming.

Untitled
public func leaveRoom()
1
Copied!

sendBarrageMessage

You can use this interface to send a barrage message.

Untitled
public func sendBarrageMessage(roomID: String, message: String, callback: ((Int, String) -> Void)?) 
1
Copied!

Previous

Set Avatar For Users

Next

Event