Skip to content

Commit

Permalink
Merge pull request #21 from vincent3q/release/2.3.3
Browse files Browse the repository at this point in the history
Update Readme and Add Readme_zh.md
  • Loading branch information
vincent3q authored May 13, 2019
2 parents 03abf54 + ce6a069 commit d5c2372
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 16 deletions.
9 changes: 5 additions & 4 deletions On-Premise-Recording-C++/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Agora Linux Server Recording

*Read this in other languages: [中文](README.zh.md)*
*Read this in other languages: [中文](README_zh.md)*

This sample application for the Agora Recording SDK enables recording on your Linux server.

Expand Down Expand Up @@ -42,6 +42,7 @@ To open and build the sample application, first integrate the Agora SDK.
`bin/AgoraCoreService` file|Copy to`bin` folder
`libs/librecorder.a` file|Copy to `libs` folder
`samples/agorasdk` folder|Copy to `samples` folder
`samples/base` folder|Copy to `samples` folder
`samples/cpp` folder|Copy to `samples` folder
`samples/java` folder| Copy to `samples` folder

Expand Down Expand Up @@ -97,10 +98,10 @@ cmds ./Record_local
```

## Resources
- A detailed code walkthrough for this sample is available in [Steps to Create this Sample](./guide.md).
- A detailed code walkthrough for this sample is available in [Steps to Create this Sample](./guide.md).
- See full API documentation in the [Document Center](https://docs.agora.io/en/)
- [File bugs about this sample](https://github.com/AgoraIO/Basic-Recording/issues)
- See [detailed Agora Linux Recording guides](https://docs.agora.io/en/2.3.1/addons/Recording/Quickstart%20Guide/recording_cpp?platform=C%2B%2B)
- See [detailed Agora Linux Recording guides](https://docs.agora.io/en/Recording/recording_integrate_cpp?platform=CPP)

## License
This software is licensed under the MIT License (MIT). [View the license](LICENSE.md).
This software is licensed under the MIT License (MIT). [View the license](LICENSE.md).
73 changes: 61 additions & 12 deletions On-Premise-Recording-C++/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,80 @@

*Read this in other languages: [English](README.md)*

#详细信息请参考 [录制快速入门](https://docs.agora.io/cn/user_guide/communication/recording_qs.html)

##准备工作
## 准备工作

请确保满足以下操作系统要求:
- Ubuntu 12.04 x64 或更高版本
- CentOS 6.5 x64 或更高版本
- gcc 4.4 或更高版本。
- 与公网互通,并能够访问`qos.agoralab.co`
- 每一个录制频道至少1MB+的带宽

## 快速开始

Ubuntu 12.04 x64 或更高版本
CentOS 6.5 x64 或更高版本
### 创建Agora账号并获取App ID
-[Agora开发者中心](https://dashboard.agora.io/cn/signup/) 注册账号
-[我的主页]-->[项目管理]创建自己的项目,获取到 AppID
- 该AppID用于运行Agora应用程序

**Note:** 该AppID用于运行你的Agora项目,请妥善保存,勿外泄。

#请确保满足以下编译器要求: gcc 4.4 或更高版本。
### 下载Agora Recording SDK
- 下载[录制SDK](https://docs.agora.io/cn/Agora%20Platform/downloads)
- 解压下载的SDK包
- 将解压后的文件/文件夹拷贝到相应的项目应用中:

#准备一个 App ID,在 [Agora.io 注册](https://dashboard.agora.io/cn/signup/) 注册账号,并创建自己的测试项目,获取到 AppID。
SDK 路径|Sample 路径
----|----
`bin/AgoraCoreService` 文件|拷贝到`bin` 文件夹
`libs/librecorder.a` 文件|拷贝到 `libs` 文件夹
`samples/agorasdk` 文件夹|拷贝到 `samples` 文件夹
`samples/base` 文件夹|拷贝到 `samples` 文件夹
`samples/cpp` 文件夹|拷贝到 `samples` 文件夹
`samples/java` 文件夹| 拷贝到 `samples` 文件夹

- 将下面项目中下面的文件替换成下载的SDK包里的文件
- `include` 文件夹
- `tools` 文件夹
- `base` 文件夹

### 编译运行

##编译运行
1. 确保以下的UDP端口是打开的(这些端口用来与Agora服务器之间通信)
- 4001
- 4030
- 1080
- 8000
- 25000

2. 确保本地端口没有被防火墙禁掉。如果启用了防火墙,则需要放开Agora录制SDK设定的端口范围。你可以为多个录制进程统一配置较大的端口范围(Agora 建议 40000 ~ 41000 或更大)。此时,录制 SDK 会在指定范围内分配录制端口。设置端口范围,你需要配置参数 lowUdpPort 和highUdpPort。

端口类型|范围
----|----
接收码流端口|40000 - 41000
Low UDP Port|40000
High UDP Port|41000

3. 进入`samples/cpp`目录下,执行以下命令进行编译,编译成功后你讲看到`record_local`可执行程序
`make`

- 把lib下的库解压
- 进入samples 的路径下执行以下命令进行编译。
4. 运行`./record_local`,即可看到相关用法,填上相应的参数即可进行录制
```
./recorder_local --appId APPID --uid 0 --channel mychannel --appliteDir PATH-TO-PROJECT/bin/AgoraCoreService
```

make
## 快速通道
**当前sample**
-`libs`文件夹内的`libRecordEngine.tar.gz`解压
- 进入`samples`,执行`make`编译,然后运行编译生成的`./Record_local`, 即可看到相关用法

##运行 ./Record_local, 即可看到相关用法
**解压下载的最新版[录制SDK](https://docs.agora.io/cn/Agora%20Platform/downloads)**
- C++版:进入`samples/cpp`后,执行`make`编译,然后运行编译生成的`./record_local`, 即可看到相关用法
- Java版:进入`samples/java`后,按照文件夹中的ReadMe编译,编译生成的文件在目录`samples/java/bin`中,进入该目录执行`java -Djava.library.path=io/agora/recording/ RecordingSample`,即可看到相关用法

## 联系我们

- 详细信息请参考 [录制快速入门](https://docs.agora.io/cn/Recording/product_recording?platform=All%20Platforms)
- 完整的 API 文档见 [文档中心](https://docs.agora.io/cn/)
- 如果在集成中遇到问题, 你可以到 [开发者社区](https://dev.agora.io/cn/) 提问
- 如果有售前咨询问题, 可以拨打 400 632 6626,或加入官方Q群 12742516 提问
Expand Down
7 changes: 7 additions & 0 deletions On-Premise-Recording-Nodejs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Agora Restful Recording Nodejs

*Read this in other languages: [中文](README_zh.md)*

This sample application works as a simple restful server to manage recording in an easy way.

## Prerequisites
Expand Down Expand Up @@ -96,6 +98,11 @@ Parameters:
|channel |Y |string | channel name |
|key |N |string | key if certificate is enalbed for your appid |

Example:
```
curl -i -X POST -H "Content-type: application/json" --data '{"appid":"XXXXX","channel":"XXXX","key":"XXXX"}' 127.0.0.1:3000/recorder/v1/start
```

Sample Response:

```
Expand Down
149 changes: 149 additions & 0 deletions On-Premise-Recording-Nodejs/README_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Agora Restful Recording Nodejs

