亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Azure 媒體服務、帶有 V3 api 和 ODataQuery 的 GetLocators

Azure 媒體服務、帶有 V3 api 和 ODataQuery 的 GetLocators

C#
尚方寶劍之說 2022-10-15 14:56:55
我正在嘗試使用 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;        }    }
查看完整描述

1 回答

?
喵喵時光機

TA貢獻1846條經驗 獲得超7個贊

根據媒體服務過濾文檔,用戶只能通過“name”、“properties.created”和“properties.endTime”過濾“Streaming Locators”。

https://learn.microsoft.com/en-us/azure/media-services/latest/entities-overview#streaming-locators

http://img1.sycdn.imooc.com//634a59d300014cde09410777.jpg

在您的示例中,您嘗試使用不支持的assetId/assetName 進行過濾。因此 400 Bad request 錯誤。請參閱郵遞員中的詳細錯誤示例

http://img1.sycdn.imooc.com//634a59e10001702f15940486.jpg

這是使用流式定位器“名稱”標簽的有效過濾示例。

注意:這不是資產標簽

http://img1.sycdn.imooc.com//634a59ef00016c5d15900662.jpg

用于使用“名稱”成功過濾流式定位器的 C# 示例


    try

    {

        // GUID need to be specified in single quote. using OData v 3.0

        var odataquery = new ODataQuery<StreamingLocator>("name eq '65a1cb0d-ce7c-4470-93ac-fedf66450ea0'");

        IPage<StreamingLocator> locators = client.StreamingLocators.List("mediatest", "mymediatestaccount", odataquery);


        Console.WriteLine(locators.FirstOrDefault().Name);

        Console.WriteLine(locators.FirstOrDefault().StreamingLocatorId);

        Console.WriteLine(locators.FirstOrDefault().Id);


        ListPathsResponse paths = client.StreamingLocators.ListPaths("mediatest", "mymediatestaccount", locators.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];

            Console.WriteLine(uriBuilder.ToString());

        }

    }

    catch (Exception ex)

    {

        Console.WriteLine(ex.ToString());

    }

我希望這有幫助。


查看完整回答
反對 回復 2022-10-15
  • 1 回答
  • 0 關注
  • 97 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號