tencent cloud

Feedback

Last updated: 2022-09-26 14:18:38
    This document describes how to exit the current TRTC room and in which cases a user is forced to exit the room.
    
    
    You will encounter two types of objects while using the TRTC web SDK:
    Client object, which represents a local client. The Client class provides APIs for room entry, local stream publishing, remote stream subscription, etc.
    Stream object, which represents an audio/video stream object. There are local stream objects (LocalStream) and remote stream objects (RemoteStream). The Stream class provides APIs for stream-related actions, including audio/video playback control.
    

    Step 1. Enter a room

    Create a client object and enter a room. For detailed directions, see Entering a Room.
    

    Step 2. Exit the room

    Call Client.leave() to exit the room, and the call session ends.
    await client.leave();
    

    Step 3. Forced to exit the room

    In the following cases, a user will receive the CLIENT_BANNED callback, which indicates that they were forced to exit the room.
    client.on('client-banned', error => {
    console.error('client-banned observed: ' + error.message);
    // client-banned observed: client was banned because of duplicated userId joining the room.
    // client-banned observed: client was banned because of you got banned by account admin
    });
    Case 1: A user with the same user ID entered the room. If there are two anchors with the same user ID in the room, the user who entered the room first will be removed from the room. Suppose user A entered a room first, and user B entered the same room with the same user ID. User A would be removed from the room. Having two users with the same ID in the same room may cause errors and is not allowed.
    Case 2: A server-side API is called to remove the user or close the room. You call RemoveUser | RemoveUserByStrRoomId to remove a user from a TRTC room. The user will receive the CLIENT_BANNED callback. If you call DismissRoom | DismissRoomByStrRoomId to close a TRTC room, all users in the room will receive the CLIENT_BANNED callback.
    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