/// <summary> /// PublishAsset - Publishes the asset with global descriptor to enable the asset for streaming. /// </summary> /// <param name="asset">asset</param> /// <returns>Returns list of streaming uri's for all available streaming formats</returns> public PublishedUrlDetails PublishAsset(IAsset asset) { PublishedUrlDetails publishedUrls = new PublishedUrlDetails(); var assetFile = asset.AssetFiles.Where(f => f.Name.ToLower().EndsWith(".ism")).FirstOrDefault(); IAccessPolicy policy = _mediaContext.AccessPolicies.Create("Streaming policy", TimeSpan.FromDays(365), AccessPermissions.Read); ILocator originLocator = _mediaContext.Locators.CreateLocator(LocatorType.OnDemandOrigin, asset, policy, DateTime.UtcNow.AddMinutes(-5)); Uri smoothStreamingUri = asset.GetSmoothStreamingUri(); Uri hlsUri = asset.GetHlsUri(); Uri mpegDashUri = asset.GetMpegDashUri(); Uri hlsv3Uri = asset.GetHlsv3Uri(); publishedUrls.SmoothUrl = smoothStreamingUri != null?smoothStreamingUri.ToString().Replace("http://", "https://") : " "; publishedUrls.Hlsv4Uri = hlsUri != null?hlsUri.ToString().Replace("http://", "https://") : " "; publishedUrls.Hlsv3Uri = hlsv3Uri != null?hlsv3Uri.ToString().Replace("http://", "https://") : " "; publishedUrls.MpegDashUri = mpegDashUri != null?mpegDashUri.ToString().Replace("http://", "https://") : " "; if (assetFile != null) { publishedUrls.UrlWithOriginLocator = originLocator.Path.Replace("http://", "https://") + assetFile.Name + "/manifest"; } return(publishedUrls); }