ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
- 设置代理对象(set the proxy object) ``` TXVideoCustomProcessDelegate ``` ``` TXLivePush *pusher = [[TXLivePush alloc] initWithConfig:config]; ``` ``` pusher.videoProcessDelegate = self; ``` - 在代理方法即视频渲染方法中赋值,如下所示(Assign values in the proxy method, i.e. video rendering method, as shown below): ``` - (GLuint)onPreProcessTexture:(GLuint)texture width:(CGFloat)width height:(CGFloat)height{ int newTexture = [self.beautyManager getTexrureProcessWithTexture:texture width:width height:height]; return newTexture; } ``` Tip: 1. 如果是开启直播有镜像效果的话,设置(if the live broadcast is enabled and has the image effect,set) ``` [_txLivePublisher setMirror:YES]; ``` 2. 如果调用腾讯的美颜,则需要实现代理方法,具体如下(If you call Tencent's beauty, you need to implement the proxy method, as follows:) ``` #pragma mark - MHMenuView Delegate - (void)beautyEffectWithLevel:(NSInteger)beauty whitenessLevel:(NSInteger)white ruddinessLevel:(NSInteger)ruddiness { TXBeautyManager \*manager = [_pusher getBeautyManager]; [manager setBeautyStyle:TXBeautyStyleSmooth]; [manager setBeautyLevel:beauty]; [manager setWhitenessLevel:white]; [manager setRuddyLevel:ruddiness]; } ``` 1. 如果需要适配性能较低手机,需要更换成以下调用方式( If you need to adapt to a mobile phone with low performance, you need to replace it with the following calling method) 1\. ViewController add BOOL \_needScale; 2\. ViewController add checkDeivice method: ``` - (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.在回调中判断是否需要缩放(Determine whether scaling is required in the callback) ``` -(GLuint)onPreProcessTexture:(GLuint)texture width:(CGFloat)width height:(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 ; } ```