public LiveBroadcast(IVideoEncoder videoEncoder, IAacEncoder aacEncoder) { State = RecAndLiveState.NotStart; _videoEncoder = videoEncoder; _aacEncoder = aacEncoder; _handle = VsNetRtmpSenderSdk.RtmpSender_AllocInstance(); VsNetRtmpSenderSdk.RtmpSender_SendInThread(_handle, true); }
public bool ResumeLive() { bool success = VsNetRtmpSenderSdk.RtmpSender_Resume(_handle) == 0; if (success) { State = RecAndLiveState.Started; } return(success); }
public bool StopLive() { if (!IsLive) { return(true); } if (_StopLive()) { State = RecAndLiveState.NotStart; IsLive = false; return(true); } return(false); }
public bool PauseLive() { _videoEncoder.PushingData -= VideoEncoderPushingData; _aacEncoder.PushingData -= AACEncoderPushingData; bool success = VsNetRtmpSenderSdk.RtmpSender_EndWrite(_handle) == 0; if (success) { State = RecAndLiveState.Pause; IsLive = false; } else { _videoEncoder.PushingData += VideoEncoderPushingData; _aacEncoder.PushingData += AACEncoderPushingData; } return(success); }
public bool StartLive(string liveServer, int liveServerPort, string liveChannel, string liveStreamName) { if (IsLive) { return(true); } _liveServer = liveServer; _liveServerPort = liveServerPort; _liveChannel = liveChannel; _liveStreamName = liveStreamName; if (StartLive()) { State = RecAndLiveState.Started; IsLive = true; return(true); } return(false); }