demo/lib under the main.dart file, add your licenseUrl and licenseKey in this file. The sample code for using beauty features in TRTC is primarily located in demo/lib/page/trtc_page.dart and demo/lib/main.dart.applicationId to the package name you used when applying for the license.flutter pub get.flutter pub get.pod install.bundle ID (it needs to be the same as the bundle ID you provided when applying for the license).dependencies {implementation 'com.tencent.mediacloud:TencentEffect_S1-04:latest.release'}
android/app module and locate the src/main/assets folder. Copy the demo/android/app/src/main/assetslut and MotionRes folders from the demo project to your own project's android/app/src/main/assets. If your project doesn't have an assets folder, you can create one manually.<uses-native-libraryandroid:name="libOpenCL.so"android:required="false" />//true indicates that libOpenCL is essential for the current app. Without this library, the system will not allow the app to install//false indicates that libOpenCL is not essential for the current app. The app can be installed normally with or without this library. If the device has this library, GAN-type special effects in the Tencent Special Effects SDK (e.g., fairy tale face, comics face) will function normally. If the device does not have this library, GAN-type effects won't work, but it will not affect the use of other features within the SDK.//For information about uses-native-library, please refer to the Android official website: https://developer.android.com/guide/topics/manifest/uses-native-library-element

no xxx method exception.-keep class com.tencent.xmagic.** { *;}-keep class org.light.** { *;}-keep class org.libpag.** { *;}-keep class org.extra.** { *;}-keep class com.gyailib.**{ *;}-keep class com.tencent.cloud.iai.lib.** { *;}-keep class com.tencent.beacon.** { *;}-keep class com.tencent.qimei.** { *;}-keep class androidx.exifinterface.** { *;}-keep class com.tencent.effect.** { *;}

