Push flow of host using ffmpeg ffplay and Nginx RTMP mode
The agreement with RTMP,
Push the flow with the content of the Video and Audio,
The following is the session Settings,
- (LFLiveSession *) session {
If (_session==nil) {
LFLiveAudioConfiguration * audioConfiguration=[LFLiveAudioConfiguration defaultConfigurationForQuality: LFLiveAudioQuality_Low];
AudioConfiguration. NumberOfChannels=1;
LFLiveVideoConfiguration * videoConfiguration;
VideoConfiguration=[LFLiveVideoConfiguration defaultConfigurationForQuality: (_frameQuality==0)? LFLiveVideoQuality_High2: (_frameQuality==1)? LFLiveVideoQuality_Medium2: LFLiveVideoQuality_Low2 outputImageOrientation: UIInterfaceOrientationLandscapeRight];
VideoConfiguration. Autorotate=YES;
_session=[[LFLiveSession alloc] initWithAudioConfiguration: audioConfiguration videoConfiguration: videoConfiguration captureType: _mic? LFLiveInputMaskAll: LFLiveInputMaskVideo];
_session. Delegate=self;
_session. ShowDebugInfo=YES;
}
Return _session;
}
The following is part of the push flow call
[_recorder startCaptureWithHandler: ^ (CMSampleBufferRef _Nonnull sampleBuffer, RPSampleBufferType bufferType, NSError * _Nullable error) {
If (error==nil) {
The switch (bufferType) {
Case RPSampleBufferTypeVideo: {
//NSLog (@ "video content");
[self. Tool sendVideoBuffer: sampleBuffer];
}
break;
Case RPSampleBufferTypeAudioApp: {
//NSLog (@ "App sound");
[self. Tool sendAudioBuffer: sampleBuffer];
}
break;
Case RPSampleBufferTypeAudioMic: {
NSLog (@ "microphone sound");
//[self. Tool sendAudioBuffer: sampleBuffer];
}
break;
Default:
break;
}
}
} completionHandler: ^ (NSError * _Nullable error) {
If (error!=nil) {
NSLog (@ "error=% @", [the error description]);
}
}];