Esempio n. 1
0
        public IActionResult Index()
        {
            bool   liveEncoding = false;
            string liveEventUrl = string.Empty;
            string authToken    = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                LiveEvent[] liveEvents = mediaClient.GetAllEntities <LiveEvent>(MediaEntity.LiveEvent);
                foreach (LiveEvent liveEvent in liveEvents)
                {
                    if (liveEvent.Encoding.EncodingType.HasValue && liveEvent.Encoding.EncodingType != LiveEventEncodingType.None)
                    {
                        liveEncoding = true;
                    }
                    if (liveEvent.ResourceState == LiveEventResourceState.Running)
                    {
                        liveEventUrl = liveEvent.Preview.Endpoints[0].Url;
                    }
                }
            }
            ViewData["liveEncoding"] = liveEncoding;
            ViewData["liveEventUrl"] = liveEventUrl;
            return(View());
        }
Esempio n. 2
0
        public IActionResult Index(string transformName, string jobName)
        {
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                Job[] jobs = new Job[] { };
                if (!string.IsNullOrEmpty(jobName))
                {
                    Job job = mediaClient.GetEntity <Job>(MediaEntity.TransformJob, jobName, transformName);
                    if (job != null)
                    {
                        jobs = new Job[] { job };
                    }
                }
                else
                {
                    jobs = mediaClient.GetAllEntities <Job, Transform>(MediaEntity.TransformJob, MediaEntity.Transform);
                }
                ViewData["transformJobs"]     = jobs;
                ViewData["transforms"]        = GetTransforms(mediaClient);
                ViewData["streamingPolicies"] = GetStreamingPolicies(mediaClient);
            }
            return(View());
        }
Esempio n. 3
0
        public IActionResult FiltersAsset()
        {
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                ViewData["filtersAsset"] = mediaClient.GetAllEntities <AssetFilter, Asset>(MediaEntity.FilterAsset, MediaEntity.Asset);
            }
            return(View());
        }
Esempio n. 4
0
        public IActionResult StreamingLocators()
        {
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                ViewData["streamingLocators"] = mediaClient.GetAllEntities <StreamingLocator>(MediaEntity.StreamingLocator);
            }
            return(View());
        }
Esempio n. 5
0
        public IActionResult ContentKeyPolicies()
        {
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                ViewData["contentKeyPolicies"] = mediaClient.GetAllEntities <ContentKeyPolicy>(MediaEntity.ContentKeyPolicy);
            }
            return(View());
        }
Esempio n. 6
0
        public IActionResult StreamingFiltersAccount()
        {
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                ViewData["streamingFiltersAccount"] = mediaClient.GetAllEntities <AccountFilter>(MediaEntity.StreamingFilterAccount);
            }
            return(View());
        }
Esempio n. 7
0
        public IActionResult Index()
        {
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                ViewData["transforms"] = mediaClient.GetAllEntities <Transform>(MediaEntity.Transform);
            }
            return(View());
        }
Esempio n. 8
0
        public IActionResult LiveEventOutputs()
        {
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                ViewData["liveEvents"]       = LiveController.GetLiveEvents(mediaClient);
                ViewData["liveEventOutputs"] = mediaClient.GetAllEntities <LiveOutput, LiveEvent>(MediaEntity.LiveEventOutput, MediaEntity.LiveEvent);
            }
            return(View());
        }
Esempio n. 9
0
        public IActionResult LiveEvents()
        {
            List <MediaLiveEvent> mediaLiveEvents = new List <MediaLiveEvent>();
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                LiveEvent[] liveEvents = mediaClient.GetAllEntities <LiveEvent>(MediaEntity.LiveEvent);
                foreach (LiveEvent liveEvent in liveEvents)
                {
                    MediaLiveEvent mediaLiveEvent = new MediaLiveEvent(mediaClient, liveEvent);
                    mediaLiveEvents.Add(mediaLiveEvent);
                }
                ViewData["streamingPolicies"] = JobController.GetStreamingPolicies(mediaClient);
            }
            ViewData["liveEvents"] = mediaLiveEvents.ToArray();
            return(View());
        }
