logo
On this page

Event

ZegoUIKitPrebuiltLiveStreamingVCDelegate

getForegroundView

  • function prototype:
func getForegroundView(_ userInfo: ZegoUIKitUser?) -> ZegoBaseAudioVideoForegroundView?
  • example:
extension ViewController: ZegoUIKitPrebuiltLiveStreamingVCDelegate {
  func getForegroundView(_ userInfo: ZegoUIKitUser?) -> ZegoBaseAudioVideoForegroundView? {
    let view = ZegoBaseAudioVideoForegroundView(frame: CGRect(x: 0, y: 0, width: 100, height: 100), userID: userInfo?.userID, delegate: nil)
    //...
    return view
  }
}

onLeaveLiveStreaming

  • function prototype:
func onLeaveLiveStreaming()
  • example:
extension ViewController: ZegoUIKitPrebuiltLiveStreamingVCDelegate {
  func onLeaveLiveStreaming() {
    print("is leave live streaming")
    //....
  }
}

onLiveStreamingEnded

  • function prototype:
func onLiveStreamingEnded()
  • example:
extension ViewController: ZegoUIKitPrebuiltLiveStreamingVCDelegate {
  func onLiveStreamingEnded() {
    print("live streaming is end")
    //....
  }
}

onStartLiveButtonPressed

  • function prototype:
func onStartLiveButtonPressed()
  • example:
extension ViewController: ZegoUIKitPrebuiltLiveStreamingVCDelegate {
  func onStartLiveButtonPressed() {
    print("start live button is click")
    //....
  }
}

getPKBattleTopView

  • function prototype:
func getPKBattleTopView(_ parentView: UIView, userList: [ZegoUIKitUser]) -> UIView?
  • example:
extension ViewController: ZegoUIKitPrebuiltLiveStreamingVCDelegate {
  func getPKBattleTopView(_ parentView: UIView, userList: [ZegoUIKitUser]) -> UIView? {
    let view = UIView()
    view.backgroundColor = UIColor.red
    return view
  }
}

getPKBattleForegroundView

  • function prototype:
func getPKBattleForegroundView(_ parentView: UIView, userInfo: ZegoUIKitUser) -> UIView?
  • example:
extension ViewController: ZegoUIKitPrebuiltLiveStreamingVCDelegate {
  func getPKBattleForegroundView(_ parentView: UIView, userInfo: ZegoUIKitUser) -> UIView? {
    let view = UIView()
    let button: MutePKUserButton = MutePKUserButton()
    button.frame = CGRect(x: 30, y: 30, width: 80, height: 40)
    view.addSubview(button)
    return view
  }
}

getPKBattleBottomView

  • function prototype:
func getPKBattleBottomView(_ parentView: UIView, userList: [ZegoUIKitUser]) -> UIView?
  • example:
extension ViewController: ZegoUIKitPrebuiltLiveStreamingVCDelegate {
  func getPKBattleBottomView(_ parentView: UIView, userList: [ZegoUIKitUser]) -> UIView? {
    let view = UIView()
    view.backgroundColor = UIColor.red
    return view
  }
}

onInRoomMessageClick

  • function prototype:
func onInRoomMessageClick(_ message: ZegoInRoomMessage)
  • example:
extension ViewController: ZegoUIKitPrebuiltLiveStreamingVCDelegate {
    func onInRoomMessageClick(_ message: ZegoInRoomMessage) {
       // ...
       // ZegoInRoomMessage has these property
       // public var message: String?
       // public var messageID: Int64 = 0
       // public var sendTime: UInt64 = 0
       // public var user: ZegoUIKitUser?
    }
}

onIMRecvBarrageMessage

  • function prototype:

    func onIMRecvBarrageMessage(_ roomID: String, messageList: [ZegoUIKitBarrageMessageInfo])
  • example:

    extension ViewController: ZegoUIKitPrebuiltLiveStreamingVCDelegate {
        func func onIMRecvBarrageMessage(_ roomID: String, messageList: [ZegoUIKitBarrageMessageInfo]) {
        // ...
        // ZegoInRoomMessage has the following properties:
        // public var message: String?
        // public var messageID: String?
        // public var sendTime: CUnsignedLongLong = 0
        // public var user: ZegoUIKitUser?
        }
    }

