예제 #1
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());
        }
예제 #2
0
        protected AudioDecoderConfigurationOptions GetAudioDecoderConfigurationOptions()
        {
            MediaClient mediaClient = MediaClient;
            AudioDecoderConfigurationOptions options = null;

            RunStep(() => { options = mediaClient.GetAudioDecoderConfigurationOptions(null, null); },
                    "Get Audio Decoder Configuration Options");
            DoRequestDelay();
            return(options);
        }
예제 #3
0
        public IActionResult Index()
        {
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                ViewData["entityCounts"] = Account.GetEntityCounts(mediaClient);
            }
            return(View());
        }
예제 #4
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());
        }
예제 #5
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());
        }
예제 #6
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());
        }
예제 #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());
        }
예제 #8
0
        public IActionResult Gallery()
        {
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                ViewData["mediaStreams"] = Media.GetAccountStreams(authToken, mediaClient);
            }
            return(View());
        }
예제 #9
0
        public JsonResult upload(string[] fileNames, string storageAccount, bool storageEncryption, string inputAssetName,
                                 bool multipleFileAsset, bool publishInputAsset, MediaAssetInput[] inputAssets, MediaJob mediaJob)
        {
            string      authToken   = homeController.GetAuthToken(this.Request, this.Response);
            MediaClient mediaClient = new MediaClient(authToken);

            inputAssets = Workflow.CreateInputAssets(authToken, mediaClient, storageAccount, storageEncryption, inputAssetName, multipleFileAsset, publishInputAsset, fileNames);
            object result = Workflow.SubmitJob(authToken, mediaClient, storageAccount, inputAssets, mediaJob);

            return(Json(result));
        }
예제 #10
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());
        }
예제 #11
0
        public static Asset CreateAsset([ActivityTrigger] DurableActivityContext context)
        {
            ValueTuple <MediaWorkflowManifest, string> jobInput = context.GetInput <(MediaWorkflowManifest, string)>();
            MediaWorkflowManifest workflowManifest = jobInput.Item1;
            string fileName = jobInput.Item2;

            MediaClient    mediaClient = new MediaClient(workflowManifest);
            CloudBlockBlob blob        = _blobClient.GetBlockBlob(_containerName, null, fileName);

            return(mediaClient.CreateAsset(workflowManifest.OutputAssetStorage, workflowManifest.AssetName, blob));
        }
예제 #12
0
        public JsonResult start(string[] assetIds, MediaJob mediaJob)
        {
            string      directoryId = homeController.GetDirectoryId(this.Request);
            string      authToken   = homeController.GetAuthToken(this.Request, this.Response);
            MediaClient mediaClient = new MediaClient(authToken);

            MediaJobInput[] jobInputs = Workflow.GetJobInputs(mediaClient, assetIds);
            object          jobOutput = Workflow.SubmitJob(directoryId, authToken, mediaClient, mediaJob, jobInputs);

            return(Json(jobOutput));
        }
예제 #13
0
        public ActionResult Popular()
        {
            try {
                MediaClient            mediaClient = new MediaClient(base.userToken.access_token);
                ApiResponse <FeedItem> popular     = mediaClient.Popular(EnvironmentHelpers.GetConfigValue("ClientId"));

                ViewData["Photos"] = popular.data;
            } catch { }

            return(View());
        }
예제 #14
0
        public JsonResult ingest(string storageAccount, bool storageEncryption, string inputAssetName, bool multipleFileAsset, string[] fileNames, MediaJob mediaJob)
        {
            string      directoryId = homeController.GetDirectoryId(this.Request);
            string      authToken   = homeController.GetAuthToken(this.Request, this.Response);
            MediaClient mediaClient = new MediaClient(authToken);

            MediaJobInput[] jobInputs = Workflow.GetJobInputs(authToken, mediaClient, storageAccount, storageEncryption, inputAssetName, multipleFileAsset, fileNames);
            object          jobOutput = Workflow.SubmitJob(directoryId, authToken, mediaClient, mediaJob, jobInputs);

            return(Json(jobOutput));
        }
