Because the Flutter OpenGL environment is isolated from a native environment, you cannot integrate the Tencent Effect SDK directly into Flutter. You need to establish connections between them at the native side.
API defined at the Tencent Effect side
public interface ITXCustomBeautyProcesserFactory {
/**
* Create an instance
* @return
*/
ITXCustomBeautyProcesser createCustomBeautyProcesser();
/**
* Terminate an instance (this API must be called in the OpenGL thread)
*/
void destroyCustomBeautyProcesser();
}
public interface ITXCustomBeautyProcesser {
// Get the pixel formats supported for video frames. Tencent Effect supports OpenGL 2D textures.
TXCustomBeautyPixelFormat getSupportedPixelFormat();
// Get the container formats supported for video frames. Tencent Effect supports V2TXLiveBufferTypeTexture, which delivers the best performance and has the smallest impact on video quality.
TXCustomBeautyBufferType getSupportedBufferType();
// Call this API in the OpenGL thread (`srcFrame` must include RGBA textures and the width and height). After processing, the texture object will be included in `texture.textureId` of `dstFrame`.
void onProcessVideoFrame(TXCustomBeautyVideoFrame srcFrame, TXCustomBeautyVideoFrame dstFrame);
}
com.tencent.effect.tencent_effect_flutter.XmagicProcesserFactory
, the implementation class of ITXCustomBeautyProcesserFactory
with TRTC (at the native side).Flutter
layer, provide Future<v2txlivecode> enableCustomVideoProcess(bool enable)
, which is used to enable or disable custom effects.The abstraction layer dependency provided by Tencent Effect
///
implementation 'com.tencent.liteav:custom-video-processor:latest.release'
Was this page helpful?