企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
 在TTTRtcEngineEventHandler的回调中进行渲染(TTTRtcEngineEventHandler的使用请阅读三体云官方文档)。 设置SurfaceView的监听,在surfaceview创建回调中新建MHBeautyManager,在surfaceview销毁回调中销毁MHBeautyManager。 三体云平台基础美颜回调使用使用美狐sdk自带基础美颜功能接口setMhBeauty();参考章节(**不同直播SDK设置基础美颜方式**)。 ``` // 创建 SurfaceView SurfaceView mSurfaceView = mTTTEngine.CreateRendererView(this); // 配置 SurfaceView mTTTEngine.setupLocalVideo(new VideoCanvas(0, Constants.RENDER_MODE_HIDDEN, mSurfaceView), getRequestedOrientation()); //将surfaceview添加进预览布局中 ((ViewGroup)findViewById(R.id.preview_container)).addView(mSurfaceView); // 开始预览 mTTTEngine.startPreview(); //设置surfaceView事件回调 mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { if (mhBeautyManager != null) { mhBeautyManager.destroy(); } mhBeautyManager = new MHBeautyManager(getApplicationContext(), true); mhBeautyManager.setBeautyDataModel(BeautyDataModel.getInstance()); if (beautyViewHolder != null){ beautyViewHolder.setMhBeautyManager(mhBeautyManager); } LocalConfig.mMHBeautyManager = mhBeautyManager; } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {} @Override public void surfaceDestroyed(SurfaceHolder holder) { if (mhBeautyManager != null) { mhBeautyManager.destroy(); } mhBeautyManager = null; }); ``` 在继承TTTRtcEngineEventHandler的类回调中,进行渲染 ```     @Override public void onLocalVideoFrameCaptured(TTTVideoFrame frame) {         if (LocalConfig.mMHBeautyManager != null) { LocalConfig.mMHBeautyManager.render(frame.textureID,frame.stride,frame.height);         } } ```