TEBeautyKit.setResPath((new File(getFilesDir(), "xmagic_dir").getAbsolutePath()));
TEUIConfig.getInstance().setTEPanelViewRes("beauty_panel/beauty.json",null, "beauty_panel/lut.json", "beauty_panel/motions.json", "beauty_panel/makeup.json", "beauty_panel/segmentation.json");
new Thread(() -> { boolean result = TEBeautyKit.copyRes(MainActivity.this.getApplicationContext()); runOnUiThread(() -> { if (result) { saveCopyData(); } teProgressDialog.dismiss(); checkLicense(); }); }).start();
TEBeautyKit.setTELicense(this.getApplicationContext(),LicenseConstant.mXMagicLicenceUrl,LicenseConstant.mXMagicKey, (i, s) -> { if (i == LicenseConstant.AUTH_STATE_SUCCEED) { Intent intent = new Intent(MainActivity.this, ThirdBeautyActivity.class); startActivity(intent); } else { Log.e(TAG, "te license check is failed,please checke "); } });
private void initBeautyPanelView() { RelativeLayout panelLayout = findViewById(R.id.live_pusher_bp_beauty_panel); this.tePanelView = new TEPanelView(this); if (lastParamList != null) { //用于恢复美颜上次效果 this.tePanelView.setLastParamList(lastParamList); } this.tePanelView.showView(this); panelLayout.addView(this.tePanelView); }
/** * 初始化美颜SDK */ private void initBeautyApi() { TEBeautyKit.create(ThirdBeautyActivity.this.getApplicationContext(), false, new TEBeautyKit.OnInitListener() {@Overridepublic void onInitResult(TEBeautyKit api) {beautyKit = api;beautyKit.setTipsListener(new XmagicApi.XmagicTipsListener() {@Overridepublic void tipsNeedShow(String tips, String tipsIcon, int type, int duration) {showTips(tips, tipsIcon, type, duration);}@Overridepublic void tipsNeedHide(String tips, String tipsIcon, int type) {}});tePanelView.setupWithTEBeautyKit(beautyKit);}}); }
private void setProcessListener() {//1. 设置 TRTCVideoFrameListener 回调, 详见API说明文档 {https://liteav.sdk.qcloud.com/doc/api/zh-cn/group__TRTCCloud__android.html#a0b565dc8c77df7fb826f0c45d8ad2d85}mTRTCCloud.setLocalVideoProcessListener(TRTCCloudDef.TRTC_VIDEO_PIXEL_FORMAT_Texture_2D, TRTCCloudDef.TRTC_VIDEO_BUFFER_TYPE_TEXTURE, new TRTCCloudListener.TRTCVideoFrameListener() {@Overridepublic void onGLContextCreated() { //2. GLContext 创建Log.e(TAG, "onGLContextCreated");initBeautyApi();}@Overridepublic int onProcessVideoFrame(TRTCCloudDef.TRTCVideoFrame srcFrame, TRTCCloudDef.TRTCVideoFrame dstFrame) {if (beautyKit != null) {dstFrame.texture.textureId = beautyKit.process(srcFrame.texture.textureId, srcFrame.width, srcFrame.height);} else {dstFrame.texture.textureId = srcFrame.texture.textureId;}return 0;}@Overridepublic void onGLContextDestory() { //4. GLContext 销毁Log.e(TAG, "onGLContextDestroy");if (beautyKit != null) {beautyKit.onDestroy();beautyKit = null;}}});}
public void onGLContextDestory() { //4. GLContext 销毁 Log.e(TAG, "onGLContextDestroy"); if (beautyKit != null) { beautyKit.onDestroy(); } }
/** * 用于恢复贴纸中的声音 * 恢复陀螺仪传感器,一般在Activity的onResume方法中调用 */ public void onResume()
/** * 用于暂停贴纸中的声音 * 暂停陀螺仪传感器,一般在Activity的onPause方法中调用 */ public void onPause()
本页内容是否解决了您的问题?