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. var RPCClient = require('@alicloud/pop-core').RPCClient;
  2. function initVodClient(accessKeyId, secretAccessKey,) {
  3. var regionId = 'cn-shanghai'; // Sets the region of ApsaraVideo for VOD.
  4. var client = new RPCClient({
  5. accessKeyId: accessKeyId,
  6. secretAccessKey: secretAccessKey,
  7. endpoint: 'http://vod.' + regionId + '.aliyuncs.com',
  8. apiVersion: '2017-03-21'
  9. });
  10. return client;
  11. }
  1. var RPCClient = require('@alicloud/pop-core').RPCClient;
  2. function initVodClient(accessKeyId, secretAccessKey, securityToken) {
  3. var regionId = 'cn-shanghai'; // Sets the region of ApsaraVideo for VOD.
  4. var client = new RPCClient({
  5. accessKeyId: accessKeyId,
  6. secretAccessKey: secretAccessKey,
  7. securityToken: securityToken,
  8. endpoint: 'http://vod.' + regionId + '.aliyuncs.com',
  9. apiVersion: '2017-03-21'
  10. });
  11. return client;
  12. }