Exemplo n.º 1
0
        private string IndexVideo(IAsset asset, string locatorUrl, ContentIndexer contentIndexer)
        {
            string indexId    = string.Empty;
            string requestUrl = string.Concat(_serviceUrl, "/Breakdowns");

            requestUrl = string.Concat(requestUrl, "?name=", WebUtility.UrlEncode(asset.Name));
            requestUrl = string.Concat(requestUrl, "&description=", WebUtility.UrlEncode(contentIndexer.VideoDescription));
            requestUrl = string.Concat(requestUrl, "&metadata=", WebUtility.UrlEncode(contentIndexer.VideoMetadata));
            requestUrl = string.Concat(requestUrl, "&externalId=", WebUtility.UrlEncode(asset.Id));
            requestUrl = string.Concat(requestUrl, "&videoUrl=", WebUtility.UrlEncode(locatorUrl));
            requestUrl = string.Concat(requestUrl, "&language=", contentIndexer.LanguageId);
            requestUrl = string.Concat(requestUrl, "&partition=", contentIndexer.SearchPartition);
            requestUrl = string.Concat(requestUrl, "&callbackUrl=", GetCallbackUrl());
            requestUrl = string.Concat(requestUrl, "&privacy=", GetPrivacy(contentIndexer.VideoPublic));
            if (contentIndexer.AudioOnly)
            {
                requestUrl = string.Concat(requestUrl, "&indexingPreset=audioOnly");
            }
            using (HttpRequestMessage request = _indexer.GetRequest(HttpMethod.Post, requestUrl))
            {
                indexId = _indexer.GetResponse <string>(request);
            }
            return(indexId);
        }
Exemplo n.º 2
0
        public void IndexVideo(string authToken, MediaClient mediaClient, IAsset asset, ContentIndexer contentIndexer)
        {
            string locatorUrl = mediaClient.GetLocatorUrl(LocatorType.Sas, asset, null, false);
            string indexId    = IndexVideo(asset, locatorUrl, contentIndexer);

            if (!string.IsNullOrEmpty(indexId))
            {
                asset.AlternateId = string.Concat(MediaProcessor.VideoIndexer.ToString(), Constant.TextDelimiter.Identifier, indexId);
                asset.Update();
                PublishInsight(authToken, indexId);
            }
        }