tencent cloud

Feedback

Last updated: 2024-12-03 17:51:10

    Description of the Feature

    Microphone Position Management is a real-time interaction and communication method where anchors can interact with the audience on the seat position 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 mic, and locking seat positions, greatly enriching the playability of the voice chat room.
    Microphone Position List
    Audience applies to go on-mic
    Anchor Handling Microphone Access
    
    
    
    
    
    
    
    
    

    Access Process

    Audience applies to go on-mic process

    The TUILiveKit audience application for seat feature is mainly implemented through SeatGridView. You can call the following API Function to achieve the audience application for 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.
    Kotlin
    Java
    val seatIndex = 1;
    val timeout = 60;
    seatGridView.takeSeat(seatIndex, timeout, object : VoiceRoomDefine.RequestCallback {
    override fun onAccepted(userInfo: TUIRoomDefine.UserInfo) {
    Log.i(TAG, "Application for speaking is approved")
    }
    
    override fun onRejected(userInfo: TUIRoomDefine.UserInfo) {
    Log.i(TAG, "Application for speaking is rejected")
    }
    
    override fun onCancelled(userInfo: TUIRoomDefine.UserInfo) {
    Log.i(TAG, "Application for speaking is canceled")
    }
    
    override fun onTimeout(userInfo: TUIRoomDefine.UserInfo) {
    Log.i(TAG, "Application for speaking times out")
    }
    
    override fun onError(userInfo: TUIRoomDefine.UserInfo, error: TUICommonDefine.Error, message: String) {
    Log.i(TAG, "Application for speaking error")
    }
    })
    int seatIndex = 1;
    int timeout = 60;
    seatGridView.takeSeat(seatIndex, timeout, new VoiceRoomDefine.RequestCallback() {
    @Override
    public void onAccepted(TUIRoomDefine.UserInfo userInfo) {
    Log.i(TAG, "Application for speaking is approved");
    }
    
    @Override
    public void onRejected(TUIRoomDefine.UserInfo userInfo) {
    Log.i(TAG, "Application for speaking is rejected");
    }
    
    @Override
    public void onCancelled(TUIRoomDefine.UserInfo userInfo) {
    Log.i(TAG, "Application for speaking is canceled");
    }
    
    @Override
    public void onTimeout(TUIRoomDefine.UserInfo userInfo) {
    Log.i(TAG, "Application for speaking times out");
    }
    
    @Override
    public void onError(TUIRoomDefine.UserInfo userInfo, TUICommonDefine.Error error, String message) {
    Log.i(TAG, "Application for speaking error");
    }
    });
    The TUILiveKit audience application for seat feature is mainly implemented through SeatGridView. You can call the following API Function to achieve the audience application for seat feature. The implementation is as follows, with Audience B applying for a seat as an example.
    Note:
    The room owner will only receive a request to speak when the room mode is APPLY_TO_TAKE, in FREE_TO_TAKE mode, takeSeat will directly succeed in taking the seat.

    Host end receives a Request to Speak

    Anchor A will receive Audience B's request to join the seat in the onSeatRequestReceived callback method.
    Kotlin
    Java
    override fun onSeatRequestReceived(type: VoiceRoomDefine.RequestType, userInfo: TUIRoomDefine.UserInfo) {
    if (type == VoiceRoomDefine.RequestType.APPLY_TO_TAKE_SEAT) {
    Log.i(TAG, "Received request to join the mic from the audience: ${userInfo.userId}")
    }
    }
    @Override
    public void onSeatRequestReceived(VoiceRoomDefine.RequestType type, TUIRoomDefine.UserInfo userInfo) {
    if (type == VoiceRoomDefine.RequestType.APPLY_TO_TAKE_SEAT) {
    Log.i(TAG, "Received request to join the mic from the audience: " + userInfo.userId);
    }
    }
    Note:
    The room owner will only receive a request to speak when the room mode is APPLY_TO_TAKE, in FREE_TO_TAKE mode, takeSeat will directly succeed in taking the seat.

    Anchor responds to the request to speak

    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).
    Kotlin
    Java
    // Anchor agrees to let the audience take the mic
    seatGridView.responseRemoteRequest(userId, true, null);
    
    // Anchor rejects the audience's request to take the mic
    seatGridView.responseRemoteRequest(userId, false, null);
    // Anchor agrees to let the audience take the mic
    seatGridView.responseRemoteRequest(userId, true, null);
    
    // Anchor rejects the audience's request to take the mic
    seatGridView.responseRemoteRequest(userId, false, null);

    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 UI.
    Kotlin
    Java
    override fun updateSeatView(seatGridView: SeatGridView, seatInfo: TUIRoomDefine.SeatInfo, seatView: View) {
    Log.i(TAG, "Seat information changes");
    }
    @Override
    public void void updateSeatView(SeatGridView seatGridView, TUIRoomDefine.SeatInfo seatInfo, View seatView) {
    Log.i(TAG, "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.
    Kotlin
    Java
    val seatIndex = 1;
    val userId = "userIdC";
    val timeout = 60;
    seatGridView.takeUserOnSeatByAdmin(seatIndex, timeout, userId, object : VoiceRoomDefine.RequestCallback {
    override fun onAccepted(userInfo: TUIRoomDefine.UserInfo) {
    Log.i(TAG, "Invitation to Become a Speaker Accepted")
    }
    
    override fun onRejected(userInfo: TUIRoomDefine.UserInfo) {
    Log.i(TAG, "Invitation to Become a Speaker Rejected")
    }
    
    override fun onCancelled(userInfo: TUIRoomDefine.UserInfo) {
    Log.i(TAG, "Invitation to Become a Speaker Cancelled")
    }
    
    override fun onTimeout(userInfo: TUIRoomDefine.UserInfo) {
    Log.i(TAG, "Invitation to Become a Speaker Timed Out")
    }
    
    override fun onError(userInfo: TUIRoomDefine.UserInfo, error: TUICommonDefine.Error, message: String) {
    Log.i(TAG, "Invitation to Become a Speaker Error")
    }
    })
    val seatIndex = 1;
    val userId = "userIdC";
    val timeout = 60;
    seatGridView.takeUserOnSeatByAdmin(seatIndex, userId, timeout, new VoiceRoomDefine.RequestCallback() {
    @Override
    public void onAccepted(TUIRoomDefine.UserInfo userInfo) {
    Log.i(TAG, "Invitation to Become a Speaker Accepted");
    }
    
    @Override
    public void onRejected(TUIRoomDefine.UserInfo userInfo) {
    Log.i(TAG, "Invitation to Become a Speaker Rejected");
    }
    
    @Override
    public void onCancelled(TUIRoomDefine.UserInfo userInfo) {
    Log.i(TAG, "Invitation to Become a Speaker Cancelled");
    }
    
    @Override
    public void onTimeout(TUIRoomDefine.UserInfo userInfo) {
    Log.i(TAG, "Invitation to Become a Speaker Timed Out");
    }
    
    @Override
    public void onError(TUIRoomDefine.UserInfo userInfo, TUICommonDefine.Error error, String message) {
    Log.i(TAG, "Invitation to Become a Speaker Error");
    }
    });

    Audience Side received an Invite Speaking Request

    Audience C will receive Anchor A's invite to join the microphone in the onSeatRequestReceived callback method.
    Kotlin
    Java
    override fun onSeatRequestReceived(type: VoiceRoomDefine.RequestType, userInfo: TUIRoomDefine.UserInfo) {
    if (type == VoiceRoomDefine.RequestType.INVITE_TO_TAKE_SEAT) {
    Log.i(TAG, "Received invite to join the mic from the anchor: ${userInfo.userId}")
    }
    }
    @Override
    public void onSeatRequestReceived(VoiceRoomDefine.RequestType type, TUIRoomDefine.UserInfo userInfo) {
    if (type == VoiceRoomDefine.RequestType.INVITE_TO_TAKE_SEAT) {
    Log.i(TAG, "Received invite to join the mic 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.
    Kotlin
    Java
    // Audience agrees to the anchor's invite
    seatGridView.responseRemoteRequest("", true, null);
    
    // Audience rejects the anchor's invite
    seatGridView.responseRemoteRequest("", false, null);
    // Audience agrees to the anchor's invite
    seatGridView.responseRemoteRequest("", true, null);
    
    // Audience rejects the anchor's invite
    seatGridView.responseRemoteRequest("", false, null);
    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.
    Kotlin
    Java
    seatGridView.leaveSeat()
    seatGridView.leaveSeat();

    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.
    Kotlin
    Java
    val userId = "userIdB"
    seatGridView.kickUserOffSeatByAdmin(userId, null)
    String userId = "userIdB";
    seatGridView.kickUserOffSeatByAdmin(userId, null);

    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.
    Kotlin
    Java
    override fun onKickedOffSeat(inviterUser: UserInfo) {
    Log.i(TAG, "Anchor kicked off the mic")
    }
    @Override
    public void onKickedOffSeat(TUIRoomDefine.UserInfo userInfo) {
    Log.i(TAG, "Anchor kicked off the mic");
    }
    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.

    Lock Mic Process

    Position Lock

    The anchor can lock a specific mic position, and it will be blocked, preventing any mic operations.
    Kotlin
    Java
    val index = 1;
    val isLockSeat = true
    val params = TUIRoomDefine.SeatLockParams().apply {
    lockSeat = isLockSeat
    }
    seatGridView.lockSeat(index, params, null)
    int index = 1;
    bool isLockSeat = true;
    TUIRoomDefine.SeatLockParams params = new TUIRoomDefine.SeatLockParams();
    params.lockSeat = isLockSeat;
    seatGridView.lockSeat(index, params, null);

    Audio Lock

    The anchor can lock the audio for a specific seat position, and the user on that position will be muted.
    Kotlin
    Java
    val index = 1;
    bool isAudioLocked = true;
    val params = TUIRoomDefine.SeatLockParams().apply {
    isAudioLocked = isLockSeat
    }
    seatGridView.lockSeat(index, params, null)
    int index = 1;
    bool isAudioLocked = true;
    TUIRoomDefine.SeatLockParams params = new TUIRoomDefine.SeatLockParams();
    params.lockAudio = seatInfo.isAudioLocked;
    seatGridView.lockSeat(index, params, null);
    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.

    Other seat management feature extensions

    The seat management feature is implemented based on SeatGridView. If you need to extend the seat 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