/// <summary> /// Stops the recording. /// </summary> /// <param name="campusId">The campus id.</param> /// <param name="label">The label.</param> /// <param name="app">The app.</param> /// <param name="streamName">Name of the stream.</param> /// <param name="recordingName">Name of the recording.</param> /// <param name="personId">The person id.</param> /// <returns></returns> public Recording StopRecording(int?campusId, string label, string app, string streamName, string recordingName, int?personId) { Rock.Net.RockWebResponse response = SendRecordingRequest(app, streamName, recordingName, "stop"); if (response != null && response.HttpStatusCode == System.Net.HttpStatusCode.OK) { IQueryable <Recording> recordings = Queryable(). Where(r => r.CampusId == campusId && r.Label == label && r.App == app && r.StreamName == streamName && r.RecordingName == recordingName && r.StartTime != null && r.StopTime == null); Recording stoppedRecording = new Recording(); DateTime stopTime = DateTime.Now; string responseMessage = ParseResponse(response.Message); foreach (var recording in recordings.OrderBy(r => r.StartTime).ToList()) { recording.StopTime = stopTime; recording.StopResponse = responseMessage; this.Save(recording, personId); stoppedRecording = recording; } return(stoppedRecording); } return(null); }
/// <summary> /// Sends the request. /// </summary> /// <param name="action">The action.</param> /// <param name="recording">The recording.</param> /// <returns></returns> public bool SendRequest(string action, Recording recording) { try { Rock.Net.RockWebResponse response = RecordingService.SendRecordingRequest(recording.App, recording.StreamName, recording.RecordingName, action.ToLower()); if (response != null && response.HttpStatusCode == System.Net.HttpStatusCode.OK) { if (action.ToLower() == "start") { recording.StartTime = DateTime.Now; recording.StartResponse = RecordingService.ParseResponse(response.Message); } else { recording.StopTime = DateTime.Now; recording.StopResponse = RecordingService.ParseResponse(response.Message); } return(true); } } catch (System.Exception ex) { mdGridWarning.Show(ex.Message, ModalAlertType.Alert); } return(false); }
/// <summary> /// Sends the request. /// </summary> /// <param name="action">The action.</param> /// <param name="recording">The recording.</param> /// <returns></returns> public bool SendRequest(string action, Recording recording) { Rock.Net.RockWebResponse response = RecordingService.SendRecordingRequest(recording.App, recording.StreamName, recording.RecordingName, action.ToLower()); if (response != null && response.HttpStatusCode == System.Net.HttpStatusCode.OK) { if (action.ToLower() == "start") { recording.StartTime = DateTime.Now; recording.StartResponse = RecordingService.ParseResponse(response.Message); } else { recording.StopTime = DateTime.Now; recording.StopResponse = RecordingService.ParseResponse(response.Message); } return(true); } return(false); }
/// <summary> /// Starts the recording. /// </summary> /// <param name="campusId">The campus id.</param> /// <param name="label">The label.</param> /// <param name="app">The app.</param> /// <param name="streamName">Name of the stream.</param> /// <param name="recordingName">Name of the recording.</param> /// <param name="personId">The person id.</param> /// <returns></returns> public Recording StartRecording(int?campusId, string label, string app, string streamName, string recordingName, int?personId) { Rock.Net.RockWebResponse response = SendRecordingRequest(app, streamName, recordingName, "start"); if (response != null && response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Recording recording = new Recording(); this.Add(recording, personId); recording.CampusId = campusId; recording.Date = DateTime.Today; recording.Label = label; recording.App = app; recording.StreamName = streamName; recording.RecordingName = recordingName; recording.StartTime = DateTime.Now; recording.StartResponse = ParseResponse(response.Message); this.Save(recording, personId); return(recording); } return(null); }