private string StartRtspStream(string filePath, string rtspUrlSuffix) { string streamUri = null; // Ensure RTSP-Server is up and running, and we are registered if (RegisterApplicationInRtspServer(false)) { try { using (StreamingServiceAgent streamingServiceAgent = new StreamingServiceAgent()) { streamUri = streamingServiceAgent.AddStream(filePath, rtspUrlSuffix); } } catch (Exception ex) { TvLibrary.Log.Log.Error(ex.Message); } } return(streamUri); }
private void StopRtspStream(LiveStream stream) { // Ensure RTSP-Server is up and running, and we are registered if (RegisterApplicationInRtspServer(false)) { try { using (StreamingServiceAgent streamingServiceAgent = new StreamingServiceAgent()) { // "rtsp://MEDIASERVER:554/Argus-Card2-2" int index = stream.RtspUrl.LastIndexOf('/') + 1; string rtspUrlSuffix = stream.RtspUrl.Substring(index); streamingServiceAgent.RemoveStream(rtspUrlSuffix); //Logger.Info("Stopped RTSP-Stream " + rtspUrlSuffix); } } catch (Exception ex) { TvLibrary.Log.Log.Error(ex.Message); } } }