🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
* [ ] 设置代理对象 遵循TXVideoCustomProcessDelegate // 推流器初始化 ``` TXLivePush *pusher = [[TXLivePush alloc] initWithConfig:config]; pusher.videoProcessDelegate= self; ``` l在代理方法即视频渲染方法中赋值,如下所示: ``` - (GLuint)onPreProcessTexture:(GLuint)texture width:(CGFloat)width height:(CGFloat)height{ int newTexture = [self.beautyManager getTexrureProcessWithTexture:texture width:width height:height]; return newTexture; } ``` 说明: 1.如果是开启直播有镜像效果的话,设置 ``` [_txLivePublisher setMirror:YES]; ``` 如果初始化美颜UIisTXSDK参数传入的是YES,则需要实现腾讯的美颜方法,具体如下: ``` #pragma mark - MHMenuView Delegate - (void)beautyEffectWithLevel:(NSInteger)beauty whitenessLevel:(NSInteger)white ruddinessLevel:(NSInteger)ruddiness {     TXBeautyManager *manager = [_pushergetBeautyManager]; [manager setBeautyStyle:TXBeautyStyleSmooth]; [manager setBeautyLevel:beauty]; [manager setWhitenessLevel:white]; [manager setRuddyLevel:ruddiness]; } ``` 如果isTXSDK传入NO,则不需要实现该代理方法,则走的是美狐的美颜方法。 2.如果需要适配性能较低手机,需要更换成以下调用方式 1.在ViewController中添加布尔值BOOL _needScale; 2.在ViewController中添加checkDeivice方法: ```  - (void)checkDevice{ /*获取当前机型,判断是否为 iPhone7 及以上*/ struct utsname systemInfo; uname(&systemInfo); NSString *platform = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; NSArray *symbols = [platform componentsSeparatedByString:@","]; if(symbols.count > 0){ NSCharacterSet *characterSet = [[NSCharacterSet decimalDigitCharacterSet] invertedSet]; NSInteger number = [[[symbols[0] componentsSeparatedByCharactersInSet:characterSet] componentsJoinedByString:@""] integerValue]; //iPhone9,1 -> iPhone 7 if(number >= 9){ _needScale = NO; }else{ _needScale = YES; } } } ``` 3.在回调中判断是否需要缩放 ``` -(GLuint)onPreProcessTexture:(GLuint)texture width:(CGFloat)widthheight:(CGFloat)height{ GLuint newTexture = texture; if (_needScale){ newTexture = [_beautyManager processWithTexture:texture width:width height:height scale:0.75]; }else{ [self.beautyManager processWithTexture:texture width:width height:height]; } return newTexture ; } ```