全部产品

直播转点播

更新时间:2020-11-30 17:52:02

本篇文档提供了.NET SDK视频直播转点播模块,查询直转点视频列表功能的API调用示例。

初始化客户端

使用前请先初始化客户端,请参见初始化

查询直转点视频列表

调用ListLiveRecordVideo接口,完成查询直转点视频列表功能。

接口参数和返回字段请参见ListLiveRecordVideo。调用示例如下:

using System;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.vod.Model.V20170321;

namespace Aliyun.Acs.vod.Sdk.ListLiveRecordVideo
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            try
            {
                // 构造请求
                ListLiveRecordVideoRequest request = new ListLiveRecordVideoRequest();
                request.StartTime = "2018-04-24T03:21:04Z";
                request.EndTime = "2018-05-21T03:21:44Z";
                request.StreamName = "testStreamName";
                request.DomainName = "testdomain.aliyun.com";
                request.AppName = "testAppName";
                // 初始化客户端
                DefaultAcsClient client = InitVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
                // 发起请求,并得到 response
                ListLiveRecordVideoResponse response = client.GetAcsResponse(request);
                // 打印本次请求ID
                Console.WriteLine("RequestId = " + response.RequestId);
                if (response.LiveRecordVideoList != null && response.LiveRecordVideoList.Count > 0)
                {
                    //打印查询出来的列表个数
                    Console.WriteLine("Total = " + response.Total);
                    foreach (var liveRecordVideo in response.LiveRecordVideoList)
                    {
                        Console.WriteLine("AppName = " + liveRecordVideo.AppName);
                        Console.WriteLine("DomainName = " + liveRecordVideo.DomainName);
                        Console.WriteLine("PlaylistId = " + liveRecordVideo.PlaylistId);
                    }
                }
            }
            catch (ServerException e)
            {
                if (e.RequestId != null)
                {
                    Console.WriteLine("RequestId = " + e.RequestId);
                }
                Console.WriteLine("ErrorCode = " + e.ErrorCode);
                Console.WriteLine("ErrorMessage = " + e.ErrorMessage);
            }
            catch (ClientException e)
            {
                if (e.RequestId != null)
                {
                    Console.WriteLine("RequestId = " + e.RequestId);
                }
                Console.WriteLine("ErrorCode = " + e.ErrorCode);
                Console.WriteLine("ErrorMessage = " + e.ErrorMessage);
            }
            catch (Exception e)
            {
                Console.WriteLine("ErrorMessage = " + e.ToString());
            }
        }
    }
}