tencent cloud

Feedback

Last updated: 2024-04-03 17:23:11
    This article introduces the use of the group call feature, such as initiating a group call and joining a group call.

    Expected outcome

    TUICallKit supports group calls. The expected outcome is shown in the figure below.
    Web
    Mobile Client
    
    
    
    
    
    

    Create groupID

    Before using the group call feature, you need to create a group first and initiate a group call in an existing group.
    Method one: Create a group by calling the IM API, see IM Group Management for details.
    Method two: Manually create a group through the console, see Console group management for details.
    import TIM from "@tencentcloud/chat"; // npm i @tencentcloud/chat
    
    const userIDList: string[] = ['user1', 'user2'];
    async function createGroupID() {
    const tim = TIM.create({ SDKAppID });
    const memberList: any[] = userIDList.map(userId => ({ userID: userId }));
    const res = await tim.createGroup({
    type: TIM.TYPES.GRP_PUBLIC, // Must be a public group
    name: 'WebSDK',
    memberList
    });
    return res.data.group.groupID;
    }

    Group call

    Initiate a group call

    Initiate a group call by calling the groupCall API.
    import { TUICallKitServer, TUICallType } from "@tencentcloud/call-uikit-react";
    // Replace it with the call-uikit npm package you are currently using
    
    try {
    const params = {
    userIDList: ['user1', 'user2'],
    groupID: 'xxx',
    type: TUICallType.VIDEO_CALL,
    }
    await TUICallKitServer.groupCall(params);
    } catch (error: any) {
    alert(`[TUICallKit] groupCall failed. Reason:${error}`);
    }

    Join a group call

    Join an existing audio and video call in the group by calling the joinInGroupCall API.
    Note: Vue ≥ v3.1.2 is supported
    import { TUICallKitServer, TUICallType } from "@tencentcloud/call-uikit-react";
    // Replace it with the call-uikit npm package you are currently using
    
    try {
    const params = {
    type: TUICallType.VIDEO_CALL,
    groupID: "xxx",
    roomID: 0,
    };
    await TUICallKitServer.joinInGroupCall(params);
    } catch (error: any) {
    alert(`[TUICallKit] joinInGroupCall failed. Reason: ${error}`);
    }
    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