*Read this in other languages: [English](README.md)*

该文档介绍如何以Restful API的形式快速实现录制。

## 准备工作
请确保满足以下操作系统要求:
- Ubuntu 12.04 x64 或更高版本 或者 CentOS 6.5 x64 或更高版本(推荐CentOS 7)
- GCC 4.4+
- NodeJS 8.9+
- 与公网互通,并且能够访问`qos.agoralab.co`
- 每一个录制频道至少1MB+的带宽

## 架构
![架构](https://github.com/AgoraIO/Basic-Recording/blob/master/Agora-Restful-Recording-Nodejs/architecture.png)

## 快速开始
### 背景知识
该项目依赖于你已经了解了如何使用Agora录制SDK。或者再开始之前阅读[这里](https://github.com/AgoraIO/Basic-Recording/tree/master/Agora-LinuxServer-Recording)

### 下载 Agora 录制 SDK

* 下载[Agora 录制 SDK](https://www.agora.io/en/download/).
* 解压下载的SDK包.
* 把解压后的子文件夹拷贝到目录 `record/src/sdk`
* 运行`npm install -g node-gyp` 安装编译工具
* 切换到目录 `record`, 运行`build.sh` (运行`build_debug.sh`可编译debug版)。如果一切运行顺利,你会在`record`目录内看到`agorasdk.node`


## 运行录制 Sample
### 快速开始
* 进入目录`record`
* 确保 `agorasdk.node`已经正确的编译
* 更改目录下文件 `sdkdemo.js`, 替换里面的App ID

```
fs.mkdir(storageDir, {recursive: true}, err => {
//join channel
rec.joinChannel(null, "agoratest", 0, YOUR_APP_ID, storageDir);
})
```
* 运行 `node sdkdemo.js`, 你会看到生成的`output`文件夹。该演示Demo仅运行50秒便退出声网频道

### 调整布局
录制的布局通过方法 `setMixedLayout`调整。关于布局,详情参考:[video_mixing_layout](https://docs.agora.io/cn/Recording/API%20Reference/recording_cpp/structagora_1_1linuxsdk_1_1_video_mixing_layout.html)

当有用户加入频道或者频道内用户退出时都会更新布局

```
rec.on("userjoin", function(uid) {
//rearrange layout when user leaves
console.log(`userleave ${uid}`);
layout.regions = layout.regions.filter(function(region){
return region.uid !== uid
})
rec.setMixLayout(layout);
});
```

```
rec.on("userleave", function(uid) {
//rearrange layout when user leaves
console.log(`userleave ${uid}`);
//... adding user to layout
rec.setMixLayout(layout);
});
```

## 运行Restful Server
### 快速开始
* 确保 `agorasdk.node``record` 已经被正确编译
* 切换到`server` 目录
* 运行 `npm install`安装依赖库
* 运行 `node app.js`

### 预定义 APIs
#### 开始录制

- `http://localhost:3000/recorder/v1/start`

方法:

- POST

参数:


|参数名|是否必须|类型|描述|
|:---- |:---|:----- |----- |
|appid ||string |Agora AppId |
|channel ||string | 频道名 |
|key ||string |取决于你是否开启了App ID Certificate |

参考:
```
curl -i -X POST -H "Content-type: application/json" --data '{"appid":"XXXXX","channel":"XXXX","key":"XXXX"}' 127.0.0.1:3000/recorder/v1/start
```

Sample 应答:

```
{
"success": true,
"sid": "ec8711fb-cd98-4411-a430-a0e8de2c6e98"
}
```

应答 属性:

|名称|类型|描述|
|:----|:----- |----- |
|success |bool |执行结果 |
|sid |string | 录制sessionId,用于结束录制 |

#### 结束录制

- `http://localhost:3000/recorder/v1/stop`

方法:

- POST

参数:


|名称|是否必须|类型|描述|
|:---- |:---|:----- |----- |
|sid ||string |开启录制时的sessionId |

Sample 应答:

```
{
"success": true
}
```

应答 属性:

|名称|类型|描述|
|:----|:----- |----- |
|success |bool |执行结果 |

## 联系我们
- 完整的 API 文档见 [文档中心](https://docs.agora.io/en/)
- 如果在集成中遇到问题, 你可以到[开发者社区](https://github.com/AgoraIO/Basic-Recording/issues)提问
- 详情请参考 [录制快速入门](https://docs.agora.io/en/2.3.1/addons/Recording/Quickstart%20Guide/recording_cpp?platform=C%2B%2B)

0 comments on commit d5c2372

Please sign in to comment.