diff --git a/README.md b/README.md
index f18b5a3..153a05e 100644
--- a/README.md
+++ b/README.md
@@ -14,26 +14,26 @@
English | [简体中文](./README_ZH.md)
> [!IMPORTANT]
-This SDK has undergone some testing to ensure its basic functionality works correctly. However, due to the complexity of software development, we cannot guarantee it is completely free of defects. We encourage community developers and users to actively participate and help improve this project.
+> This SDK has undergone some testing to ensure its basic functionality works correctly. However, due to the complexity of software development, we cannot guarantee it is completely free of defects. We encourage community developers and users to actively participate and help improve this project.
## Features
-* Encapsulates the request and response handling of the Agora REST API, simplifying the communication process with the Agora REST API.
-* Provides automatic switching to the best domain in case of DNS resolution failure, network errors, or request timeouts, ensuring the availability of the REST API service.
-* Offers easy-to-use APIs to easily implement common functions of the Agora REST API, such as starting and stopping cloud recording.
-* Based on Java language, it is efficient, concurrent, and scalable.
+- Encapsulates the request and response handling of the Agora REST API, simplifying the communication process with the Agora REST API.
+- Provides automatic switching to the best domain in case of DNS resolution failure, network errors, or request timeouts, ensuring the availability of the REST API service.
+- Offers easy-to-use APIs to easily implement common functions of the Agora REST API, such as starting and stopping cloud recording.
+- Based on Java language, it is efficient, concurrent, and scalable.
## Supported Services
-* [Cloud Recording](./agora-rest-client-core/src/main/java/io/agora/rest/services/cloudrecording/README.md)
-* [Conversational AI Engine](./agora-rest-client-core/src/main/java/io/agora/rest/services/convoai/README.md)
-
+- [Cloud Recording](./agora-rest-client-core/src/main/java/io/agora/rest/services/cloudrecording/README.md)
+- [Conversational AI Engine](./agora-rest-client-core/src/main/java/io/agora/rest/services/convoai/README.md)
+
## Environment Setup
-* [Java 1.8 or later](https://www.java.com)
-* App ID and App Certificate obtained from the [Agora Console](https://console.agora.io/v2)
-* Basic Auth credentials from the [Agora Console](https://console.agora.io/v2)
-* Enable the relevant service capabilities on the [Agora Console](https://console.agora.io/v2)
+- [Java 1.8 or later](https://www.java.com)
+- App ID and App Certificate obtained from the [Agora Console](https://console.agora.io/v2)
+- Basic Auth credentials from the [Agora Console](https://console.agora.io/v2)
+- Enable the relevant service capabilities on the [Agora Console](https://console.agora.io/v2)
## Installation
@@ -55,10 +55,10 @@ Here is an example of calling the cloud recording service:
package com.company.example;
import io.agora.rest.AgoraException;
-import io.agora.rest.core.AgoraConfig;
import io.agora.rest.core.BasicAuthCredential;
import io.agora.rest.core.Credential;
import io.agora.rest.core.DomainArea;
+import io.agora.rest.services.cloudrecording.CloudRecordingConfig;
import io.agora.rest.services.cloudrecording.api.req.StartResourceReq;
import io.agora.rest.services.cloudrecording.api.res.AcquireResourceRes;
import io.agora.rest.services.cloudrecording.api.res.StartResourceRes;
@@ -72,192 +72,189 @@ import java.util.Arrays;
import java.util.Collections;
public class Main {
- private static String appId = "";
-
- private static String cname = "";
-
- private static String uid = "";
+ private static String appId = "";
- private static String username = "";
+ private static String cname = "";
- private static String password = "";
+ private static String uid = "";
- private static String token = "";
+ private static String username = "";
- private static String accessKey = "";
+ private static String password = "";
- private static String secretKey = "";
+ private static String token = "";
- private static Integer region = 0; //
+ private static String accessKey = "";
- private static String bucket = "";
+ private static String secretKey = "";
- private static Integer vendor = 0; //
+ private static Integer region = 0; //
- public static void main(String[] args) throws Exception {
+ private static String bucket = "";
- Credential credential = new BasicAuthCredential(username, password);
+ private static Integer vendor = 0; //
- // Initialize AgoraConfig
- AgoraConfig agoraConfig = AgoraConfig.builder()
- .appId(appId)
- .credential(credential)
- // Specify the region where the server is located.
- // Optional values are CN, US, EU, AP, and the client will automatically
- // switch to use the best domain name according to the configured region
- .domainArea(DomainArea.CN)
- .build();
+ public static void main(String[] args) throws Exception {
- // Initialize CloudRecordingClient
+ Credential credential = new BasicAuthCredential(username, password);
- CloudRecordingClient cloudRecordingClient = CloudRecordingClient.create(agoraConfig);
+ // Initialize CloudRecordingConfig
+ CloudRecordingConfig agoraConfig = CloudRecordingConfig.builder()
+ .appId(appId)
+ .credential(credential)
+ // Specify the region where the server is located.
+ // Optional values are CN, US, EU, AP, and the client will automatically
+ // switch to use the best domain name according to the configured region
+ .domainArea(DomainArea.CN)
+ .build();
+ // Initialize CloudRecordingClient
- AcquireResourceRes acquireResourceRes;
+ CloudRecordingClient cloudRecordingClient = CloudRecordingClient.create(agoraConfig);
- // Acquire resource
- try {
- acquireResourceRes = cloudRecordingClient
- .mixScenario()
- .acquire(cname, uid, AcquireMixRecordingResourceClientReq.builder()
- .build())
- .block();
- } catch (AgoraException e) {
- System.out.printf("agora error:%s", e.getMessage());
- return;
- } catch (Exception e) {
- System.out.printf("unknown error:%s", e.getMessage());
- return;
- }
-
- // Check if the response is null
- if (acquireResourceRes == null || acquireResourceRes.getResourceId() == null) {
- System.out.println("failed to get resource");
- return;
- }
+ AcquireResourceRes acquireResourceRes;
-
- System.out.printf("resourceId:%s", acquireResourceRes.getResourceId());
-
- System.out.println("acquire resource success");
-
- // Define storage config
- StartResourceReq.StorageConfig storageConfig = StartResourceReq.StorageConfig.builder()
- .accessKey(accessKey)
- .secretKey(secretKey)
- .bucket(bucket)
- .vendor(vendor)
- .region(region)
- .build();
-
- // Define start resource request
- StartMixRecordingResourceClientReq startResourceReq = StartMixRecordingResourceClientReq.builder()
- .token(token)
- .recordingConfig(StartResourceReq.RecordingConfig.builder()
- .channelType(1)
- .streamTypes(2)
- .maxIdleTime(30)
- .audioProfile(2)
- .transcodingConfig(StartResourceReq.TranscodingConfig.builder()
- .width(640)
- .height(480)
- .fps(15)
- .bitrate(800)
- .mixedVideoLayout(0)
- .backgroundColor("#000000")
+ // Acquire resource
+ try {
+ acquireResourceRes = cloudRecordingClient
+ .mixScenario()
+ .acquire(cname, uid, AcquireMixRecordingResourceClientReq.builder()
.build())
- .subscribeAudioUIDs(Collections.singletonList("#allstream#"))
- .subscribeVideoUIDs(Collections.singletonList("#allstream#"))
- .build())
- .recordingFileConfig(StartResourceReq.RecordingFileConfig.builder()
- .avFileType(Arrays.asList("hls", "mp4"))
- .build())
- .storageConfig(storageConfig)
- .build();
-
-
- StartResourceRes startResourceRes;
-
- // Start resource
- try {
- startResourceRes = cloudRecordingClient
- .mixScenario()
- .start(cname, uid,
- acquireResourceRes.getResourceId(),
- startResourceReq)
- .block();
-
- } catch (AgoraException e) {
- System.out.printf("agora error:%s", e.getMessage());
- return;
- } catch (Exception e) {
- System.out.printf("unknown error:%s", e.getMessage());
- return;
- }
-
- // Check if the response is null
- if (startResourceRes == null || startResourceRes.getSid() == null) {
- System.out.println("failed to start resource");
- return;
- }
-
- System.out.printf("sid:%s", startResourceRes.getSid());
+ .block();
+ } catch (AgoraException e) {
+ System.out.printf("agora error:%s", e.getMessage());
+ return;
+ } catch (Exception e) {
+ System.out.printf("unknown error:%s", e.getMessage());
+ return;
+ }
+
+ // Check if the response is null
+ if (acquireResourceRes == null || acquireResourceRes.getResourceId() == null) {
+ System.out.println("failed to get resource");
+ return;
+ }
+
+ System.out.printf("resourceId:%s", acquireResourceRes.getResourceId());
+
+ System.out.println("acquire resource success");
+
+ // Define storage config
+ StartResourceReq.StorageConfig storageConfig = StartResourceReq.StorageConfig.builder()
+ .accessKey(accessKey)
+ .secretKey(secretKey)
+ .bucket(bucket)
+ .vendor(vendor)
+ .region(region)
+ .build();
+
+ // Define start resource request
+ StartMixRecordingResourceClientReq startResourceReq = StartMixRecordingResourceClientReq.builder()
+ .token(token)
+ .recordingConfig(StartResourceReq.RecordingConfig.builder()
+ .channelType(1)
+ .streamTypes(2)
+ .maxIdleTime(30)
+ .audioProfile(2)
+ .transcodingConfig(StartResourceReq.TranscodingConfig.builder()
+ .width(640)
+ .height(480)
+ .fps(15)
+ .bitrate(800)
+ .mixedVideoLayout(0)
+ .backgroundColor("#000000")
+ .build())
+ .subscribeAudioUIDs(Collections.singletonList("#allstream#"))
+ .subscribeVideoUIDs(Collections.singletonList("#allstream#"))
+ .build())
+ .recordingFileConfig(StartResourceReq.RecordingFileConfig.builder()
+ .avFileType(Arrays.asList("hls", "mp4"))
+ .build())
+ .storageConfig(storageConfig)
+ .build();
+
+ StartResourceRes startResourceRes;
+
+ // Start resource
+ try {
+ startResourceRes = cloudRecordingClient
+ .mixScenario()
+ .start(cname, uid,
+ acquireResourceRes.getResourceId(),
+ startResourceReq)
+ .block();
+
+ } catch (AgoraException e) {
+ System.out.printf("agora error:%s", e.getMessage());
+ return;
+ } catch (Exception e) {
+ System.out.printf("unknown error:%s", e.getMessage());
+ return;
+ }
+
+ // Check if the response is null
+ if (startResourceRes == null || startResourceRes.getSid() == null) {
+ System.out.println("failed to start resource");
+ return;
+ }
+
+ System.out.printf("sid:%s", startResourceRes.getSid());
+
+ System.out.println("start resource success");
+
+ Thread.sleep(3000);
+
+ QueryMixHLSAndMP4RecordingResourceRes queryResourceRes;
+
+ // Query resource
+ try {
+ queryResourceRes = cloudRecordingClient
+ .mixScenario()
+ .queryHLSAndMP4(startResourceRes.getResourceId(), startResourceRes.getSid())
+ .block();
+
+ } catch (AgoraException e) {
+ System.out.printf("agora error:%s", e.getMessage());
+ return;
+ } catch (Exception e) {
+ System.out.printf("unknown error:%s", e.getMessage());
+ return;
+ }
+
+ if (queryResourceRes == null || queryResourceRes.getServerResponse() == null) {
+ System.out.println("failed to query resource");
+ return;
+ }
+
+ System.out.println("query resource success");
+
+ Thread.sleep(3000);
+
+ StopResourceRes stopResourceRes;
+
+ // Stop resource
+ try {
+ stopResourceRes = cloudRecordingClient
+ .mixScenario()
+ .stop(cname, uid, startResourceRes.getResourceId(), startResourceRes.getSid(),
+ true)
+ .block();
+ } catch (AgoraException e) {
+ System.out.printf("agora error:%s", e.getMessage());
+ return;
+ } catch (Exception e) {
+ System.out.printf("unknown error:%s", e.getMessage());
+ return;
+ }
+
+ // Check if the response is null
+ if (stopResourceRes == null || stopResourceRes.getSid() == null) {
+ System.out.println("failed to stop resource");
+ } else {
+ System.out.println("stop resource success");
+ }
- System.out.println("start resource success");
-
- Thread.sleep(3000);
-
- QueryMixHLSAndMP4RecordingResourceRes queryResourceRes;
-
- // Query resource
- try {
- queryResourceRes = cloudRecordingClient
- .mixScenario()
- .queryHLSAndMP4(startResourceRes.getResourceId(), startResourceRes.getSid())
- .block();
-
- } catch (AgoraException e) {
- System.out.printf("agora error:%s", e.getMessage());
- return;
- } catch (Exception e) {
- System.out.printf("unknown error:%s", e.getMessage());
- return;
- }
-
- if (queryResourceRes == null || queryResourceRes.getServerResponse() == null) {
- System.out.println("failed to query resource");
- return;
}
-
- System.out.println("query resource success");
-
- Thread.sleep(3000);
-
- StopResourceRes stopResourceRes;
-
- // Stop resource
- try {
- stopResourceRes = cloudRecordingClient
- .mixScenario()
- .stop(cname, uid, startResourceRes.getResourceId(), startResourceRes.getSid(),
- true)
- .block();
- } catch (AgoraException e) {
- System.out.printf("agora error:%s", e.getMessage());
- return;
- } catch (Exception e) {
- System.out.printf("unknown error:%s", e.getMessage());
- return;
- }
-
- // Check if the response is null
- if (stopResourceRes == null || stopResourceRes.getSid() == null) {
- System.out.println("failed to stop resource");
- } else {
- System.out.println("stop resource success");
- }
-
- }
}
```
@@ -272,14 +269,14 @@ This project welcomes and accepts contributions. If you encounter any issues or
This project uses Semantic Versioning (SemVer) to manage versions. The format is MAJOR.MINOR.PATCH.
-* MAJOR version indicates incompatible changes.
-* MINOR version indicates backward-compatible new features or enhancements.
-* PATCH version indicates backward-compatible bug fixes and maintenance.
-For more details, please refer to the [Semantic Versioning](https://semver.org) specification.
+- MAJOR version indicates incompatible changes.
+- MINOR version indicates backward-compatible new features or enhancements.
+- PATCH version indicates backward-compatible bug fixes and maintenance.
+ For more details, please refer to the [Semantic Versioning](https://semver.org) specification.
## References
-* [Agora API Documentation](https://docs.agora.io/en/)
+- [Agora API Documentation](https://docs.agora.io/en/)
## License
diff --git a/README_ZH.md b/README_ZH.md
index b93b40c..c9a8886 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -9,32 +9,32 @@
- [English](./README.md) | 简体中文
+[English](./README.md) | 简体中文
`agora-rest-client-java`是用 Java 语言编写的一个开源项目,专门为 Agora REST API 设计。它包含了 Agora 官方提供的 REST
API 接口的包装和内部实现,可以帮助开发者更加方便的集成服务端 Agora REST API。
> [!IMPORTANT]
-该SDK经过一些测试以确保其基本功能正常运作。然而,由于软件开发的复杂性,我们无法保证它是完全没有缺陷的,我们鼓励社区的开发者和用户积极参与,共同改进这个项目。
+> 该 SDK 经过一些测试以确保其基本功能正常运作。然而,由于软件开发的复杂性,我们无法保证它是完全没有缺陷的,我们鼓励社区的开发者和用户积极参与,共同改进这个项目。
## 特性
-* 封装了 Agora REST API 的请求和响应处理,简化与 Agora REST API 的通信流程
-* 当遇到 DNS 解析失败、网络错误或者请求超时等问题的时候,提供了自动切换最佳域名的能力,以保障请求 REST API 服务的可用性
-* 提供了易于使用的 API,可轻松地实现调用 Agora REST API 的常见功能,如开启云录制、停止云录制等
-* 基于 Java 语言,具有异步性、并发性和可扩展性
+- 封装了 Agora REST API 的请求和响应处理,简化与 Agora REST API 的通信流程
+- 当遇到 DNS 解析失败、网络错误或者请求超时等问题的时候,提供了自动切换最佳域名的能力,以保障请求 REST API 服务的可用性
+- 提供了易于使用的 API,可轻松地实现调用 Agora REST API 的常见功能,如开启云录制、停止云录制等
+- 基于 Java 语言,具有异步性、并发性和可扩展性
## 支持的服务
-* [云端录制 Cloud Recording](./agora-rest-client-core/src/main/java/io/agora/rest/services/cloudrecording/README.md)
-* [对话式 AI 引擎 Conversationsal AI Engine](./agora-rest-client-core/src/main/java/io/agora/rest/services/convoai/README_ZH.md)
+- [云端录制 Cloud Recording](./agora-rest-client-core/src/main/java/io/agora/rest/services/cloudrecording/README.md)
+- [对话式 AI 引擎 Conversationsal AI Engine](./agora-rest-client-core/src/main/java/io/agora/rest/services/convoai/README_ZH.md)
## 环境准备
-* [Java 1.8 或以上版本](https://www.java.com)
-* 在声网 [Console 平台](https://console.shengwang.cn/)申请的 App ID 和 App Certificate
-* 在声网 [Console 平台](https://console.shengwang.cn/)的 Basic Auth 认证信息
-* 在声网 [Console 平台](https://console.shengwang.cn/)开启相关的服务能力
+- [Java 1.8 或以上版本](https://www.java.com)
+- 在声网 [Console 平台](https://console.shengwang.cn/)申请的 App ID 和 App Certificate
+- 在声网 [Console 平台](https://console.shengwang.cn/)的 Basic Auth 认证信息
+- 在声网 [Console 平台](https://console.shengwang.cn/)开启相关的服务能力
## 安装
@@ -56,10 +56,10 @@ API 接口的包装和内部实现,可以帮助开发者更加方便的集成
package com.company.example;
import io.agora.rest.AgoraException;
-import io.agora.rest.core.AgoraConfig;
import io.agora.rest.core.BasicAuthCredential;
import io.agora.rest.core.Credential;
import io.agora.rest.core.DomainArea;
+import io.agora.rest.services.cloudrecording.CloudRecordingConfig;
import io.agora.rest.services.cloudrecording.api.req.StartResourceReq;
import io.agora.rest.services.cloudrecording.api.res.AcquireResourceRes;
import io.agora.rest.services.cloudrecording.api.res.StartResourceRes;
@@ -73,192 +73,189 @@ import java.util.Arrays;
import java.util.Collections;
public class Main {
- private static String appId = "";
+ private static String appId = "";
- private static String cname = "";
+ private static String cname = "";
- private static String uid = "";
+ private static String uid = "";
- private static String username = "";
+ private static String username = "";
- private static String password = "";
+ private static String password = "";
- private static String token = "";
+ private static String token = "";
- private static String accessKey = "";
+ private static String accessKey = "";
- private static String secretKey = "";
+ private static String secretKey = "";
- private static Integer region = 0; //
+ private static Integer region = 0; //
- private static String bucket = "";
+ private static String bucket = "";
- private static Integer vendor = 0; //
+ private static Integer vendor = 0; //
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws Exception {
- Credential credential = new BasicAuthCredential(username, password);
+ Credential credential = new BasicAuthCredential(username, password);
- // Initialize AgoraConfig
- AgoraConfig agoraConfig = AgoraConfig.builder()
- .appId(appId)
- .credential(credential)
- // Specify the region where the server is located.
- // Optional values are CN, US, EU, AP, and the client will automatically
- // switch to use the best domain name according to the configured region
- .domainArea(DomainArea.CN)
- .build();
+ // Initialize CloudRecordingConfig
+ CloudRecordingConfig agoraConfig = CloudRecordingConfig.builder()
+ .appId(appId)
+ .credential(credential)
+ // Specify the region where the server is located.
+ // Optional values are CN, US, EU, AP, and the client will automatically
+ // switch to use the best domain name according to the configured region
+ .domainArea(DomainArea.CN)
+ .build();
- // Initialize CloudRecordingClient
+ // Initialize CloudRecordingClient
- CloudRecordingClient cloudRecordingClient = CloudRecordingClient.create(agoraConfig);
+ CloudRecordingClient cloudRecordingClient = CloudRecordingClient.create(agoraConfig);
+ AcquireResourceRes acquireResourceRes;
- AcquireResourceRes acquireResourceRes;
-
- // Acquire resource
- try {
- acquireResourceRes = cloudRecordingClient
- .mixScenario()
- .acquire(cname, uid, AcquireMixRecordingResourceClientReq.builder()
- .build())
- .block();
- } catch (AgoraException e) {
- System.out.printf("agora error:%s", e.getMessage());
- return;
- } catch (Exception e) {
- System.out.printf("unknown error:%s", e.getMessage());
- return;
- }
-
- // Check if the response is null
- if (acquireResourceRes == null || acquireResourceRes.getResourceId() == null) {
- System.out.println("failed to get resource");
- return;
- }
-
-
- System.out.printf("resourceId:%s", acquireResourceRes.getResourceId());
-
- System.out.println("acquire resource success");
-
- // Define storage config
- StartResourceReq.StorageConfig storageConfig = StartResourceReq.StorageConfig.builder()
- .accessKey(accessKey)
- .secretKey(secretKey)
- .bucket(bucket)
- .vendor(vendor)
- .region(region)
- .build();
-
- // Define start resource request
- StartMixRecordingResourceClientReq startResourceReq = StartMixRecordingResourceClientReq.builder()
- .token(token)
- .recordingConfig(StartResourceReq.RecordingConfig.builder()
- .channelType(1)
- .streamTypes(2)
- .maxIdleTime(30)
- .audioProfile(2)
- .transcodingConfig(StartResourceReq.TranscodingConfig.builder()
- .width(640)
- .height(480)
- .fps(15)
- .bitrate(800)
- .mixedVideoLayout(0)
- .backgroundColor("#000000")
+ // Acquire resource
+ try {
+ acquireResourceRes = cloudRecordingClient
+ .mixScenario()
+ .acquire(cname, uid, AcquireMixRecordingResourceClientReq.builder()
.build())
- .subscribeAudioUIDs(Collections.singletonList("#allstream#"))
- .subscribeVideoUIDs(Collections.singletonList("#allstream#"))
- .build())
- .recordingFileConfig(StartResourceReq.RecordingFileConfig.builder()
- .avFileType(Arrays.asList("hls", "mp4"))
- .build())
- .storageConfig(storageConfig)
- .build();
-
-
- StartResourceRes startResourceRes;
-
- // Start resource
- try {
- startResourceRes = cloudRecordingClient
- .mixScenario()
- .start(cname, uid,
- acquireResourceRes.getResourceId(),
- startResourceReq)
- .block();
-
- } catch (AgoraException e) {
- System.out.printf("agora error:%s", e.getMessage());
- return;
- } catch (Exception e) {
- System.out.printf("unknown error:%s", e.getMessage());
- return;
- }
-
- // Check if the response is null
- if (startResourceRes == null || startResourceRes.getSid() == null) {
- System.out.println("failed to start resource");
- return;
- }
-
- System.out.printf("sid:%s", startResourceRes.getSid());
-
- System.out.println("start resource success");
+ .block();
+ } catch (AgoraException e) {
+ System.out.printf("agora error:%s", e.getMessage());
+ return;
+ } catch (Exception e) {
+ System.out.printf("unknown error:%s", e.getMessage());
+ return;
+ }
+
+ // Check if the response is null
+ if (acquireResourceRes == null || acquireResourceRes.getResourceId() == null) {
+ System.out.println("failed to get resource");
+ return;
+ }
+
+ System.out.printf("resourceId:%s", acquireResourceRes.getResourceId());
+
+ System.out.println("acquire resource success");
+
+ // Define storage config
+ StartResourceReq.StorageConfig storageConfig = StartResourceReq.StorageConfig.builder()
+ .accessKey(accessKey)
+ .secretKey(secretKey)
+ .bucket(bucket)
+ .vendor(vendor)
+ .region(region)
+ .build();
+
+ // Define start resource request
+ StartMixRecordingResourceClientReq startResourceReq = StartMixRecordingResourceClientReq.builder()
+ .token(token)
+ .recordingConfig(StartResourceReq.RecordingConfig.builder()
+ .channelType(1)
+ .streamTypes(2)
+ .maxIdleTime(30)
+ .audioProfile(2)
+ .transcodingConfig(StartResourceReq.TranscodingConfig.builder()
+ .width(640)
+ .height(480)
+ .fps(15)
+ .bitrate(800)
+ .mixedVideoLayout(0)
+ .backgroundColor("#000000")
+ .build())
+ .subscribeAudioUIDs(Collections.singletonList("#allstream#"))
+ .subscribeVideoUIDs(Collections.singletonList("#allstream#"))
+ .build())
+ .recordingFileConfig(StartResourceReq.RecordingFileConfig.builder()
+ .avFileType(Arrays.asList("hls", "mp4"))
+ .build())
+ .storageConfig(storageConfig)
+ .build();
+
+ StartResourceRes startResourceRes;
+
+ // Start resource
+ try {
+ startResourceRes = cloudRecordingClient
+ .mixScenario()
+ .start(cname, uid,
+ acquireResourceRes.getResourceId(),
+ startResourceReq)
+ .block();
+
+ } catch (AgoraException e) {
+ System.out.printf("agora error:%s", e.getMessage());
+ return;
+ } catch (Exception e) {
+ System.out.printf("unknown error:%s", e.getMessage());
+ return;
+ }
+
+ // Check if the response is null
+ if (startResourceRes == null || startResourceRes.getSid() == null) {
+ System.out.println("failed to start resource");
+ return;
+ }
+
+ System.out.printf("sid:%s", startResourceRes.getSid());
+
+ System.out.println("start resource success");
+
+ Thread.sleep(3000);
+
+ QueryMixHLSAndMP4RecordingResourceRes queryResourceRes;
+
+ // Query resource
+ try {
+ queryResourceRes = cloudRecordingClient
+ .mixScenario()
+ .queryHLSAndMP4(startResourceRes.getResourceId(), startResourceRes.getSid())
+ .block();
+
+ } catch (AgoraException e) {
+ System.out.printf("agora error:%s", e.getMessage());
+ return;
+ } catch (Exception e) {
+ System.out.printf("unknown error:%s", e.getMessage());
+ return;
+ }
+
+ if (queryResourceRes == null || queryResourceRes.getServerResponse() == null) {
+ System.out.println("failed to query resource");
+ return;
+ }
+
+ System.out.println("query resource success");
+
+ Thread.sleep(3000);
+
+ StopResourceRes stopResourceRes;
+
+ // Stop resource
+ try {
+ stopResourceRes = cloudRecordingClient
+ .mixScenario()
+ .stop(cname, uid, startResourceRes.getResourceId(), startResourceRes.getSid(),
+ true)
+ .block();
+ } catch (AgoraException e) {
+ System.out.printf("agora error:%s", e.getMessage());
+ return;
+ } catch (Exception e) {
+ System.out.printf("unknown error:%s", e.getMessage());
+ return;
+ }
+
+ // Check if the response is null
+ if (stopResourceRes == null || stopResourceRes.getSid() == null) {
+ System.out.println("failed to stop resource");
+ } else {
+ System.out.println("stop resource success");
+ }
- Thread.sleep(3000);
-
- QueryMixHLSAndMP4RecordingResourceRes queryResourceRes;
-
- // Query resource
- try {
- queryResourceRes = cloudRecordingClient
- .mixScenario()
- .queryHLSAndMP4(startResourceRes.getResourceId(), startResourceRes.getSid())
- .block();
-
- } catch (AgoraException e) {
- System.out.printf("agora error:%s", e.getMessage());
- return;
- } catch (Exception e) {
- System.out.printf("unknown error:%s", e.getMessage());
- return;
}
-
- if (queryResourceRes == null || queryResourceRes.getServerResponse() == null) {
- System.out.println("failed to query resource");
- return;
- }
-
- System.out.println("query resource success");
-
- Thread.sleep(3000);
-
- StopResourceRes stopResourceRes;
-
- // Stop resource
- try {
- stopResourceRes = cloudRecordingClient
- .mixScenario()
- .stop(cname, uid, startResourceRes.getResourceId(), startResourceRes.getSid(),
- true)
- .block();
- } catch (AgoraException e) {
- System.out.printf("agora error:%s", e.getMessage());
- return;
- } catch (Exception e) {
- System.out.printf("unknown error:%s", e.getMessage());
- return;
- }
-
- // Check if the response is null
- if (stopResourceRes == null || stopResourceRes.getSid() == null) {
- System.out.println("failed to stop resource");
- } else {
- System.out.println("stop resource success");
- }
-
- }
}
```
@@ -267,13 +264,14 @@ public class Main {
## 集成遇到困难,该如何联系声网获取协助
-> 方案1:如果您已经在使用声网服务或者在对接中,可以直接联系对接的销售或服务
+> 方案 1:如果您已经在使用声网服务或者在对接中,可以直接联系对接的销售或服务
>
-> 方案2:发送邮件给 [support@agora.io](mailto:support@agora.io) 咨询
+> 方案 2:发送邮件给 [support@agora.io](mailto:support@agora.io) 咨询
>
-> 方案3:扫码加入我们的微信交流群提问
+> 方案 3:扫码加入我们的微信交流群提问
>
>
+
---
## 贡献
@@ -284,15 +282,15 @@ public class Main {
本项目使用语义化版本号规范 (SemVer) 来管理版本。格式为 MAJOR.MINOR.PATCH。
-* MAJOR 版本号表示不向后兼容的重大更改。
-* MINOR 版本号表示向后兼容的新功能或增强。
-* PATCH 版本号表示向后兼容的错误修复和维护。
- 有关详细信息,请参阅 [语义化版本](https://semver.org/lang/zh-CN/) 规范。
+- MAJOR 版本号表示不向后兼容的重大更改。
+- MINOR 版本号表示向后兼容的新功能或增强。
+- PATCH 版本号表示向后兼容的错误修复和维护。
+ 有关详细信息,请参阅 [语义化版本](https://semver.org/lang/zh-CN/) 规范。
## 参考
-* [声网 API 文档](https://doc.shengwang.cn/)
+- [声网 API 文档](https://doc.shengwang.cn/)
## 许可证
-该项目使用MIT许可证,详细信息请参阅LICENSE文件。
+该项目使用 MIT 许可证,详细信息请参阅 LICENSE 文件。