예제 #15
0
 public static void Run([QueueTrigger("publish-insight")] string queueMessage, TraceWriter log)
 {
     log.Info($"Queue Message: {queueMessage}");
     MediaPublish insightPublish = JsonConvert.DeserializeObject<MediaPublish>(queueMessage);
     if (insightPublish != null)
     {
         MediaPublished insightPublished = MediaClient.PublishInsight(insightPublish);
         log.Info($"Insight Publish: {JsonConvert.SerializeObject(insightPublish)}");
         log.Info($"Insight Published: {JsonConvert.SerializeObject(insightPublished)}");
     }
 }
예제 #16
0
 public static Profile[] GetProfiles(string url, string login, string pass)
 {
     try
     {
         MediaClient mediaClient = GetMediaBase(url, login, pass);
         return(mediaClient.GetProfiles());
     }
     catch
     {
         return(new Profile[] { new Profile() });
     }
 }
예제 #17
0
        public async Task <OnvifDevice> Setup()
        {
            device = await OnvifClientFactory.CreateDeviceClientAsync(Host + ":" + Port, UserName, Password);

            var devicecapabilities = await device.GetCapabilitiesAsync(new CapabilityCategory[] { CapabilityCategory.All });

            var info = await device.GetDeviceInformationAsync(new GetDeviceInformationRequest()
            {
            });

            media = await OnvifClientFactory.CreateMediaClientAsync(Host + ":" + Port, UserName, Password);

            var profiles = await media.GetProfilesAsync();

            ptz = await Onvif.Core.Client.OnvifClientFactory.CreatePTZClientAsync(Host + ":" + Port, UserName, Password);

            var capabilities = await ptz.GetServiceCapabilitiesAsync();

            var config = await ptz.GetConfigurationsAsync();

            var space = config.PTZConfiguration[0].DefaultAbsolutePantTiltPositionSpace;

            token = profiles.Profiles[0].token;

            xrange = config.PTZConfiguration[0].PanTiltLimits.Range.XRange;
            yrange = config.PTZConfiguration[0].PanTiltLimits.Range.YRange;
            zrange = config.PTZConfiguration[0].ZoomLimits.Range.XRange;


            var status = await ptz.GetStatusAsync(token);

            //var presets = await ptz.GetPresetsAsync(token);

            //Console.WriteLine("preset ");
            //  await ptz.GotoPresetAsync(token, presets.Preset[0].token, null);

            //Thread.Sleep(4000);

            var nodes = await ptz.GetNodesAsync();

            //Console.WriteLine("home ");
            //await ptz.GotoHomePositionAsync(token, null);

            //Thread.Sleep(2000);
            //Console.WriteLine("ContinuousMoveAsync ");

            /*
             * await ptz.ContinuousMoveAsync(token, new PTZSpeed() {PanTilt = new Vector2D() {x = -1f, y = -1}, Zoom = new Vector1D() { x=0f}}, "2");
             * Thread.Sleep(2000);
             * await ptz.StopAsync(token, true, true);
             */
            return(this);
        }
예제 #18
0
        public IActionResult Index()
        {
            string authToken = HomeController.GetAuthToken(Request, Response);
            Dictionary <string, string> storageAccounts = Account.GetStorageAccounts(authToken);

            ViewData["storageAccount"] = HomeController.GetListItems(storageAccounts);
            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                ViewData["indexerEnabled"] = mediaClient.IndexerEnabled();
            }
            return(View());
        }
예제 #19
0
        /// <summary>
        /// Returns snapshot uri from DUT
        /// </summary>
        /// <param name="profileToken">Get snapshot parameters</param>
        /// <returns>Snapshot uri</returns>
        protected MediaUri GetSnapshotUri(string profileToken)
        {
            MediaClient client   = MediaClient;
            MediaUri    response = null;

            RunStep(() =>
            {
                response = client.GetSnapshotUri(profileToken);
            },
                    "Get snapshot URI");
            DoRequestDelay();
            return(response);
        }