tencent_effect_flutter:git:url: https://github.com/Tencent-RTC/TencentEffect_Flutter
tencent_effect_flutter:path: ../
flutter pub get
implementation 'com.tencent.mediacloud:TencentEffect_S1-04:latest.release' field's latest.release to the latest version number.TencentEffect_S1-04 field to your package field.ios/tencent_effect_flutter.podspec file under the Beauty Flutter SDK, open it and change TencentEffect_All to the package you need, and you can also change the version number to the version you need.TRTCPlugin.setBeautyProcesserFactory(new XmagicProcesserFactory());
TRTCPlugin.setBeautyProcesserFactory(XmagicProcesserFactory())
import android.os.Bundle;import androidx.annotation.Nullable;import com.tencent.trtcplugin.TRTCPlugin;import com.tencent.effect.tencent_effect_flutter.XmagicProcesserFactory;import io.flutter.embedding.android.FlutterActivity;public class MainActivity extends FlutterActivity {@Overrideprotected void onCreate(@Nullable Bundle savedInstanceState) {super.onCreate(savedInstanceState);TRTCPlugin.setBeautyProcesserFactory(new XmagicProcesserFactory());}}
import android.os.Bundleimport android.os.PersistableBundleimport com.tencent.trtcplugin.TRTCPluginimport io.flutter.embedding.android.FlutterActivityimport com.tencent.effect.tencent_effect_flutter.XmagicProcesserFactoryclass MainActivity: FlutterActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)TRTCPlugin.setBeautyProcesserFactory(XmagicProcesserFactory())}}
let instance = XmagicProcesserFactory()TencentRTCCloud.setBeautyProcesserFactory(factory: instance)
XmagicProcesserFactory *instance = [[XmagicProcesserFactory alloc] init];[TencentRTCCloud setBeautyProcesserFactoryWithFactory:instance];
import UIKitimport Flutterimport tencent_rtc_sdkimport tencent_effect_flutter@UIApplicationMain@objc class AppDelegate: FlutterAppDelegate {override func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {GeneratedPluginRegistrant.register(with: self)let instance = XmagicProcesserFactory()TencentRTCCloud.setBeautyProcesserFactory(factory: instance)return super.application(application, didFinishLaunchingWithOptions: launchOptions)}}
#import "AppDelegate.h"#import "GeneratedPluginRegistrant.h"@import tencent_effect_flutter;@import tencent_rtc_sdk;@implementation AppDelegate- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[GeneratedPluginRegistrant registerWithRegistry:self];XmagicProcesserFactory *instance = [[XmagicProcesserFactory alloc] init];[TencentRTCCloud setBeautyProcesserFactoryWithFactory:instance];return [super application:application didFinishLaunchingWithOptions:launchOptions];}@end
import android.os.Bundle;import androidx.annotation.Nullable;import com.tencent.effect.tencent_effect_flutter.XmagicProcesserFactory;import io.flutter.embedding.android.FlutterActivity;import com.tencent.trtcplugin.TRTCCloudPlugin;public class MainActivity extends FlutterActivity {@Overrideprotected void onCreate(@Nullable Bundle savedInstanceState) {super.onCreate(savedInstanceState);TRTCCloudPlugin.register(new XmagicProcesserFactory());}}
#import "AppDelegate.h"#import "GeneratedPluginRegistrant.h"@import tencent_effect_flutter;@import tencent_trtc_cloud;@implementation AppDelegate- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[GeneratedPluginRegistrant registerWithRegistry:self];XmagicProcesserFactory *instance = [[XmagicProcesserFactory alloc] init];[TencentTRTCCloud registerWithCustomBeautyProcesserFactory:instance];return [super application:application didFinishLaunchingWithOptions:launchOptions];}@end
void _initSettings(InitXmagicCallBack callBack) async {String resourceDir = await ResPathManager.getResManager().getResPath();TXLog.printlog('$TAG method is _initResource ,xmagic resource dir is $resourceDir');TencentEffectApi.getApi()?.setResourcePath(resourceDir);/// Resource copying only needs to be done once. In the current version, if copied successfully once, there is no need to copy the resources again./// Copying the resource only needs to be done once. Once it has been successfully copied in the current version, there is no need to copy it again in future versions.if (await isCopiedRes()) {callBack.call(true);return;} else {_copyRes(callBack);}}void _copyRes(InitXmagicCallBack callBack) {_showDialog(context);TencentEffectApi.getApi()?.initXmagic((result) {if (result) {saveResCopied();}_dismissDialog(context);callBack.call(result);if (!result) {Fluttertoast.showToast(msg: "initialization failed");}});}
String dir = await BeautyDataManager.getInstance().getResDir();TXLog.printlog('The file path: $dir');TencentEffectApi.getApi()?.initXmagic(dir,(reslut) {_isInitResource = reslut;callBack.call(reslut);if (!reslut) {Fluttertoast.showToast(msg: "Failed to initialize the resources");}});
TencentEffectApi.getApi()?.setLicense(licenseKey, licenseUrl,(errorCode, msg) {TXLog.printlog("Print the authentication result errorCode = $errorCode msg = $msg");if (errorCode == 0) {// Authentication succeeded}});
///Enable beauty mode/// Set to true to enable beauty mode, set to false to disable beauty mode_enableCustomBeautyByNative(bool open) {TRTCCloud trtcCloud = await TRTCCloud.sharedInstance();trtcCloud.callExperimentalAPI("{\\"api\\": \\"enableVideoProcessByNative\\", \\"params\\": {\\"enable\\": $open}}");}
///Enable beauty mode/// Set to true to enable beauty mode, set to false to disable beauty modevar enableCustomVideo = await trtcCloud.enableCustomVideoProcess(open);
TencentEffectApi.getApi()?.setEffect(sdkParam.effectName!,sdkParam.effectValue, sdkParam.resourcePath, sdkParam.extraInfo)
TencentEffectApi.getApi()?.updateProperty(_xmagicProperty!);/// You can call `BeautyDataManager.getInstance().getAllPannelData()` to get all the properties and call `updateProperty` to set properties.
TencentEffectApi.getApi()?.onPause();
TencentEffectApi.getApi()?.onResume();
TencentEffectApi.getApi()?.setOnCreateXmagicApiErrorListener((errorMsg, code) {TXLog.printlog("Error creating an effect object errorMsg = $errorMsg , code = $code");}); /// Needs to be set before creating the beauty filter
TencentEffectApi.getApi()?.setAIDataListener(XmagicAIDataListenerImp());
TencentEffectApi.getApi()?.setTipsListener(XmagicTipsListenerImp());
TencentEffectApi.getApi()?.setYTDataListener((data) {TXLog.printlog("setYTDataListener $data");});
TencentEffectApi.getApi()?.setOnCreateXmagicApiErrorListener(null);TencentEffectApi.getApi()?.setAIDataListener(null);TencentEffectApi.getApi()?.setYTDataListener(null);TencentEffectApi.getApi()?.setTipsListener(null);
android/xmagic/src.mian/assets/MotionRes/2dMotionRes of your project:
ios/Runner/xmagic/2dMotionRes.bundle of your project.


Feedback