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);}}); }
mLivePusher = new V2TXLivePusherImpl(this, V2TXLiveDef.V2TXLiveMode.TXLiveMode_RTC); mLivePusher.enableCustomVideoProcess(true, V2TXLivePixelFormatTexture2D, V2TXLiveBufferTypeTexture); mLivePusher.setObserver(new V2TXLivePusherObserver() { @Override public void onGLContextCreated() { //2. GLContext 创建 Log.d(TAG, "onGLContextCreated"); initBeautyApi(); } @Override public int onProcessVideoFrame(V2TXLiveDef.V2TXLiveVideoFrame srcFrame, V2TXLiveDef.V2TXLiveVideoFrame 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; } @Override public void onGLContextDestroyed() { Log.d(TAG, "onGLContextDestroyed"); 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()
本页内容是否解决了您的问题?