You need to enable JavaScript to run this app.
导航

初始化

最近更新时间2023.11.13 15:23:04

首次发布时间2021.02.23 10:42:40

Java SDK 可通过 Access Key 初始化。您可以根据需求选择设置 AK/SK 的方法。本文为您介绍初始化的操作步骤。

前置条件

初始化

点播服务支持的区域:华北 cn-north-1

AK/SK 设置方法

支持 3种 AK/SK 的设置方法。

  • 方法一:在代码中设置
vodService.setAccessKey("ak");
vodService.setSecretKey("sk");
  • 方法二:在环境变量中设置
VOLC_ACCESSKEY="ak"
VOLC_SECRETKEY="sk"
  • 方法三:在文件中设置

在本地的 ~/.volc/config 中添加的内容如下所示。

{
   "ak":"Your-AK",
   "sk":"Your-SK"
}

初始化代码

package com.volcengine.example;

import com.volcengine.helper.Const;
import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;

public class Demo {
    public static void main(String[] args) fdj{
        IVodService vodService = VodServiceImpl.getInstance(Const.REGION_CN_NORTH_1);
        // call below method if you dont set ak and sk in ~/.volc/config
        vodService.setAccessKey("ak");
        vodService.setSecretKey("sk");
       // then call specific action 
 
}