public void DeleteLocators(string assetName) { ListStreamingLocatorsResponse locatorList = _media.Assets.ListStreamingLocators(MediaAccount.ResourceGroupName, MediaAccount.Name, assetName); foreach (AssetStreamingLocator streamingLocator in locatorList.StreamingLocators) { DeleteEntity(MediaEntity.StreamingLocator, streamingLocator.Name); } }
public IEnumerable <StreamingLocator> GetLocators(string assetName) { List <StreamingLocator> locators = new List <StreamingLocator>(); ListStreamingLocatorsResponse locatorList = _media.Assets.ListStreamingLocators(MediaAccount.ResourceGroupName, MediaAccount.Name, assetName); foreach (AssetStreamingLocator streamingLocator in locatorList.StreamingLocators) { StreamingLocator locator = GetEntity <StreamingLocator>(MediaEntity.StreamingLocator, streamingLocator.Name); locators.Add(locator); } return(locators); }
private async Task <AssetStreamingLocator> GetStreamingLocatorForAssetAsync(string assetName) { ListStreamingLocatorsResponse locatorResponse = await Client.Assets.ListStreamingLocatorsAsync( resourceGroupName : Config.ResourceGroup, accountName : Config.AccountName, assetName : assetName ); AssetStreamingLocator firstStreamingLocator = locatorResponse.StreamingLocators.First(); LoggerService.Info("Got the streaming locator for asset", LoggerService.Locators); return(firstStreamingLocator); }
public string[] GetStreamingUrls(string assetName) { List <string> streamingUrls = new List <string>(); ListStreamingLocatorsResponse streamingLocatorList = _media.Assets.ListStreamingLocators(MediaAccount.ResourceGroupName, MediaAccount.Name, assetName); foreach (AssetStreamingLocator assetStreamingLocator in streamingLocatorList.StreamingLocators) { StreamingLocator streamingLocator = GetEntity <StreamingLocator>(MediaEntity.StreamingLocator, assetStreamingLocator.Name); string streamingUrl = GetStreamingUrl(streamingLocator, null); if (!string.IsNullOrEmpty(streamingUrl)) { streamingUrls.Add(streamingUrl); } } return(streamingUrls.ToArray()); }
// region Workflow private async Task DeleteAllStreamingLocatorsForAssetAsync(string assetName) { ListStreamingLocatorsResponse locators = await Client.Assets.ListStreamingLocatorsAsync( resourceGroupName : Config.ResourceGroup, accountName : Config.AccountName, assetName : assetName ); LoggerService.Info($"Deleting {locators.StreamingLocators.Count} streaming locator(s)", LoggerService.Stop); foreach (AssetStreamingLocator locator in locators.StreamingLocators) { await Client.StreamingLocators.DeleteAsync( resourceGroupName : Config.ResourceGroup, accountName : Config.AccountName, streamingLocatorName : locator.Name ); } LoggerService.Info("Deleted all streaming locator(s)", LoggerService.Stop); }
public StreamingLocator GetStreamingLocator(string assetName) { StreamingLocator sl = null; try { ListStreamingLocatorsResponse lsr = mediaServiceClient.Assets.ListStreamingLocators(resourceGroup, accountId, assetName); if (lsr != null) { if (lsr.StreamingLocators != null) { if (lsr.StreamingLocators.Count > 0) { sl = mediaServiceClient.StreamingLocators.Get(resourceGroup, accountId, lsr.StreamingLocators[0].Name); } } } } catch (Exception) { } return(sl); }