void RtspClient_OnConnect(RtspClient sender, object args) { if (RtspClient.IsConnected.Equals(false) || State == StreamState.StartRequested) { return; } //Not quite ready yet. State = StreamState.StartRequested; try { //Start playing RtspClient.StartPlaying(MediaStartTime, MediaEndTime, SpecificMediaTypes); } catch (Exception ex) { //StoPlaying and Disconnect when an exception occurs. RtspClient.Disconnect(true); Common.ILoggingExtensions.LogException(RtspClient.Logger, ex); State = StreamState.Started; } }
void RtspClient_OnConnect(RtspClient sender, object args) { if (RtspClient != sender || false == RtspClient.IsConnected || RtspClient.IsPlaying) { return; } RtspClient.OnConnect -= RtspClient_OnConnect; try { //Start listening is not already playing if (false == RtspClient.IsPlaying) { RtspClient.StartPlaying(MediaStartTime, MediaEndTime, SpecificMediaType); } //Set the time for stats m_StartedTimeUtc = DateTime.UtcNow; //Call base to set started etc. base.Start(); } catch { //Indicate not ready Ready = false; } }
/// <summary> /// Beings streaming from the source /// </summary> public override void Start() { if (IsDisposed) { return; } if (false == RtspClient.IsConnected) { RtspClient.OnConnect += RtspClient_OnConnect; RtspClient.OnDisconnect += RtspClient_OnDisconnect; RtspClient.OnPlay += RtspClient_OnPlay; RtspClient.OnPause += RtspClient_OnPausing; RtspClient.OnStop += RtspClient_OnStop; try { RtspClient.Connect(); } catch { RtspClient.StopPlaying(); } //Stop stop } else if (false == RtspClient.IsPlaying) { try { //Start the playing again RtspClient.StartPlaying(MediaStartTime, MediaEndTime, SpecificMediaType); //Indicate when the stream was started. m_StartedTimeUtc = DateTime.UtcNow; //Call base to set started etc. base.Start(); } catch { RtspClient.StopPlaying(); } //Not stop } }
public void Play() { Trace.WriteLine("RtspHandler::Play()"); _playStarted.OnNext(false); if (!IsConnected) { Connect(); } _videoStreamInfo.Reset(); _audioStreamInfo.Reset(); _rtspClient.StartPlaying(); //_rtspClient.Client.ThreadEvents = true; }
internal void client_OnConnect(RtspClient sender, object args) { sender.OnPlay += sender_OnPlay; sender.OnRequest += sender_OnRequest; sender.OnResponse += sender_OnResponse; try { if (numericUpDown1.Value == 0) { sender.StartPlaying(); } else { sender.StartPlaying(TimeSpan.FromSeconds((double)numericUpDown1.Value)); } } catch { return; } }
public RtspStream(string url) { _disposeEvent.Reset(); _client = new RtspClient(url, RtspClient.ClientProtocolType.Tcp); _client.OnConnect += Client_OnConnect; _client.OnPlay += Client_OnPlay; //_client.Client.RtpPacketReceieved += Client_RtpPacketReceieved; _client.Client.RtpFrameChanged += Client_RtpFrameChanged; _client.StartPlaying(); _thread = new Thread(run) { IsBackground = true }; _thread.Start(); }
private void RTSPClient_OnConnect(RtspClient sender, object args) { sender.OnPlay += RTSPClient_OnPlay; sender.OnRequest += RTSPClient_OnRequest; sender.OnResponse += RTSPClient_OnResponse; try { sender.StartPlaying(); } catch { return; } }
public void Start() { _client.StartPlaying(); }
void client_OnConnect(RtspClient sender, object args) { sender.OnPlay += sender_OnPlay; sender.OnRequest += sender_OnRequest; sender.OnResponse += sender_OnResponse; try { if (numericUpDown1.Value == 0) sender.StartPlaying(); else sender.StartPlaying(TimeSpan.FromSeconds((double)numericUpDown1.Value)); } catch { return; } }