public JsonResult CreateOutput(string eventName, string eventOutputName, string eventOutputDescription, string outputAssetName, string streamingPolicyName, int archiveWindowMinutes) { try { LiveOutput liveOutput; string authToken = HomeController.GetAuthToken(Request, Response); using (MediaClient mediaClient = new MediaClient(authToken)) { liveOutput = mediaClient.CreateLiveOutput(eventName, eventOutputName, eventOutputDescription, null, outputAssetName, archiveWindowMinutes); mediaClient.GetStreamingLocator(outputAssetName, outputAssetName, streamingPolicyName, null); } return(Json(liveOutput)); } catch (ValidationException ex) { Error error = new Error() { Type = HttpStatusCode.BadRequest, Message = ex.Message }; return(new JsonResult(error) { StatusCode = (int)error.Type }); } catch (ApiErrorException ex) { return(new JsonResult(ex.Response.Content) { StatusCode = (int)ex.Response.StatusCode }); } }
public JsonResult CreateOutput(string eventName, string eventOutputName, string eventOutputDescription, string outputAssetName, int archiveWindowMinutes) { try { LiveOutput liveOutput; string authToken = HomeController.GetAuthToken(Request, Response); using (MediaClient mediaClient = new MediaClient(authToken)) { liveOutput = mediaClient.CreateLiveOutput(eventName, eventOutputName, eventOutputDescription, outputAssetName, archiveWindowMinutes); } return(Json(liveOutput)); } catch (ApiErrorException ex) { return(new JsonResult(ex.Response.Content) { StatusCode = (int)ex.Response.StatusCode }); } }