我正在尝试使用 v3 API 和Microsoft.Azure.Management.Media包获取给定资产的所有流式定位器,但使用 Odata 查询时出现错误请求错误:
它在这一行失败:var locator = client.StreamingLocators.List("webinars", "webinars", new ODataQuery<StreamingLocator>(x=>x.AssetName == assetId));
Microsoft.Azure.Management.Media.Models.ApiErrorException: Operation returned an invalid status code 'BadRequest'
当我在没有 ODataQuery 的情况下使用它时,它返回正常。
public IList<string> GetLocatorForAsset() {
var assetId = "bb4953cf-4793-4b3c-aed8-ae1bec88a339";
IList<string> streamingUrls = new List<string>();
var locator = client.StreamingLocators.List("webinars", "webinars", new ODataQuery<StreamingLocator>(x=>x.AssetName == assetId));
ListPathsResponse paths = client.StreamingLocators.ListPaths("webinars", "webinars", locator.FirstOrDefault().Name);
foreach (StreamingPath path in paths.StreamingPaths) {
UriBuilder uriBuilder = new UriBuilder();
uriBuilder.Scheme = "https";
uriBuilder.Host = "webinars-use2.streaming.media.azure.net";
uriBuilder.Path = path.Paths[0];
streamingUrls.Add(uriBuilder.ToString());
}
return streamingUrls;
}
}
喵喵时光机
相关分类