예제 #1
0
        /// <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;
        }
예제 #2
0
        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";
            }
        }
예제 #3
0
        /// <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;
        }
예제 #4
0
        /// <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
            }
        }
예제 #5
0
 public override void Dispose()
 {
     _disposeEvent.Set();
     _thread.Join(500);
     if (_client != null)
     {
         _client.StopPlaying();
     }
     _client = null;
 }
예제 #6
0
        /// <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();
            }
        }
예제 #7
0
 public void Stop()
 {
     Trace.WriteLine("RtspHandler::Stop()");
     //_rtspClient.Client.ThreadEvents = false;
     _rtspClient.StopPlaying();
 }
예제 #8
0
 public void Stop()
 {
     _client.StopPlaying();
 }