FaceUnity AR Filter
Updated
Integrate and use the FaceUnity AR Filter extension in your Android, iOS, or Flutter app.
The FaceUnity AR Filter extension uses 3D vision, 3D graphics, and deep learning technologies to provide advanced AR portrait video effects for the Agora Video SDK. It enables features such as:
- Basic beauty: Skin beautification, whitening, and rosy effects.
- Advanced beauty: Beauty effects for shape, face, and skin.
- Number detection: Detect the number of faces, humans, or gestures.
This page shows you how to integrate and use the FaceUnity AR Filter extension in your app.
Understand the tech
In a Flutter project, you integrate the native Android and iOS plug-ins through Gradle and CocoaPods respectively.
Prerequisites
- Flutter 2.0.0 or higher.
- Dart 2.15.1 or higher.
- Implemented the SDK quickstart.
Project setup
-
Integrate the Android plugin through Gradle by adding the downloaded
.aarfiles toandroid/libsand configuringbuild.gradle. -
Integrate the iOS plugin through CocoaPods by importing the
.frameworkfiles and updating the podspec and Podfile. -
Convert the
authpackcertificate to Dart and save it in the Flutterlibfolder. -
Save the required model and
.bundlefiles from the resource package to the project folder. -
Add the necessary Flutter dependencies and assets to
pubspec.yaml.
Integrate the extension
Enable the extension
if (Platform.isAndroid) {
await agoraEngine.loadExtensionProvider(path: 'AgoraFaceUnityExtension');
}
await agoraEngine.enableExtension(
provider: "FaceUnity",
extension: "Effect",
enable: true,
);Handle extension callbacks
Register onExtensionStarted, onExtensionError, and onExtensionEvent in RtcEngineEventHandler.
Initialize the extension
Call setExtensionProperty to set fuSetup and fuLoadAIModelFromPackage.
Apply AR effects
Call setExtensionProperty to load props and apply effects such as the cat ears demo effect.
Release resources
Call setExtensionProperty with fuDestroyLibData when you dispose of the engine.
