Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 29, 2023
1 parent 495e5f8 commit 7ee5891
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 17 deletions.
74 changes: 63 additions & 11 deletions i18n/zh-cn/docusaurus-plugin-content-pages/faq-srs-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,19 +683,18 @@ docker exec -it srs-stack curl http://your-target-URL

### HTTP Callback: on_publish

对于回调事件`on_publish`,协议定义如下:
For HTTP callback `on_publish` event:

```json
Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_unpublish",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream",
"param": "?secret=8f7605d657c74d69b6b48f532c469bc9",
"server_id": "vid-f91k836",
"client_id": "e8d29ue3"
"param": "?secret=8f7605d657c74d69b6b48f532c469bc9"
}

Response:
Expand All @@ -704,24 +703,73 @@ Response:
}
```

* 返回成功,则允许推流。
* 返回失败,则禁止推流。
* Allow publishing if response success.
* Reject publishing if response error.

### HTTP Callback: on_unpublish

对于回调事件`on_unpublish`,协议定义如下:
For HTTP callback `on_unpublish` event:

```json
Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_unpublish",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream"
}

Response:
{
"code": 0
}
```

* Ignore any response error.

### HTTP Callback: on_record_begin

For HTTP callback `on_record_begin` event:

```json
Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_record_begin",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream",
"uuid": "824b96f9-8d51-4046-ba1e-a9aec7d57c95"
}

Response:
{
"code": 0
}
```

* Ignore any response error.

### HTTP Callback: on_record_end

For HTTP callback `on_record_end` event:

```json
Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_record_end",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream",
"param": "?secret=8f7605d657c74d69b6b48f532c469bc9",
"server_id": "vid-f91k836",
"client_id": "e8d29ue3"
"uuid": "824b96f9-8d51-4046-ba1e-a9aec7d57c95",
"artifact_code": 0,
"artifact_path": "/data/record/824b96f9-8d51-4046-ba1e-a9aec7d57c95/index.mp4",
"artifact_url": "http://localhost:2022/terraform/v1/hooks/record/hls/824b96f9-8d51-4046-ba1e-a9aec7d57c95/index.mp4"
}

Response:
Expand All @@ -730,7 +778,11 @@ Response:
}
```

* 错误时忽略。
* The `uuid` is the UUID of record task.
* The `artifact_code` indicates the error code. If no error, it's 0.
* The `artifact_path` is the path of artifact mp4 in the container.
* The `artifact_url` is the URL path to access the artifact mp4.
* Ignore any response error.

<a name='changelog'></a><br/><br/><br/>

Expand Down
64 changes: 58 additions & 6 deletions src/pages/faq-srs-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -806,14 +806,13 @@ For HTTP callback `on_publish` event:
```json
Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_unpublish",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream",
"param": "?secret=8f7605d657c74d69b6b48f532c469bc9",
"server_id": "vid-f91k836",
"client_id": "e8d29ue3"
"param": "?secret=8f7605d657c74d69b6b48f532c469bc9"
}

Response:
Expand All @@ -832,14 +831,63 @@ For HTTP callback `on_unpublish` event:
```json
Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_unpublish",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream"
}

Response:
{
"code": 0
}
```

* Ignore any response error.

### HTTP Callback: on_record_begin

For HTTP callback `on_record_begin` event:

```json
Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_record_begin",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream",
"uuid": "824b96f9-8d51-4046-ba1e-a9aec7d57c95"
}

Response:
{
"code": 0
}
```

* Ignore any response error.

### HTTP Callback: on_record_end

For HTTP callback `on_record_end` event:

```json
Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_record_end",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream",
"param": "?secret=8f7605d657c74d69b6b48f532c469bc9",
"server_id": "vid-f91k836",
"client_id": "e8d29ue3"
"uuid": "824b96f9-8d51-4046-ba1e-a9aec7d57c95",
"artifact_code": 0,
"artifact_path": "/data/record/824b96f9-8d51-4046-ba1e-a9aec7d57c95/index.mp4",
"artifact_url": "http://localhost:2022/terraform/v1/hooks/record/hls/824b96f9-8d51-4046-ba1e-a9aec7d57c95/index.mp4"
}

Response:
Expand All @@ -848,6 +896,10 @@ Response:
}
```

* The `uuid` is the UUID of record task.
* The `artifact_code` indicates the error code. If no error, it's 0.
* The `artifact_path` is the path of artifact mp4 in the container.
* The `artifact_url` is the URL path to access the artifact mp4.
* Ignore any response error.

<a name='changelog'></a><br/><br/><br/>
Expand Down

0 comments on commit 7ee5891

Please sign in to comment.