예제 #20
0
        public static async Task Trigger([QueueTrigger(Constant.Storage.Blob.WorkflowContainerName)] EventGridEvent queueMessage,
                                         [Blob(Constant.Storage.Blob.WorkflowManifestPath, FileAccess.Read)] Stream manifestInput,
                                         [OrchestrationClient] DurableOrchestrationClient client)
        {
            if (InputComplete(queueMessage, manifestInput, out MediaWorkflowManifest workflowManifest))
            {
                MediaClient mediaClient = new MediaClient(workflowManifest);
                EventGridClient.SetMediaSubscription(mediaClient.MediaAccount);

                ValueTuple <EventGridEvent, MediaWorkflowManifest> workflowInput = (queueMessage, workflowManifest);
                await client.StartNewAsync("MediaWorkflow", workflowInput);
            }
        }
예제 #21
0
        /// <summary>
        /// Creates new media profile
        /// </summary>
        /// <param name="name">Name of new profile</param>
        /// <param name="token">Token of new profile</param>
        /// <returns>Created profile</returns>
        protected Profile CreateProfile(string name, string token)
        {
            MediaClient client  = MediaClient;
            Profile     profile = null;

            RunStep(() =>
            {
                profile = client.CreateProfile(name, token);
            },
                    "Create profile");
            DoRequestDelay();
            return(profile);
        }
예제 #22
0
        private Asset[] CreateInputAssets(MediaClient mediaClient, string storageAccount, string assetName, string assetDescription, string assetAlternateId, string[] fileNames)
        {
            List <Asset>      inputAssets = new List <Asset>();
            StorageBlobClient blobClient  = new StorageBlobClient(mediaClient.MediaAccount, storageAccount);

            foreach (string fileName in fileNames)
            {
                string sourceContainer = Constant.Storage.BlobContainer.MediaServices;
                Asset  inputAsset      = mediaClient.CreateAsset(blobClient, blobClient, storageAccount, assetName, assetDescription, assetAlternateId, sourceContainer, fileName);
                inputAssets.Add(inputAsset);
            }
            return(inputAssets.ToArray());
        }
예제 #23
0
        /// <summary>
        /// Retrieves lists of video sources form DUT
        /// </summary>
        /// <returns>Array of video sources</returns>
        protected VideoSource[] GetVideoSources()
        {
            MediaClient client = MediaClient;

            VideoSource[] sources = null;
            RunStep(() => { sources = client.GetVideoSources(); }, "Get Video Sources");
            DoRequestDelay();
            if (sources != null)
            {
                LogStepEvent(string.Format("{0} sources found", sources.Length) + Environment.NewLine);
            }
            return(sources);
        }
        public InstagramClient(string userName, string password, Device device)
        {
            _password   = password;
            _userName   = userName;
            this.device = device;

            EnsureAuthentication();

            Friendship = new FriendshipClient(wrapper, device);
            Direct     = new DirectClient(wrapper, device);
            Account    = new AccountClient(wrapper, device);
            Media      = new MediaClient(wrapper, device);
        }
예제 #25
0
        /// <summary>
        /// Retrieves lists of video source configurations from DUT
        /// </summary>
        /// <returns>Array of video source configurations</returns>
        protected VideoSourceConfiguration[] GetVideoSourceConfigurations()
        {
            MediaClient client = MediaClient;

            VideoSourceConfiguration[] configurations = null;
            RunStep(() => { configurations = client.GetVideoSourceConfigurations(); }, "Get Video Source Configurations");
            DoRequestDelay();
            if (configurations != null)
            {
                LogStepEvent(string.Format("{0} configurations found", configurations.Length) + Environment.NewLine);
            }
            return(configurations);
        }
예제 #26
0
        protected Profile[] GetProfiles()
        {
            MediaClient client = MediaClient;

            if (client == null)
            {
                return(null);
            }
            Profile[] profiles = null;
            RunStep(() => { profiles = client.GetProfiles(); }, "Get Profiles");
            DoRequestDelay();
            return(profiles);
        }
