推流,就是將採集到的音頻,視頻數據經過流媒體協議發送到流媒體服務器。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;