推流,就是将采集到的音频,视频数据经过流媒体协议发送到流媒体服务器。html
PS: 另外其实好多第三方的集成也很好用,可参考git
1 // 直播会话 2 - (LFLiveSession*)session { 3 if (!_session) { 4 _session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]]; 5 _session.preView = self; 6 _session.delegate = self; 7 } 8 return _session; 9 } 10 // 开始直播 11 - (void)startLive { 12 LFLiveStreamInfo *streamInfo = [LFLiveStreamInfo new]; 13 streamInfo.url = @"your server rtmp url"; 14 [self.session startLive:streamInfo]; 15 } 16 // 结束直播 17 - (void)stopLive { 18 [self.session stopLive]; 19 } 20 21 //MARK: - CallBack: 22 - (void)liveSession:(nullable LFLiveSession *)session liveStateDidChange: (LFLiveState)state; 23 - (void)liveSession:(nullable LFLiveSession *)session debugInfo:(nullable LFLiveDebug*)debugInfo; 24 - (void)liveSession:(nullable LFLiveSession*)session errorCode:(LFLiveSocketErrorCode)errorCode;