Esempio n. 10
0
        internal static SelectListItem[] GetStreamingPolicies(MediaClient mediaClient)
        {
            List <SelectListItem> policies = new List <SelectListItem>
            {
                new SelectListItem()
            };

            StreamingPolicy[] streamingPolicies = mediaClient.GetAllEntities <StreamingPolicy>(MediaEntity.StreamingPolicy);
            foreach (StreamingPolicy streamingPolicy in streamingPolicies)
            {
                SelectListItem policy = new SelectListItem()
                {
                    Text  = Constant.TextFormatter.FormatValue(streamingPolicy.Name),
                    Value = streamingPolicy.Name
                };
                policies.Add(policy);
            }
            return(policies.ToArray());
        }
Esempio n. 11
0
        private static SelectListItem[] GetTransforms(MediaClient mediaClient)
        {
            List <SelectListItem> transforms = new List <SelectListItem>
            {
                new SelectListItem()
            };

            Transform[] mediaTransforms = mediaClient.GetAllEntities <Transform>(MediaEntity.Transform);
            foreach (Transform mediaTransform in mediaTransforms)
            {
                SelectListItem transform = new SelectListItem()
                {
                    Text  = Constant.TextFormatter.FormatValue(mediaTransform.Name),
                    Value = mediaTransform.Name
                };
                transforms.Add(transform);
            }
            return(transforms.ToArray());
        }
Esempio n. 12
0
        internal static SelectListItem[] GetLiveEvents(MediaClient mediaClient)
        {
            List <SelectListItem> liveEvents = new List <SelectListItem>
            {
                new SelectListItem()
            };

            LiveEvent[] mediaLiveEvents = mediaClient.GetAllEntities <LiveEvent>(MediaEntity.LiveEvent);
            foreach (LiveEvent mediaLiveEvent in mediaLiveEvents)
            {
                SelectListItem liveEvent = new SelectListItem()
                {
                    Text  = Constant.TextFormatter.FormatValue(mediaLiveEvent.Name),
                    Value = mediaLiveEvent.Name
                };
                liveEvents.Add(liveEvent);
            }
            return(liveEvents.ToArray());
        }
Esempio n. 13
0
        public IActionResult LiveEvents()
        {
            List <MediaLiveEvent> mediaLiveEvents = new List <MediaLiveEvent>();
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                LiveEvent[] liveEvents = mediaClient.GetAllEntities <LiveEvent>(MediaEntity.LiveEvent);
                foreach (LiveEvent liveEvent in liveEvents)
                {
                    MediaLiveEvent mediaLiveEvent = new MediaLiveEvent(mediaClient, liveEvent);
                    mediaLiveEvents.Add(mediaLiveEvent);
                }
                ViewData["streamingPolicies"] = JobController.GetStreamingPolicies(mediaClient);
            }
            ViewData["liveEvents"]    = mediaLiveEvents.ToArray();
            ViewData["inputStreamId"] = AuthToken.GetClaimValue(authToken, Constant.UserAttribute.MediaAccountSubscriptionId);
            return(View());
        }
Esempio n. 14
0
        public IActionResult Index()
        {
            string liveEventName       = string.Empty;
            bool   liveEventEncoding   = false;
            bool   liveEventLowLatency = false;
            string liveEventPreviewUrl = string.Empty;
            string liveEventOutputUrl  = string.Empty;
            string authToken           = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                LiveEvent[] liveEvents = mediaClient.GetAllEntities <LiveEvent>(MediaEntity.LiveEvent);
                foreach (LiveEvent liveEvent in liveEvents)
                {
                    if (liveEvent.ResourceState == LiveEventResourceState.Running && string.IsNullOrEmpty(liveEventPreviewUrl))
                    {
                        liveEventName = liveEvent.Name;
                        if (liveEvent.Encoding.EncodingType.HasValue && liveEvent.Encoding.EncodingType != LiveEventEncodingType.None)
                        {
                            liveEventEncoding = true;
                        }
                        if (liveEvent.StreamOptions.Contains(StreamOptionsFlag.LowLatency))
                        {
                            liveEventLowLatency = true;
                        }
                        liveEventPreviewUrl = liveEvent.Preview.Endpoints[0].Url;
                        liveEventOutputUrl  = mediaClient.GetLiveOutputUrl(liveEvent);
                    }
                }
            }
            ViewData["liveEventName"]       = liveEventName;
            ViewData["liveEventEncoding"]   = liveEventEncoding;
            ViewData["liveEventLowLatency"] = liveEventLowLatency;
            ViewData["liveEventPreviewUrl"] = liveEventPreviewUrl;
            ViewData["liveEventOutputUrl"]  = liveEventOutputUrl;
            return(View());
        }