Release Notes
The “startPlay” API of the UGSV SDK Renamed
build.gradle file of the xmagickit module, find the following:api 'com.tencent.mediacloud:TencentEffect_S1-04:latest.release'
xmagickit module respectively:../assets/MotionRes.../assets/lut.xmagickit module from the demo into your actual project.build.gradle in app and do the following:applicationId with the package name under the obtained trial license.UGCKitVideoRecord class of the demo.// For details about authentication and error codes, see https://www.tencentcloud.com/document/product/1143/45385#.E6.AD.A5.E9.AA.A4.E4.B8.80.EF.BC.9A.E9.89.B4.E6.9D.83XMagicImpl.checkAuth(new TELicenseCheck.TELicenseCheckListener() {@Overridepublic void onLicenseCheckFinish(int errorCode, String msg) {if (errorCode == TELicenseCheck.ERROR_OK) {loadXmagicRes();} else {Log.e("TAG", "auth fail, please check auth url and key" + errorCode + " " + msg);}}});
private void loadXmagicRes() {if (XMagicImpl.isLoadedRes) {XmagicResParser.parseRes(mActivity.getApplicationContext());initXMagic();return;}new Thread(new Runnable() {@Overridepublic void run() {XmagicResParser.copyRes(mActivity.getApplicationContext());XmagicResParser.parseRes(mActivity.getApplicationContext());XMagicImpl.isLoadedRes = true;new Handler(Looper.getMainLooper()).post(new Runnable() {@Overridepublic void run() {initXMagic();}});}}).start();}
private void initBeauty() {TXUGCRecord instance = TXUGCRecord.getInstance(UGCKit.getAppContext());instance.setVideoProcessListener(new TXUGCRecord.VideoCustomProcessListener() {@Overridepublic int onTextureCustomProcess(int textureId, int width, int height) {if (xmagicState == XMagicImpl.XmagicState.STARTED && mXMagic != null) {return mXMagic.process(textureId, width, height);}return textureId;}@Overridepublic void onDetectFacePoints(float[] floats) {}@Overridepublic void onTextureDestroyed() {if (Looper.getMainLooper() != Looper.myLooper()) { // Not the main threadboolean stopped = xmagicState == XMagicImpl.XmagicState.STOPPED;if (stopped || xmagicState == XMagicImpl.XmagicState.DESTROYED) {if (mXMagic != null) {mXMagic.onDestroy();}}if (xmagicState == XMagicImpl.XmagicState.DESTROYED) {TXUGCRecord.getInstance(UGCKit.getAppContext()).setVideoProcessListener(null);}}}});}
onPause() is used to pause the beauty filter effect, which can be executed in the Activity/Fragment lifecycle method. The onDestroy method needs to be called in the GL thread (the onDestroy() of the XMagicImpl object can be called in the onTextureDestroyed method). For more information, see the onTextureDestroyed method in the sample code.@Overridepublic void onTextureDestroyed() {if (Looper.getMainLooper() != Looper.myLooper()) { // Not the main threadboolean stopped = xmagicState == XMagicImpl.XmagicState.STOPPED;if (stopped || xmagicState == XMagicImpl.XmagicState.DESTROYED) {if (mXMagic != null) {mXMagic.onDestroy();}}if (xmagicState == XMagicImpl.XmagicState.DESTROYED) {TXUGCRecord.getInstance(UGCKit.getAppContext()).setVideoProcessListener(null);}}}
<RelativeLayoutandroid:id="@+id/panel_layout"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentBottom="true"android:visibility="gone"/>
private void initXMagic() {if (mXMagic == null) {mXMagic = new XMagicImpl(mActivity, getBeautyPanel());} else {mXMagic.onResume();}}
UGCKitVideoRecord class of the demo.피드백