Esempio n. 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;
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 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;
        }
Esempio n. 4
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();
            }
        }
Esempio n. 5
0
 public void Disconnect()
 {
     Trace.WriteLine("RtspHandler::Disconnect()");
     _rtspClient.Client.RtpPacketReceieved -= OnRtpPacketReceieved;
     _rtspClient.Disconnect();
 }