
pod install。# 将S1-07替换成您购买的套餐,注意TEBeautyKit和TencentEffect要使用相同套餐pod 'TEBeautyKit/S1-07', :podspec => 'https://mediacloud-76607.gzc.vod.tencent-cloud.com/TencentEffect/iOS/TEBeautyKit/latest/TEBeautyKit.podspec'pod 'TencentEffect_S1-07', :podspec => 'https://mediacloud-76607.gzc.vod.tencent-cloud.com/TencentEffect/iOS/podspec/latest/TencentEffect_S1-07.podspec'
/// 创建adapter对象- (TEBeautyTRTCAdapter *)trtcAdapter {if (!_trtcAdapter) {_trtcAdapter = [[TEBeautyTRTCAdapter alloc] init];}return _trtcAdapter;}/// 绑定美颜- (void)bindAdapter {__weak typeof(self)weakSelf = self;[self.trtcAdapter bind:self.trtcCloud onCreatedXmagicApi:^(XMagic * _Nullable xmagicApi) {__strong typeof(weakSelf)strongSelf = weakSelf;strongSelf.teBeautyKit.xmagicApi = xmagicApi;strongSelf.tePanelView.teBeautyKit = strongSelf.teBeautyKit;[strongSelf.tePanelView setDefaultBeauty];} onDestroyXmagicApi:^{__strong typeof(weakSelf)strongSelf = weakSelf;[strongSelf.teBeautyKit onDestroy];strongSelf.teBeautyKit = nil;}];}
/// 通知adapter前后置摄像头,是否编码镜像[self.trtcAdapter notifyCameraChanged:self.isFrontCamera isEncoderMirror:self.isEncoderMirror];/// 通知adapter屏幕方向改变[self.trtcAdapter setDeviceOrientation:currOrientation];
[self.trtcAdapter unbind];self.trtcAdapter = nil;
- (void)initXMagic {__weak typeof(self)weakSelf = self;[TEBeautyKit createXMagic:EFFECT_MODE_PRO onInitListener:^(TEBeautyKit * _Nullable beautyKit) {__strong typeof(weakSelf)strongSelf = weakSelf;strongSelf.teBeautyKit = beautyKit;strongSelf.tePanelView.teBeautyKit = strongSelf.teBeautyKit;[strongSelf.tePanelView setDefaultBeauty];}];}
- (uint32_t)onProcessVideoFrame:(TRTCVideoFrame *)srcFrame dstFrame:(TRTCVideoFrame *)dstFrame {YTProcessOutput *output = [self.teBeautyKit processTexture:srcFrame.textureIdtextureWidth:srcFrame.widthtextureHeight:srcFrame.heightwithOrigin:YtLightImageOriginTopLeftwithOrientation:YtLightCameraRotation0];dstFrame.textureId = output.textureData.texture;return 0;}
- (void)destroyXMagic {[self.teBeautyKit onDestroy];self.teBeautyKit = nil;}
文档反馈