예제 #27
0
    void Connect()
    {
        HttpTransportBindingElement httpBinding = new HttpTransportBindingElement();

        httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest;
        var messageElement = new TextMessageEncodingBindingElement();

        // FIXME: Probe for Soap12 if Soap11 fails
        messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap11, AddressingVersion.None);
        CustomBinding bind = new CustomBinding(messageElement, httpBinding);

        media = new MediaClient(bind, new EndpointAddress(uriEntry.Text + "media_service"));
        media.ClientCredentials.UserName.UserName = @"admin";
        media.ClientCredentials.UserName.Password = @"admin";

        ptz = new PTZClient(bind, new EndpointAddress(uriEntry.Text + "ptz_service"));
        ptz.ClientCredentials.UserName.UserName = @"admin";
        ptz.ClientCredentials.UserName.Password = @"admin";

        foreach (var v in media.GetVideoSources())
        {
            Console.WriteLine(v.Resolution.Width + "x" + v.Resolution.Height);
            Console.WriteLine(v.token);
        }

        profile = media.GetProfiles().First();
        Console.WriteLine(profile.VideoSourceConfiguration.Name);
        Console.WriteLine(profile.VideoEncoderConfiguration.Resolution.Width + " " + profile.VideoEncoderConfiguration.Resolution.Height);

        Transport t = new Transport
        {
            Protocol = TransportProtocol.RTSP,
            Tunnel   = null,
        };

        Console.WriteLine(media.GetStreamUri(
                              new StreamSetup {
            Stream = StreamType.RTPUnicast, Transport = t
        },
                              profile.token).Uri);

        xmax          = profile.PTZConfiguration.PanTiltLimits.Range.XRange.Max;
        xmin          = profile.PTZConfiguration.PanTiltLimits.Range.XRange.Min;
        ymax          = profile.PTZConfiguration.PanTiltLimits.Range.YRange.Max;
        ymin          = profile.PTZConfiguration.PanTiltLimits.Range.YRange.Min;
        zmax          = profile.PTZConfiguration.ZoomLimits.Range.XRange.Max;
        zmin          = profile.PTZConfiguration.ZoomLimits.Range.XRange.Min;
        tmax          = "1";
        hbox1.Visible = true;
    }
예제 #28
0
        public ActionResult Details()
        {
            object mediaId;

            RouteData.Values.TryGetValue("id", out mediaId);

            try {
                MediaClient mediaClient = new MediaClient(userToken.access_token);
                ViewData["PhotoDetails"] = mediaClient.Media(mediaId.ToString()).data;
            } catch (System.Net.WebException ex) {
                ViewData["Error"] = ex.Message;
            }

            return(View());
        }
예제 #29
0
        private static bool IsStreamingEnabled(MediaClient mediaClient)
        {
            bool streamingEnabled = false;
            IPage <StreamingEndpoint> streamingEndpoints = mediaClient.GetEntities <StreamingEndpoint>(MediaEntity.StreamingEndpoint);

            foreach (StreamingEndpoint streamingEndpoint in streamingEndpoints)
            {
                if (streamingEndpoint.ResourceState == StreamingEndpointResourceState.Starting ||
                    streamingEndpoint.ResourceState == StreamingEndpointResourceState.Running ||
                    streamingEndpoint.ResourceState == StreamingEndpointResourceState.Scaling)
                {
                    streamingEnabled = true;
                }
            }
            return(streamingEnabled);
        }
예제 #30
0
        public IActionResult StorageAccounts()
        {
            List <MediaStorage> storageAccounts = new List <MediaStorage>();
            string authToken = HomeController.GetAuthToken(Request, Response);

            using (MediaClient mediaClient = new MediaClient(authToken))
            {
                foreach (StorageAccount storageAccount in mediaClient.StorageAccounts)
                {
                    MediaStorage mediaStorage = new MediaStorage(authToken, storageAccount);
                    storageAccounts.Add(mediaStorage);
                }
                ViewData["storageAccounts"] = storageAccounts.ToArray();
            }
            return(View());
        }
예제 #31
0
 public ActionResult GetImageUrl(int imageId)
 {
     var mediaClient = new MediaClient(apiConfig.GetString("ImxApiMediaUrl"), apiConfig.GetString("oAuthConsumerKey"), apiConfig.GetString("oAuthConsumerSecret"), 1);
     var url = mediaClient.GetUrl(imageId, "IMAGES");
     return Json(url, JsonRequestBehavior.AllowGet);
 }