add-channel
Use the interface to add input sources. Protocol streams include:
Only available for users with administrative rights.
Prototype
Protocol |
HTTP/HTTPS POST |
URL |
ip[:port]/sc_cloud/channel/add |
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 |
name |
Protocol stream name. The string range is as follows. - 1 to 32 characters;
- uppercase and lowercase letters, numbers, special symbols including ._-+'[]() and spaces.
- It can not start or end with spaces.
|
protocol |
Detailed information of protocol stream. |
protocol
Parameter |
Description |
name |
Input stream name: def-channel-src-name. It can not be modified. |
is-enable |
Whether the input switch is enabled. The default value is 1. |
type |
Input protocol stream. The options are - 1: RTMP/RTMPS
- 3: SRT Listener
|
rtmp |
When type=1, Request Body refers to RTMP/RTMPS. |
srt |
When type=3, Request Body refers to SRT Listener. |
rtmp
Parameter |
Description |
type |
Constant value: 1. |
url |
RTMP server URL. |
key |
Stream key. |
is-auth |
Whether authentication is enabled. - 0: disabled.
- 1: enabled. User name and password are required.
|
user |
User name. |
passwd |
Password. |
srt
Parameter |
Description |
ip |
0.0.0.0 |
port |
Port number ranges from 1 to 65535. |
latency |
Latency time ranges from 20ms to 8000ms and the default value is 120ms. |
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 0. |
Request Example
POST /sc_cloud/channel/add HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 179
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
"name": "rtmp push",
"protocol": {
"name": "def-channel-src-name",
"is-enable": 1,
"type": 1,
"rtmp": {
"type": 1,
"url": "rtmp://127.0.0.1/live",
"key": "test",
"is-auth": 0,
"user": "",
"passwd": ""
}
}
}
POST /sc_cloud/channel/add HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 179
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
"name": "srt listener",
"protocol": {
"name": "def-channel-src-name",
"is-enable": 1,
"type": 3,
"srt": {
"ip": "0.0.0.0",
"port": 3522,
"latency": 120,
"enc-type": 16,
"enc-pass": "ddddddddddddd"
}
}
}
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.
|
id |
Stream ID |
method |
add-channel |
Response Example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 43
Connection: keep-alive
{
"id": 13,
"method": "add-channel",
"result": 0
}