te_adapter_trtcte_adapter_trtc in dependencies.dependencies{...implementation 'com.tencent.mediacloud:te_adapter_trtc:Version number'}
.aar file to the app project libs directory.build.gradle in the app module and add a dependency reference:dependencies{...implementation fileTree(dir: 'libs', include: ['*.jar','*.aar']) //add *.aar}
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.com.tencent.trtc.debug.GenerateTestUserSig.java under the Debug module and add the corresponding APPID, SDKAPPID, and SECRETKEY.com.tencent.trtc.thirdbeauty.ThirdBeautyActivity.java.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);
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 ");}});
TEPanelView. Beauty attributes can be set using TEBeautyKit's setEffect method.this.beautyAdapter = new TEBeautyTRTCAdapter(XmagicConstant.EffectMode.PRO, TEBeautyKit.getResPath());// Set phone orientationthis.beautyAdapter.notifyScreenOrientationChanged(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);// Set whether the camera is front-facing or rear-facing, and whether encoding mirror is enabledthis.beautyAdapter.notifyCameraChanged(isFront, this.isEncoderMirror);// Initialize panel codeprivate 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 effectthis.elegantPanelView.setPreviousParamList(previousParamList);}this.elegantPanelView.displayView(this);panelLayout.addView(this.elegantPanelView);}
this.beautyAdapter.bind(this, this.mTRTCCloud, new ITEBeautyAdapter.CallBack() {@Overridepublic void onCreatedTEBeautyApi(XmagicApi xmagicApi) {Log.e(TAG, "onCreatedTEBeautyApi ");mBeautyKit = new TEBeautyKit(xmagicApi);mPanelView.setupWithTEBeautyKit(mBeautyKit);setTipListener(mBeautyKit);setLastParam(mBeautyKit);}@Overridepublic void onDestroyTEBeautyApi() {Log.e(TAG, "onDestroyTEBeautyApi ");mBeautyKit = null;}});
this.beautyAdapter.bind(this, this.mTRTCCloud, new ITEBeautyAdapter.CallBack() {@Overridepublic void onCreatedTEBeautyKit(TEBeautyKit beautyKit) {mBeautyKit = beautyKit;// Bind mBeautyKit with the beauty paneltePanelView.setupWithTEBeautyKit(mBeautyKit);setTipListener(mBeautyKit);setLastParam(mBeautyKit);Log.e("beautyLiveAdapter", "onCreatedTEBeautyKit");}@Overridepublic void onDestroyTEBeautyKit() {mBeautyKit = null;Log.e("beautyLiveAdapter", "onDestroyTEBeautyKit");}});
// Call notifyCameraChanged to inform the adapter about changes in camera or screen mirroringthis.beautyAdapter.notifyCameraChanged(isFront, this.isEncoderMirror);//When the screen orientation changes, you need to call the notifyScreenOrientationChange methodthis.beautyAdapter.notifyScreenOrientationChanged(orientation);
// Unbind method can be called to release the binding when beauty enhancement is no longer neededthis.beautyAdapter.unbind();
/*** Used to restore the sound in stickers* Restores the gyroscope sensor, typically called in the Activity's onResume method*/this.mBeautyKit.onResume()
/*** Used to pause sound in stickers* Pause gyroscope sensor, usually called in the onPause method of Activity*/this.mBeautyKit.onPause()
Feedback