ZegoLiveStreamingManagerDelegate

onIncomingCohostRequest

  • function prototype:
func onIncomingCohostRequest(inviter: ZegoUIKitUser)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingCohostRequest(inviter: ZegoUIKitUser) {
     //...
  }
}

onIncomingInviteToCohostRequest

  • function prototype:
func onIncomingInviteToCohostRequest(inviter: ZegoUIKitUser, invitationID: String)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingInviteToCohostRequest(inviter: ZegoUIKitUser, invitationID: String) {
    //...
  }
}

onIncomingRemoveCohostRequest

  • function prototype:
func onIncomingRemoveCohostRequest(inviter: ZegoUIKitUser)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingRemoveCohostRequest(inviter: ZegoUIKitUser) {
    //...
  }
}

onIncomingAcceptCohostRequest

  • function prototype:
func onIncomingAcceptCohostRequest(invitee: ZegoUIKitUser, data: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingAcceptCohostRequest(invitee: ZegoUIKitUser, data: String?) {
    //...
  }
}

onIncomingCancelCohostRequest

  • function prototype:
func onIncomingCancelCohostRequest(inviter: ZegoUIKitUser, data: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingCancelCohostRequest(inviter: ZegoUIKitUser, data: String?) {
    //...
  }
}

onIncomingCancelCohostInvite

  • function prototype:
func onIncomingCancelCohostInvite(inviter: ZegoUIKitUser, data: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingCancelCohostInvite(inviter: ZegoUIKitUser, data: String?) {
    //...
  }
}

onIncomingRefuseCohostRequest

  • function prototype:
func onIncomingRefuseCohostRequest(invitee: ZegoUIKitUser, data: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingRefuseCohostRequest(invitee: ZegoUIKitUser, data: String?) {
    //...
  }
}

onIncomingRefuseCohostInvite

  • function prototype:
func onIncomingRefuseCohostInvite(invitee: ZegoUIKitUser, data: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingRefuseCohostInvite(invitee: ZegoUIKitUser, data: String?) {
    //...
  }
}

onIncomingCohostRequestTimeOut

  • function prototype:
func onIncomingCohostRequestTimeOut(inviter: ZegoUIKitUser, data: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingCohostRequestTimeOut(inviter: ZegoUIKitUser, data: String?) {
    //...
  }
}

onIncomingCohostInviteTimeOut

  • function prototype:
func onIncomingCohostInviteTimeOut(inviter: ZegoUIKitUser, data: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingCohostInviteTimeOut(inviter: ZegoUIKitUser, data: String?) {
    //...
  }
}

onIncomingCohostInviteResponseTimeOut

  • function prototype:
func onIncomingCohostInviteResponseTimeOut(invitees: [ZegoUIKitUser], data: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingCohostInviteResponseTimeOut(invitees: [ZegoUIKitUser], data: String?) {
    //...
  }
}

onIncomingCohostRequestResponseTimeOut

  • function prototype:
func onIncomingCohostInviteResponseTimeOut(invitees: [ZegoUIKitUser], data: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingCohostInviteResponseTimeOut(invitees: [ZegoUIKitUser], data: String?) {
    //...
  }
}

onIncomingPKRequestReceived

  • function prototype:
func onIncomingPKRequestReceived(requestID: String, 
                                 anotherHostUser: ZegoUIKitUser, 
                                 anotherHostLiveID: String, 
                                 customData: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingPKRequestReceived(requestID: String, 
                                   anotherHostUser: ZegoUIKitUser, 
                                   anotherHostLiveID: String, 
                                   customData: String?) {
    //...
  }
}

onIncomingResumePKRequestReceived

  • function prototype:
