FacebetterPlugin.processTexture on the vendor SDK’s native GL thread, then write the output texture back.
Shared contract
Do not call
processFile / processImageBytes / processImageFile / processImageToUiImage on the live engine.
Do not: push pixels or texture ids from Dart every frame; call
processTexture off the GL thread; treat FBEngine as a process-wide singleton.
TRTC (Tencent)
Prerequisites:tencent_trtc_cloud (or native TRTC) and facebetter_flutter: ^2.0.0. When enabling custom preprocess, use Texture2D + Texture buffer, not YUV / PixelBuffer.
After creating the engine in Dart, enable custom process (API name may vary by plugin version):
iOS — onProcessVideoFrame
tencent_trtc_cloud’s ITXCustomBeautyProcesser, keep Texture2D / Texture and call the same processTexture in the callback. Register the factory after GeneratedPluginRegistrant.register(with:).
Android — Kotlin
Tear-down
Agora
Same model as native: callFacebetterPlugin.processTexture inside the iOS / Android frame observer / custom preprocess callback; Dart only owns FBEngine parameters.
- Dart:
FBEngine.create(externalContext: true)and set beauty - Enable custom video processing or register a native observer per the Agora Flutter plugin (APIs vary by
agora_rtc_engineversion) - On a
GL_TEXTURE_2DtextureId, callprocessTextureand write back to the vendor frame
processTexture).
Tear-down: unregister Agora preprocess, then engine.dispose().
LiveKit
Again: Dart sets parameters, native processes textures.- Create an
externalContext: trueengine in Dart - Obtain texture frames via LiveKit Flutter / a native custom capturer or video processor
- Call
FacebetterPlugin.processTextureon the GL thread, then feed the output back into the LiveKit track
livekit_client and platform; texture rules: Android · LiveKit, iOS · LiveKit.

