配置是用专业版demo上代码写的
- (TXLivePush *)push
{
if(!_push)
{
// config初始化
TXLivePushConfig *config = [[TXLivePushConfig alloc] init];
config.pauseFps = 5;
config.pauseTime = 300;
config.pauseImg = [UIImage imageNamed:@"activity_pausePublish"];
config.touchFocus = [PushMoreSettingViewController isEnableTouchFocus];
config.enableZoom = [PushMoreSettingViewController isEnableVideoZoom];
config.enablePureAudioPush = [PushMoreSettingViewController isEnablePureAudioPush];
config.enableAudioPreview = [PushSettingViewController getEnableAudioPreview];
config.frontCamera = NO; //前后置摄像头
if ([PushMoreSettingViewController isEnableWaterMark]) {
config.watermark = [UIImage imageNamed:@"activity_watermark"];
config.watermarkPos = CGPointMake(10, 10);
}
_push = [[TXLivePush alloc] initWithConfig:config];
[_push setReverbType:[PushSettingViewController getReverbType]];
[_push setVoiceChangerType:[PushSettingViewController getVoiceChangerType]];
[_push toggleTorch:[PushMoreSettingViewController isOpenTorch]];
[_push setMirror:[PushMoreSettingViewController isMirrorVideo]];
[_push setMute:[PushMoreSettingViewController isMuteAudio]];
[_push setVideoQuality:[PushSettingViewController getVideoQuality] adjustBitrate:[PushSettingViewController getBandWidthAdjust] adjustResolution:NO];
// 修改软硬编需要在setVideoQuality之后设置config.enableHWAcceleration
config.enableHWAcceleration = [PushSettingViewController getEnableHWAcceleration];
// 横屏推流需要先设置config.homeOrientation = HOME_ORIENTATION_RIGHT,然后再[pusher setRenderRotation:90]
config.homeOrientation = ([PushMoreSettingViewController isHorizontalPush] ? HOME_ORIENTATION_RIGHT : HOME_ORIENTATION_DOWN);
if ([PushMoreSettingViewController isHorizontalPush]) {
[_push setRenderRotation:90];
} else {
[_push setRenderRotation:0];
}
[_push setLogViewMargin:UIEdgeInsetsMake(120, 10, 60, 10)];
[_push showVideoDebugLog:[PushMoreSettingViewController isShowDebugLog]];
[_push setEnableClockOverlay:[PushMoreSettingViewController isEnableDelayCheck]];
[_push setConfig:config];
}
return _push;
}
相似问题