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); ILoggingExtensions.LogException(RtspClient.Logger, ex); State = StreamState.Started; } }
/// <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) { ILoggingExtensions.LogException(RtspClient.Logger, ex); RtspClient.StopPlaying(); RtspClient.Disconnect(); } }