/// <summary> /// Stops streaming from the source /// </summary> public override void Stop() { if (IsDisposed || State < StreamState.Started) { return; } if (Common.IDisposedExtensions.IsNullOrDisposed(RtspClient).Equals(false)) { if (RtspClient.IsPlaying) { RtspClient.StopPlaying(); } else if (RtspClient.IsConnected) { RtspClient.Disconnect(); } //Client Dispose } base.Stop(); m_StartedTimeUtc = null; }
private void PlayButton_Click(object sender, EventArgs e) { if (ClientThreadProc != null) { if (m_rtspClient != null) { m_rtspClient.StopPlaying(); m_rtspClient = null; } Media.Common.Extensions.Thread.ThreadExtensions.TryAbortAndFree(ref ClientThreadProc); ClientThreadProc = null; GC.WaitForPendingFinalizers(); PlayButton.Text = "Start"; } else { m_rtspClient = new RtspClient(URLTextBox.Text, RtspClient.ClientProtocolType.Tcp); //Client.DisableKeepAliveRequest = checkBox1.Checked; m_rtspClient.OnConnect += RTSPClient_OnConnect; ClientThreadProc = new Thread(() => m_rtspClient.Connect()); ClientThreadProc.Start(); PlayButton.Text = "Stop"; } }
/// <summary> /// Stops streaming from the source /// </summary> public override void Stop() { if (RtspClient != null) { if (RtspClient.IsPlaying) { RtspClient.StopPlaying(); } else if (RtspClient.IsConnected) { RtspClient.Disconnect(); } RtspClient.OnConnect -= RtspClient_OnConnect; RtspClient.OnDisconnect -= RtspClient_OnDisconnect; RtspClient.OnPlay -= RtspClient_OnPlay; RtspClient.OnStop -= RtspClient_OnStop; } base.Stop(); m_StartedTimeUtc = null; }
/// <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 override void Dispose() { _disposeEvent.Set(); _thread.Join(500); if (_client != null) { _client.StopPlaying(); } _client = null; }
/// <summary> /// Beings streaming from the source /// </summary> public override void Start() { if (IsDisposed || State >= StreamState.StopRequested) { return; } //May have to re-create client. try { RtspClient.Connect(); } catch (Exception ex) { Common.ILoggingExtensions.LogException(RtspClient.Logger, ex); RtspClient.StopPlaying(); RtspClient.Disconnect(); } }
public void Stop() { Trace.WriteLine("RtspHandler::Stop()"); //_rtspClient.Client.ThreadEvents = false; _rtspClient.StopPlaying(); }
public void Stop() { _client.StopPlaying(); }