All Products
Search
Document Center

Initialization

Last Updated: May 27, 2020

Prerequisites

  • You have registered an Alibaba Cloud account, completed real-name verification, and activated ApsaraVideo for VOD.
  • You have obtained an AccessKey for access to ApsaraVideo for VOD. You can create an AccessKey for your Alibaba Cloud account on the AccessKey management page of the Alibaba Cloud console. Alternatively, you can create a RAM user in the RAM console and grant the user the permission to access ApsaraVideo for VOD. For more information, see RAM user access.

Initialization

The regionId parameter specifies the region of ApsaraVideo for VOD. Set this parameter to cn-shanghai for a region in China.

  1. using Aliyun.Acs.Core;
  2. using Aliyun.Acs.Core.Profile;
  3. public static DefaultAcsClient InitVodClient(string accessKeyId, string accessKeySecret)
  4. {
  5. // Sets the region of ApsaraVideo for VOD.
  6. string regionId = "cn-shanghai";
  7. IClientProfile profile = DefaultProfile.GetProfile(regionId, accessKeyId, accessKeySecret);
  8. // DefaultProfile.AddEndpoint(regionId, regionId, "vod", "vod." + regionId + ".aliyuncs.com");
  9. return new DefaultAcsClient(profile);
  10. }

Instructions

  • Assume that the region ID that you specify is in the list of ApsaraVideo for VOD regions and endpoints. Due to the incompatibility of some SDK versions, the system may return the error message SDK.InvalidRegionId, Can not find endpoint to access. when you call the InitVodClient method. To resolve this issue, you can uncomment the line of code for calling the AddEndpoint method in the InitVodClient method.