Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(cloudRecording):add web recording support to cloud recording service #1

Merged
merged 10 commits into from
Feb 26, 2024
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.18'

- name: Test
run: go test -v ./...

- name: Build
run: go build -v ./...
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ go.work
.idea
.vscode
.DS_Store

**/.env
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
## 安装
使用以下命令从 GitHub 安装依赖:
```shell
go get -u github.com/AgoraIO/agora-rest-client-go
go get -u github.com/AgoraIO-Community/agora-rest-client-go
```
## 使用示例
以调用云录制服务为例:
Expand All @@ -30,9 +30,9 @@ import (
"context"
"log"

"github.com/AgoraIO/agora-rest-client-go/core"
"github.com/AgoraIO/agora-rest-client-go/services/cloudrecording"
v1 "github.com/AgoraIO/agora-rest-client-go/services/cloudrecording/v1"
"github.com/AgoraIO-Community/agora-rest-client-go/core"
"github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording"
v1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions core/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package core
import (
"context"
"fmt"
"slices"
"sync"
"time"
)
Expand Down Expand Up @@ -157,7 +156,7 @@ func (d *DomainPool) NextRegion() {
}

func (d *DomainPool) selectDomain(domain string) {
if slices.Contains(d.domainSuffixes, domain) {
if Contains(d.domainSuffixes, domain) {
d.currentDomain = domain
d.lastUpdate = time.Now()
}
Expand Down
10 changes: 10 additions & 0 deletions core/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package core

func Contains(S []string, E string) bool {
for _, s := range S {
if s == E {
return true
}
}
return false
}
37 changes: 37 additions & 0 deletions examples/cloudrecording/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## CloudRecording Example

> 这是 Agora Cloud Recording 的一个示例项目,使用了 Agora Cloud Recording RESTful API,实现了频道录制的功能。本示例支持合流录制、单流录制和页面录制三种模式。

### 运行示例项目

#### 前提条件

在当前目录创建一个 `.env` 文件,填入以下内容:

```bash
APP_ID=<Your App ID>
BASIC_AUTH_USERNAME=<Your Basic Auth Username>
BASIC_AUTH_PASSWORD=<Your Basic Auth Password>
CNAME=<Your Channel Name>
TOKEN=<Your Token>
UID=<Your UID>
STORAGE_CONFIG_VENDOR=<Your Storage Vendor>
STORAGE_CONFIG_REGION=<Your Storage Region>
STORAGE_CONFIG_BUCKET=<Your Storage Bucket>
STORAGE_CONFIG_ACCESS_KEY=<Your Storage Access Key>
STORAGE_CONFIG_SECRET_KEY=<Your Storage Secret Key>
```
相关的参数可以通过可在 [CloudRecording 服务说明](../../services/cloudrecording/README.md) 查看

#### 执行

通过下面的命令来运行示例项目:

```bash
go run main.go -mode=<mode>
```

其中 `<mode>` 表示运行的云录制模式,以下是 mode 数值对应的录制模式:
* 1: MixRecording 合流录制
* 2: IndividualRecording 单流录制
* 3: WebRecording 页面录制
Loading