tencent cloud

Tencent Effect SDK

Release Notes and Announcements
Release Notes
Tencent Effect SDK V3.5 Version Released
Tencent Effects SDK V3.0 Version Related API and Material Changes
Product Introduction
Overview
Features
Basic Concepts
Strengths
Use Cases
Purchase Guide
Pricing Overview
Purchase Guide
Payment Overdue and Refund
Tutorial
Demos
Free Trial License
Licenses
Adding and Renewing a License (Mobile)
Adding and Renewing a License (Desktop)
Adding and Renewing a License (Web)
FAQs
SDK Download
Features
SDK Download
Version History
SDK Integration Guide(No UI)
General Integration of Tencent Effect
Integrating Capabilities
SDK Integration Guide(Including UI)
General Integration of Tencent Effect
Integrating Tencent Effect into MLVB SDK
Integrating Tencent Effect into TRTC SDK
Integrating Tencent Effect into UGSV SDK
Virtual Avatars
API Documentation
iOS
Android
Flutter
Web
Feature Guide
Reducing SDK Size
SDK Integration Issue Troubleshooting
Performance Fine-Tuning
Effect Fine-Tuning
Material Usage
Effect Parameters
Recommended Parameters in Beautification Scenarios
UGSV Enterprise Edition Migration Guide
Integrating Tencent Effect for Third-Party Publishers (Flutter)
Integrating Beauty AR Web into Mini Programs
Tencent Effect Studio Usage
Beauty AR Web
Overview
Quick Start
SDK Integration
Parameters and APIs
Console Guide
Demos
Preset Effect List
Practical Tutorial
FAQs
FAQs
General
Technical
License
Legacy Documentation
Recommended Parameters in Beautification Scenarios
Beauty Parameters Table
One-Minute Integration of TRTC
One-Minute Integration of Live Streaming
TE SDK Policy
Privacy Policy
Data Processing And Security Agreement
Contact Us

Android

PDF
Focus Mode
Font Size
Last updated: 2025-10-21 17:58:05

SDK Integration

1. Integration TencentEffect
2. Integration TEBeautyKit
Add panel JSON file(optional if not using default panel)
3. Integrationte_adapter_trtc
Maven Dependencies
AAR Dependencies
Add the dependency for te_adapter_trtc in dependencies
dependencies{
...
implementation 'com.tencent.mediacloud:te_adapter_trtc:Version number'
}
Download AAR file (a zip file will be downloaded; extract it to get the AAR file).
Add the downloaded te_adapter_live_xxxx.aar file to the app project libs directory.
Open build.gradle in the app module and add a dependency reference:
dependencies{
...
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar']) //add *.aar
}
Refer to TRTC Demo project.
Note:
To run the code, you need to add your applied License information in the file com.tencent.thirdbeauty.xmagic.LicenseConstant.java, and modify the applicationId in the build.gradle file under the App module to the package name you provided when applying for the License.
Due to the dependency on TRTC capability, you need to find the file com.tencent.trtc.debug.GenerateTestUserSig.java under the Debug module and add the corresponding APPID, SDKAPPID, and SECRETKEY.
For the main code integration of beauty effects, please refer to the file com.tencent.trtc.thirdbeauty.ThirdBeautyActivity.java.

SDK Usage Steps

Step 1: Set Panel's JSON File

Please append the path of the JSON file added to your project in the second step of the 'How to Integrate' section in the TEBeautyKit Integration Document. If there is no JSON file, then the path Setting should be null.
TEPanelViewResModel resModel = new TEPanelViewResModel();
String combo = "S1_07"; //Set according to your package. If your package does not include a certain feature, the customer is set to null.
resModel.beauty = "beauty_panel/"+combo+"/beauty.json";
resModel.lut = "beauty_panel/"+combo+"/lut.json";
resModel.beautyBody = "beauty_panel/"+combo+"/beauty_body.json";
resModel.motion = "beauty_panel/"+combo+"/motions.json";
resModel.lightMakeup = "beauty_panel/"+combo+"/light_makeup.json";
resModel.segmentation = "beauty_panel/"+combo+"/segmentation.json";
TEUIConfig.getInstance().setTEPanelViewRes(resModel);
Note: If you do not use the provided beauty panel, please ignore this step.

