本示例介绍使用Alibaba Cloud SDK for Java调用DescribeLivePullStreamConfig接口。

前提条件

请在pom.xml文件中增加以下依赖,准确的SDK版本号,参见 阿里云开发工具包(SDK)

<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>aliyun-java-sdk-live</artifactId>
    <version>3.7.5</version>
 </dependency>

示例代码

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.live.model.v20161101.DescribeLivePullStreamConfigRequest;
import com.aliyuncs.live.model.v20161101.DescribeLivePullStreamConfigResponse;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.google.gson.Gson;

/**
 * 查询拉流配置。
 * 目前仅支持单个域名查询。
 */
public class TestLiveOpen {
    public static void main(String[] args) {
        IClientProfile profile = DefaultProfile.getProfile(
                "<your-region-id>",            // 地域ID
                "<your-access-key-id>",        // 您的AccessKey ID
                "<your-access-key-secret>" );  // 您的AccessKey Secret
        IAcsClient client = new DefaultAcsClient(profile);
        DescribeLivePullStreamConfigRequest request = new DescribeLivePullStreamConfigRequest();
        // 您的拉流域名。
        request.setDomainName("<your-DomainName>");
        try {
            DescribeLivePullStreamConfigResponseResponse response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
        } catch (ClientException e) {
            System.out.println("ErrCode:" + e.getErrCode());
            System.out.println("ErrMsg:" + e.getErrMsg());
            System.out.println("RequestId:" + e.getRequestId());
        }
    }
}
			
说明 更多接口信息,请参见API概述