我正在尝试为流创建过滤器,基本上只是为了对其进行裁剪。资产对应于仍在进行的实时流。
这是我通过.net sdk(Microsoft.Azure.Management.Media,版本= 2.0.1.0)进行的呼叫,失败并显示400,并且没有其他信息:
await _client.AssetFilters.CreateOrUpdateAsync(_config.ResourceGroup, _config.AccountName,
_assetName, filterName, new AssetFilter()
{
PresentationTimeRange = new PresentationTimeRange()
{
StartTimestamp = 100000000,
EndTimestamp = 150000000,
LiveBackoffDuration = 0,
Timescale = 10000000,
ForceEndTimestamp = false
},
Tracks = new List<FilterTrackSelection>()
});
通过http请求尝试执行相同操作成功,创建了过滤器并可以使用该过滤器:
var uri =
$"https://management.azure.com/subscriptions/{_config.SubscriptionId}/resourceGroups/{_config.ResourceGroup}/providers/Microsoft.Media/mediaServices/streaming/assets/{_assetName}/assetFilters/{filterName}?api-version=2018-07-01";
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Token);
var assetFilter = JsonConvert.SerializeObject(new AssetFilter()
{
PresentationTimeRange = new PresentationTimeRange()
{
StartTimestamp = 100000000,
EndTimestamp = 150000000,
LiveBackoffDuration = 0,
Timescale = 10000000,
ForceEndTimestamp = false
},
Tracks = new List<FilterTrackSelection>()
});
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Put, uri);
request.Content = new StringContent(assetFilter, Encoding.UTF8, "application/json");
await httpClient.SendAsync(request);
在两种情况下,我都将发送相同的AssetFilter对象,有关为什么第一次调用会失败的任何建议?
任何帮助将不胜感激。
谢谢!
答案 0 :(得分:0)
.Net SDK版本2.0.2已根据https://www.nuget.org/packages/Microsoft.Azure.Management.Media/2.0.2更新了筛选器。我无法在2.0.2中进行复制,因此可能已在此更新中修复。区别可能在于REST调用只是正确地处理了它。