All Products
Search
Document Center

Live-to-VOD

Last Updated: Jul 11, 2019

Initialize a client

Initialize a client before using the SDK. For more information, see InitVodClient.

Query a list of VOD files created from live streams

For more information about the request and response parameters, see 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
            {
                // Constructs a request.
                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";
                // Initializes the client.
                DefaultAcsClient client = InitVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
                // Initiates the request and obtains a response.
                ListLiveRecordVideoResponse response = client.GetAcsResponse(request);
                // The GUID generated by Alibaba Cloud for the request.
                Console.WriteLine("RequestId = " + response.RequestId);
                if (response.LiveRecordVideoList ! = null && response.LiveRecordVideoList.Count > 0) 
                {
                    // The number of VOD files that are found.
                    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());
            }
        }
    }
}