LiteAVDemo(UGC).xiaoshipindemo module, find the LicenseManager class and fill in the applied short video License and Tencent Effect License information:ugcLicenceUrl / ugcKey: the authorization URL and key of the short video License;xmagicAuthLicenceUrl / xmagicAuthKey: the authorization URL and key of the Tencent Effect License.app module, find the build.gradle file and change the value of applicationId to the Android package name filled in when applying for the License.//The following is a code snippet from TEBeautySDKManger.javaTEBeautyKit.setResPath(new File(applicationContext.getFilesDir(), "ugc_xmagic").getAbsolutePath());TEBeautyKit.copyRes(applicationContext); //This method is time-consuming and needs to be executed in a child thread
//The following is a code snippet from TEBeautySDKManger.javaTEBeautyKit.setTELicense(applicationContext, xmagicAuthLicenceUrl, xmagicAuthKey, listener);
private void initTEBeautyKit() {mBeautyKit = new TEBeautyKit(getContext().getApplicationContext(), XmagicConstant.EffectMode.PRO);mCustomPropertyManager.setBeautyKit(mBeautyKit);mPanelView.setupWithTEBeautyKit(mBeautyKit); //Set the beauty object into the panel, so that beauty properties can be adjusted when operating the panel}
private void registerVideoProcessListener() {TXUGCRecord instance = TXUGCRecord.getInstance(UGCKit.getAppContext());instance.setVideoProcessListener(new TXUGCRecord.VideoCustomProcessListener() {@Overridepublic int onTextureCustomProcess(int textureId, int width, int height) {if (mBeautyType == 1 && mBeautyKit != null) {return mBeautyKit.process(textureId, width, height);}return textureId;}@Overridepublic void onDetectFacePoints(float[] floats) {}@Overridepublic void onTextureDestroyed() {if (Looper.getMainLooper() != Looper.myLooper()) { //non-main threadmCustomPropertyManager.setBeautyKit(null);if (mBeautyKit != null) {mLastParamList = mBeautyKit.exportInUseSDKParam();mBeautyKit.onDestroy();}mIsTextureDestroyed = true;unRegisterVideoProcessListener();}}});}
public void onTextureDestroyed() {if (Looper.getMainLooper() != Looper.myLooper()) { //non-main threadmCustomPropertyManager.setBeautyKit(null);if (mBeautyKit != null) {mLastParamList = mBeautyKit.exportInUseSDKParam(); //Export beauty parametersmBeautyKit.onDestroy(); //Destroy the beauty object}mIsTextureDestroyed = true;unRegisterVideoProcessListener();}}
/*** Used to resume the sound in stickers* Resume the gyroscope sensor, generally called in the Activity's onResume method*/this.mBeautyKit.onResume()
/*** Used to pause the sound in stickers* Pause the gyroscope sensor, generally called in the Activity's onPause method*/this.mBeautyKit.onPause()
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários