1、创建视频视图
//视频的视图
UIView *displayView = [[UIView alloc] initWithFrame:self.view.bounds];
self.displayView = displayView;
[self.view addSubview:self.displayView];2、创建推流会话
#pragma mark ---- <创建会话>
- (LFLiveSession*)session{
if(!_session){
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfigurationForQuality:LFLiveVideoQuality_Low3]];
_session.running = YES;
_session.preView = self.displayView;
}
return _session;
}3、开始直播推流
#pragma mark - buttonAction
-(void)startLiveButtonAction:(UIButton *)button{
_startLiveButton.enabled = NO;
[self performSelector:@selector(changeStartButtonEnable) withObject:nil afterDelay:0.5];
_startLiveButton.selected = !_startLiveButton.selected;
if(_startLiveButton.selected){
[_startLiveButton setTitle:Localized(@"JXLiveVC_StopLive") forState:UIControlStateNormal];
LFLiveStreamInfo *stream = [LFLiveStreamInfo new];
stream.url = self.liveUrl;
_session.showDebugInfo = YES;
[_session startLive:stream];
}else{
[_startLiveButton setTitle:Localized(@"JXLiveVC_StartLive") forState:UIControlStateNormal];
[_session stopLive];
}
}4、美颜
-(void)beautyButtonAction:(UIButton *)button{
_session.beautyFace = !_session.beautyFace;
_beautyButton.selected = !_session.beautyFace;
}
1514

被折叠的 条评论
为什么被折叠?



