add-channel-sink
Use the interface to add outputs. Protocols can be:
- RTMP/RTMPS
- SRT Listener
- SRT Caller
Only available for users with administrative rights.
Prototype
Protocol |
HTTP/HTTPS POST |
URL |
ip[:port]/sc_cloud/channel/add-sink |
Data Format |
Request: Content-Type: application/json Response: Content-Type: application/json |
Request Cookies
Parameter |
Description |
mwcloud-sid |
A string value that is used to uniquely identify user logged-in. |
mwcloud-uid |
Current logged-in username. |
Request Body
Parameter |
Description |
id |
Stream ID. You can add output streams by using add-channel and obtain the IDs by using get-channels. |
protocol |
Detailed information of protocol stream. |
protocol
Parameter |
Description |
name |
Output stream name. |
is-enable |
Whether auto-streaming is enabled. The default value is 1. |
type |
Stream type. The options are - 1: RTMP/RTMPS
- 2: SRT Caller
- 3: SRT Listener
|
rtmp |
When type=1, Request Body refers to RTMP/RTMPS. |
srt |
When type=2, Request Body refers to SRT Caller. When type=3, Request Body refers to SRT Listener. |
rtmp
Parameter |
Description |
type |
Constant value: 1. |
url |
Source URL. |
key |
Input stream key. |
is-auth |
Authentication state. - 0: disabled.
- 1: enabled. User name and password are required.
|
user |
User name. |
passwd |
Password. |
srt
Parameter |
Description |
ip |
IP address or domain name. When type is SRT Listener, IP address is "0.0.0.0". |
port |
Port numbers range from 1 to 65535. |
latency |
Latency ranges from 20 to 8000ms and the default value is 120ms. |
bandwidth |
Cost of overhead in percentage, ranging from 5% to 100% and the default value is 25%. Only available for SRT Caller. |
stream-id |
Stream ID. Only available for SRT Caller. The value ranges from 0 to 256 characters which should be consistent with that of its sender. |
enc-type |
Encryption algorithm. The options are as follows:- 0: not encrypted
- 16: AES-128
- 24: AES-192
- 32: AES-256
The default value is 0. |
enc-pass |
Encryption passphrase. It is 10 to 79 characters when enc-type is not 0. |
Request Example
POST /sc_cloud/channel/add-sink HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 190
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
"id": 13,
"protocol": {
"name": "output-rtmp",
"is-enable": 1,
"type": 1,
"rtmp": {
"type": 1,
"url": "rtmp://10.2.3.63/live",
"key": "",
"is-auth": 1,
"user": "test",
"passwd": "12345678",
"name": "output-rtmp"
}
}
}
POST /sc_cloud/channel/add-sink HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 225
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
"id": 13,
"protocol": {
"name": "output-srt caller",
"is-enable": 1,
"type": 2,
"srt": {
"ip": "10.0.2.3",
"port": 678,
"latency": 120,
"enc-type": 16,
"enc-pass": "passphrase",
"stream-id": "stream id",
"bandwidth": 25,
"name": "output-srt caller"
}
}
}
POST /sc_cloud/channel/add-sink HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 178
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
"id": 13,
"protocol": {
"name": "output-srt listener",
"is-enable": 1,
"type": 3,
"srt": {
"ip": "0.0.0.0",
"port": 666,
"latency": 120,
"enc-type": 0,
"enc-pass": "",
"name": "output-srt listener"
}
}
}
Response Parameters
Parameter |
Description |
Content-Type |
Value: 'application/json; charset=UTF-8' |
Response Body
Parameter |
Description |
result |
Result code. The options are as follows:- 0: success.
- Other values. For details about the result codes, please refer to API Status.
|
method |
add-channel-sink |
Response Example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 40
Connection: keep-alive
{
"method": "add-channel-sink",
"result": 0
}