Step 2: Authenticate and copy resource

TEBeautyKit.setupSDK(this.getApplicationContext(),LicenseConstant.mXMagicLicenceUrl,LicenseConstant.mXMagicKey, (i, s) -> { if (i == LicenseConstant.AUTH_STATE_SUCCEED) {
runOnUiThread(() -> { Intent intent = new Intent(MainActivity.this, ThirdBeautyActivity.class); startActivity(intent);
}
} else {
Log.e(TAG, "te license check is failed,please checke ");
}
});
Note:
Resource copying is based on the SDK version number, so resources will only be successfully copied once for the same SDK version number.

Step 3: Initialize the adapter and the panel

this.beautyAdapter = new TEBeautyTRTCAdapter(XmagicConstant.EffectMode.PRO, TEBeautyKit.getResPath());
// Set phone orientation this.beautyAdapter.notifyScreenOrientationChanged(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
// Set whether the camera is front-facing or rear-facing, and whether encoding mirror is enabled this.beautyAdapter.notifyCameraChanged(isFront, this.isEncoderMirror);
// Initialize panel code
private void initializeBeautyPanelView() { RelativeLayout panelLayout = findViewById(R.id.live_pusher_bp_beauty_panel); this.elegantPanelView = new TEPanelView(this); if (previousParamList != null) { //To restore the previous beauty effect this.elegantPanelView.setPreviousParamList(previousParamList); } this.elegantPanelView.displayView(this); panelLayout.addView(this.elegantPanelView); }
Note: If you do not use the provided panel, you do not need to create TEPanelView. Beauty attributes can be set using TEBeautyKit's setEffect method.

Step 4. Create Beauty

After V3.9.0
V3.9.0 and earlier
this.beautyAdapter.bind(this, this.mTRTCCloud, new ITEBeautyAdapter.CallBack() {
@Override
public void onCreatedTEBeautyApi(XmagicApi xmagicApi) {
Log.e(TAG, "onCreatedTEBeautyApi ");
mBeautyKit = new TEBeautyKit(xmagicApi);
mPanelView.setupWithTEBeautyKit(mBeautyKit);
setTipListener(mBeautyKit);
setLastParam(mBeautyKit);
}

@Override
public void onDestroyTEBeautyApi() {
Log.e(TAG, "onDestroyTEBeautyApi ");
mBeautyKit = null;
}
});
this.beautyAdapter.bind(this, this.mTRTCCloud, new ITEBeautyAdapter.CallBack() {
@Override
public void onCreatedTEBeautyKit(TEBeautyKit beautyKit) {
mBeautyKit = beautyKit;
// Bind mBeautyKit with the beauty panel
tePanelView.setupWithTEBeautyKit(mBeautyKit);
setTipListener(mBeautyKit);
setLastParam(mBeautyKit);
Log.e("beautyLiveAdapter", "onCreatedTEBeautyKit");
}

@Override
public void onDestroyTEBeautyKit() {
mBeautyKit = null;
Log.e("beautyLiveAdapter", "onDestroyTEBeautyKit");
}
});

Step 5. Notify adapter while Parameter Changed

// Call notifyCameraChanged to inform the adapter about changes in camera or screen mirroring this.beautyAdapter.notifyCameraChanged(isFront, this.isEncoderMirror);
//When the screen orientation changes, you need to call the notifyScreenOrientationChange method
this.beautyAdapter.notifyScreenOrientationChanged(orientation);


Step 6: Destroy Beauty

// Unbind method can be called to release the binding when beauty enhancement is no longer needed this.beautyAdapter.unbind();

Step 7: Resume Audio

/** * Used to restore the sound in stickers * Restores the gyroscope sensor, typically called in the Activity's onResume method */ this.mBeautyKit.onResume()

Step 8: Pause Audio

/** * Used to pause sound in stickers * Pause gyroscope sensor, usually called in the onPause method of Activity */ this.mBeautyKit.onPause()

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback