All Products
Search
Document Center

Initialization

Last Updated: Jul 11, 2019

Prerequisites

Initialization

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

var RPCClient = require('@alicloud/pop-core').RPCClient;

function initVodClient(accessKeyId, secretAccessKey,) {
    var regionId = 'cn-shanghai'; // Sets the region of ApsaraVideo for VOD.
    var client = new RPCClient({
        accessKeyId: accessKeyId,
        secretAccessKey: secretAccessKey,
        endpoint: 'http://vod.' + regionId + '.aliyuncs.com',
        apiVersion: '2017-03-21'
    });

    return client;
}
var RPCClient = require('@alicloud/pop-core').RPCClient;

function initVodClient(accessKeyId, secretAccessKey, securityToken) {
    var regionId = 'cn-shanghai'; // Sets the region of ApsaraVideo for VOD.
    var client = new RPCClient({
        accessKeyId: accessKeyId,
        secretAccessKey: secretAccessKey,
        securityToken: securityToken,
        endpoint: 'http://vod.' + regionId + '.aliyuncs.com',
        apiVersion: '2017-03-21'
    });

    return client;
}