tencent cloud

Feedback

Last updated: 2024-12-05 17:37:35

    Description of the Feature

    Seat Management is a real-time interaction and communication method where anchors can interact with the audience on the seat in real-time. Whether it's answering questions, sharing experiences, or entertainment interactions, it greatly enhances the audience's sense of participation and satisfaction. This direct interaction and communication provide more convenient and efficient channels for commercial operations. Using this feature, you can achieve applying to join the seat, inviting to speak, moving seat positions, kicking someone off the seat, and locking seats, greatly enriching the playability of the voice chat room.
    Seat List
    Audience applies to take seat
    Anchor Handling Seat Request
    
    
    
    
    
    
    
    
    

    Apply To take seat Process

    Audience applies to take seat process

    The TUILiveKit audience application for taking seat feature is mainly implemented through SeatGridView. You can call the following API Function to achieve the audience application for taking seat feature. The implementation is as follows, with Audience B applying for a seat as an example.

    Audience sends a request to join the seat

    Audience B sends a request to join the seat to Anchor A. Anchor A will receive the join request from Audience B in the onSeatRequestReceived Callback.
    swift
    let seatIndex = 1
    let timeout = 60
    seatGridView.takeSeat(index: index, timeout: timeout) { userInfo in
    print("Application for speaking is approved")
    } onRejected: { userInfo in
    print("Application for speaking is rejected")
    } onCancelled: { userInfo in
    print("Application for speaking is canceled")
    } onTimeout: { userInfo in
    print("Application for speaking times out")
    } onError: { userInfo, code, message in
    print("Application for speaking error")
    }
    The TUILiveKit audience application for taking seat feature is mainly implemented through SeatGridView. You can call the following API Function to achieve the audience application for taking seat feature. The implementation is as follows, with Audience B applying for a seat as an example.
    Note:
    Only when the room mode is applyToTake (Apply to join the seat), the host will receive join requests. In freeToTake (Free to Join the Podium) mode, takeSeat will succeed directly.

    Anchor end receives a Request to Speak

    Anchor A will receive Audience B's request to join the seat in the onSeatRequestReceived callback method.
    swift
    func onSeatRequestReceived(type: SGRequestType, userInfo: TUIUserInfo) {
    if type == .applyToTakeSeat {
    print("Received audience's request to join the microphone:\\(userInfo.userId)")
    }
    }
    Note:
    Only when the room mode is applyToTake (Apply to join the seat), the host will receive join requests. In freeToTake (Free to Join the Podium) mode, takeSeat will succeed directly.

    Anchor responds to the request to take seat

    After Anchor A receives Audience B's request to join the seat, they can call responseRemoteRequest to respond whether they agree to let Audience B speak. Audience B will receive a callback of Anchor A's acceptance or rejection (onAccepted/onRejected).
    swift
    // Anchor agrees to let the audience take the seat
    seatGridView.responseRemoteRequest(userId, true) {
    } onError: { code, message in
    }
    
    // Anchor rejects the audience's request to take the seat
    seatGridView.responseRemoteRequest(userId, false) {
    } onError: { code, message in
    }

    Callback for seat information changes

    If you have already set up the Custom Seat View, you can listen to the updateSeatView callback to refresh your custom seat UI.
    swift
    func seatGridView(_ view: SeatGridView, updateSeatView seatInfo: TUISeatInfo, seatView: UIView) {
    print("Seat information changes")
    }

    Anchor invites audience to speak flow

    Anchor sends invite speaking request

    Anchor A sends an invite speaking request to Audience C. Audience C will receive the invite speaking request from Anchor A in the onSeatRequestReceived Callback.
    swift
    let seatIndex = 1
    let userId = "userIdC"
    
    seatGridView.takeUserOnSeatByAdmin(index: seatIndex, timeout: timeout, userId: userId) { userInfo in
    print("Invitation to join the microphone is approved")
    } onRejected: { userInfo in
    print("Invitation to join the microphone is rejected")
    } onCancelled: { userInfo in
    print("Invitation to join the microphone is canceled")
    } onTimeout: { userInfo in
    print("Invitation to join the microphone times out")
    } onError: { userInfo, code, message in
    print("Invitation to join the microphone error")
    }

    Audience Side received an Invite Speaking Request

    Audience C will receive Anchor A's Invite Speaking Request in the onSeatRequestReceived callback method.
    swift
    func onSeatRequestReceived(type: SGRequestType, userInfo: TUIUserInfo) {
    if type == .inviteToTakeSeat {
    print("Receive an invitation to become a speaker from the anchor:\\(userInfo.userId)")
    }
    }

    Audience responds to the invite to speak

    After Audience C receives the join request from Anchor A, they can call responseRemoteRequest to respond whether they agree to speak. Anchor A will receive Audience C's acceptance or rejection (onAccepted/onRejected) callback.
    swift
    // Audience agrees to the anchor's invite
    seatGridView.responseRemoteRequest("userId of anchor", true) {
    } onError: { code, message in
    }
    
    // Audience rejects the anchor's invite
    seatGridView.responseRemoteRequest("userId of anchor", false, null) {
    } onError: { code, message in
    }
    Note:
    If using a custom seat view, both anchors and the audience can refresh the seat UI by listening to the callback for seat information changes.

    Leave the Mic Process

    After the audience successfully becomes a speaker, they proactively become a listener again.

    After Audience B becomes a speaker successfully, they can call leaveSeat to leave the mic voluntarily.
    swift
    seatGridView.leaveSeat() {
    } onError: { code, message in
    }

    After the audience successfully joins the stage, the host kicks them off stage

    After Audience B becomes a speaker successfully, Anchor A can kick Audience B off.
    swift
    userId = "userIdB"
    seatGridView.kickUserOffSeatByAdmin(userId) {
    } onError: { code, message in
    }

    Audience receives a callback when the host kicks them off stage

    After Anchor A kicks Audience B off, Audience B will receive the onKickedOffSeat callback.
    swift
    func onKickedOffSeat(userInfo: TUIUserInfo) {
    print("Anchor kicked off the microphone")
    }
    Note:
    If using a custom microphone view, both anchors and the audience can refresh the microphone UI by listening to the callback for seat information changes.

    Lock Mic Process

    Position Lock

    The anchor can lock a specific seat, and it will be blocked, preventing any mic operations.
    swift
    let index = 1
    let isLockSeat = true
    
    let params = TUISeatLockParams()
    params.lockSeat = isLockSeat
    
    seatGridView.lockSeat(index: index, lockMode: params) {
    } onError: { code, message in
    }

    Audio Lock

    The anchor can lock the audio for a specific microphone position, and the user on that position will be muted.
    swift
    let index = 1
    let isAudioLocked = true
    
    let params = TUISeatLockParams()
    params.lockAudio = isAudioLocked
    
    seatGridView.lockSeat(index: index, lockMode: params) {
    } onError: { code, message in
    }
    Note:
    If using a custom microphone view, both anchors and the audience can refresh the microphone UI by listening to the callback for seat information changes.

    Other microphone management feature extensions

    The microphone management feature is implemented based on SeatGridView. If you need to extend the microphone management feature, please refer to the SeatGridView documentation.
    
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support