func onIncomingResumePKRequestReceived(requestID: String)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingResumePKRequestReceived(requestID: String) {
    //...
  }
}

onIncomingPKRequestCancelled

  • function prototype:
func onIncomingPKRequestCancelled(anotherHostLiveID: String, 
                                  anotherHostUser: ZegoUIKitUser, 
                                  customData: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingPKRequestCancelled(anotherHostLiveID: String, 
                                    anotherHostUser: ZegoUIKitUser, 
                                    customData: String?) {
    //...
  }
}

onOutgoingPKRequestAccepted

  • function prototype:
func onOutgoingPKRequestAccepted(anotherHostLiveID: String,
                                 anotherHostUser: ZegoUIKitUser, 
                                 customData: String?)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onOutgoingPKRequestAccepted(anotherHostLiveID: String, 
                                   anotherHostUser: ZegoUIKitUser, 
                                   customData: String?) {
    //...
  }
}

onOutgoingPKRequestRejected

  • function prototype:
func onOutgoingPKRequestRejected(reason: Int, anotherHostUser: ZegoUIKitUser)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onOutgoingPKRequestRejected(reason: Int, anotherHostUser: ZegoUIKitUser) {
    //...
  }
}

onIncomingPKRequestTimeout

  • function prototype:
func onIncomingPKRequestTimeout(requestID: String, anotherHostUser: ZegoUIKitUser)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onIncomingPKRequestTimeout(requestID: String, anotherHostUser: ZegoUIKitUser) {
    //...
  }
}

onOutgoingPKRequestTimeout

  • function prototype:
func onOutgoingPKRequestTimeout(requestID: String, anotherHost: ZegoUIKitUser)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onOutgoingPKRequestTimeout(requestID: String, anotherHost: ZegoUIKitUser) {
    //...
  }
}

onPKStarted

  • function prototype:
func onPKStarted(roomID: String, userID: String)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onPKStarted(roomID: String, userID: String) {
    //...
  }
}

onPKEnded

  • function prototype:
func onPKEnded()
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onPKEnded() {
    //...
  }
}

onPKViewAvaliable

  • function prototype:
func onPKViewAvaliable()
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onPKViewAvaliable() {
    //...
  }
}

onLocalHostCameraStatus

  • function prototype:
func onLocalHostCameraStatus(isOn: Bool)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onLocalHostCameraStatus(isOn: Bool) {
    //...
  }
}

onAnotherHostCameraStatus

  • function prototype:
func onAnotherHostCameraStatus(isOn: Bool)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onAnotherHostCameraStatus(isOn: Bool) {
    //...
  }
}

onAnotherHostIsReconnecting

  • function prototype:
func onAnotherHostIsReconnecting()
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onAnotherHostIsReconnecting() {
    //...
  }
}

onAnotherHostIsConnected

  • function prototype:
func onAnotherHostIsConnected()
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onAnotherHostIsConnected() {
    //...
  }
}

onHostIsReconnecting

  • function prototype:
func onHostIsReconnecting()
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onHostIsReconnecting() {
    //...
  }
}

onHostIsConnected

  • function prototype:
func onHostIsConnected()
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onHostIsConnected() {
    //...
  }
}

onMixerStreamTaskFail

  • function prototype:
func onMixerStreamTaskFail(errorCode: Int)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onMixerStreamTaskFail(errorCode: Int) {
    //...
  }
}

onStartPlayMixerStream

  • function prototype:
func onStartPlayMixerStream()
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onStartPlayMixerStream() {
    //...
  }
}

onStopPlayMixerStream

  • function prototype:
func onStopPlayMixerStream()
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onStopPlayMixerStream() {
    //...
  }
}

onOtherHostMuted

  • function prototype:
func onOtherHostMuted(userID: String, mute: Bool)
  • example:
extension ViewController: ZegoLiveStreamingManagerDelegate {
  func onOtherHostMuted(userID: String, mute: Bool) {
    //...
  }
}

Previous

API

Next

Config