SDK 2.0.0. Dart only sets beauty parameters. Every video frame stays on the native GL thread via
FacebetterPlugin.processTexture.processFile / processImageBytes / processImageFile / processImageToUiImage on this engine. Those APIs need externalContext: false and a separate instance.
Prerequisites
tencent_trtc_cloud(or native TRTC) already in the appfacebetter_flutter: ^2.0.0- Valid
appId/appKeyorlicenseToken— License & Auth
1. Create the engine in Dart
Create before turning on custom video process.externalContext defaults to true and must stay true for TRTC.
2. iOS — feed textures in onProcessVideoFrame
tencent_trtc_cloud’s ITXCustomBeautyProcesser, keep Texture2D / Texture and call the same processTexture inside onProcessVideoFrame. Register the factory after GeneratedPluginRegistrant.register(with:).
3. Android — same callback, Kotlin
processTexture must run on the current GL thread. Never hop to the UI isolate.
4. Tear down
enableCustomVideoProcess(false)(or leave the room)engine.dispose()
Photos vs live video
Do not
- Push pixels or texture ids from Dart every frame — Flutter and TRTC do not share a GL context with Dart.
- Call
processTextureoff the GL thread. - Treat
FBEngineas a process-wide singleton. Create it withFBEngine.createanddispose()when the call ends.

