产品动态
关于腾讯特效 SDK V3.5 版本更新公告
关于腾讯特效 SDK V3.0 版本相关接口及素材变更公告
.aar文件,将 SDK 中 libs 目录下的 .aar 文件拷贝进 xmagic 模块中 libs 目录下。assets/ 目录下的全部资源拷贝到 xmagic 模块 ../src/main/assets 目录下,如果SDK 包中的 MotionRes 文件夹内有资源,将此文件夹也拷贝到 ../src/main/assets 目录下 。../src/main/jniLibs 目录下。implementation 'com.tencent.liteav:LiteAVSDK_Enterprise:latest.release'implementation 'com.tencent.liteav:LiteAVSDK_Professional:latest.release'XMagicImpl.init(this);XMagicImpl.checkAuth(null);
TCVideoRecordActivity.java 类中添加如下变量代码。private XMagicImpl mXMagic;private int isPause = 0;//0 非暂停,1暂停,2暂停中 3.表示要销毁
TCVideoRecordActivity.java 类 onCreate 方法后边添加如下代码。TXUGCRecord instance = TXUGCRecord.getInstance(this);instance.setVideoProcessListener(new TXUGCRecord.VideoCustomProcessListener() {@Overridepublic int onTextureCustomProcess(int textureId, int width, int height) {if (isPause == 0 && mXMagic != null) {return mXMagic.process(textureId, width, height);}return 0;}@Overridepublic void onDetectFacePoints(float[] floats) {}@Overridepublic void onTextureDestroyed() {if (Looper.getMainLooper() != Looper.myLooper()) { //非主线程if (isPause == 1) {isPause = 2;if (mXMagic != null) {mXMagic.onDestroy();}initXMagic();isPause = 0;} else if (isPause == 3) {if (mXMagic != null) {mXMagic.onDestroy();}}}}});XMagicImpl.checkAuth((errorCode, msg) -> {if (errorCode == TELicenseCheck.ERROR_OK) {loadXmagicRes();} else {TXCLog.e("TAG", "鉴权失败,请检查鉴权url和key" + errorCode + " " + msg);}});
isPause = 1;if (mXMagic != null) {mXMagic.onPause();}
isPause = 3;XmagicPanelDataManager.getInstance().clearData();
if (mXMagic != null) {mXMagic.onActivityResult(requestCode, resultCode, data);}
private void loadXmagicRes() {if (XMagicImpl.isLoadedRes) {XmagicResParser.parseRes(getApplicationContext());initXMagic();return;}new Thread(() -> {XmagicResParser.setResPath(new File(getFilesDir(), "xmagic").getAbsolutePath());XmagicResParser.copyRes(getApplicationContext());XmagicResParser.parseRes(getApplicationContext());XMagicImpl.isLoadedRes = true;new Handler(Looper.getMainLooper()).post(() -> {initXMagic();});}).start();}/*** 初始化美颜SDK*/private void initXMagic() {if (mXMagic == null) {mXMagic = new XMagicImpl(this, mUGCKitVideoRecord.getBeautyPanel());}else {mXMagic.onResume();}}
文档反馈