前置条件

初始化

点播服务的接入区域参考接入区域标识,例如:接入区域在上海,请使用cn-shanghai。

  • 使用账号AccessKey初始化。
    var RPCClient = require('@alicloud/pop-core').RPCClient;
    
    function initVodClient(accessKeyId, secretAccessKey,) {
        var regionId = 'cn-shanghai';   // 点播服务接入区域
        var client = new RPCClient({
            accessKeyId: accessKeyId,
            secretAccessKey: secretAccessKey,
            endpoint: 'http://vod.' + regionId + '.aliyuncs.com',
            apiVersion: '2017-03-21'
        });
    
        return client;
    }
    			
  • 使用STS初始化。
    var RPCClient = require('@alicloud/pop-core').RPCClient;
    
    function initVodClient(accessKeyId, secretAccessKey, securityToken) {
        var regionId = 'cn-shanghai';   // 点播服务接入区域
        var client = new RPCClient({
            accessKeyId: accessKeyId,
            secretAccessKey: secretAccessKey,
    		securityToken: securityToken,
            endpoint: 'http://vod.' + regionId + '.aliyuncs.com',
            apiVersion: '2017-03-21'
        });
    
        return client;
    }