tencent cloud


Last updated: 2024-05-24 17:54:40
    TUICallKit has launched a new feature for virtual backgrounds, allowing users to set a blurry or image background during video calls. This hides the real calling environment, protects privacy, and makes the call more interesting. Next, this article will detail how to use this feature in the TUICallKit component.

    Integration effect

    The display effect of the TUICallKit component after integrating the virtual background feature is as follows:
    Original Camera
    Blurry Background Effect
    Image Background Effect

    Preparation Requirements

    1. Before using the Virtual Background feature provided by Tencent Cloud, you need to visit the Console to activate Audio and Video Services for your application and purchase the Group Call package. For specific steps, please see Activate Service.
    2. Download the Virtual Background Model file, unzip it, and copy the LiteavSegmentModel.zip file to the assets directory of your project.
    3. In the tuicallkit-kt directory of the project, find the build.gradle file and replace the TRTC SDK version with the Professional Version.
    api "com.tencent.liteav:LiteAVSDK_Professional:"
    There is a corresponding relationship between the version of the TRTC SDK and the model file, please ensure the version number matches the model, see below: Model File Matching with SDK.

    Enable Blurry Background

    TUICallKit's UI design supports setting a blurry background. By calling the following interface, you can display a feature button for the blurry background on the UI. Clicking the button will directly enable the blurry background feature.

    Setting Image Background (Optional)

    Implementing the image background requires users to save the image locally. After saving, call the following interface for setting (currently, only images with a local path are supported, images of uri are not supported yet).
    TUICallEngine.createInstance(context).setVirtualBackground("imagePath", null)


    Enabling blurry background has no response or is delayed?

    Ensure you have purchased the audio and video call Group Call package, see Activate Service.
    Ensure the model file is downloaded to local.
    If a model file is not added to the local path, when enabling the blurry background feature, the SDK will then download the model file. Under normal network conditions, the download takes 1~3s; the poorer the network, the longer it will take.
    Check if the model file and SDK are a match.

    Matching model files with SDK?

    TUICallKit is based on the IM SDK and TRTC SDK for audio and video call scenarios. Virtual background is a feature provided by TRTC SDK. There is a matching relationship between the virtual background model file and the TRTC SDK version. If they do not match, enabling the blurry background might be ineffective. The relationship between the model file and TRTC SDK is as below:
    SDK Version
    Virtual background model file Download address
    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