get-channels
Use the interface to obtain the task list of stream conversion.
You can get detailed information of a stream when specifying its stream ID in request URL.
An input and multiple outputs can be added to a stream conversion task.
Input source can be the following protocol streams.
1) RTMP/RTMPS
2) SRT Listener
Outputs can be the following protocol streams.
1) RTMP/RTMPS
2) SRT Caller
3) SRT Listener
Prototype
Protocol |
HTTP/HTTPS GET |
URL |
ip[:port]/sc_cloud/scapi/get-channels[?id=xx] |
Data Format |
Response: Content-Type: application/json |
Request URL
Parameters |
Mandatory |
Description |
id |
No |
Stream ID.- With ID: obtain the detailed information of the specified task.
- Without ID: obtain all task list.
|
The following example shows an example of request URL without id.
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 Example
GET /sc_cloud/scapi/get-channels HTTP/1.1
Accept: application/json, text/plain, */*
Connection: keep-alive
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
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.
|
channels |
Shows the conversion task list. |
channels
Parameter |
Description |
id |
Session ID. |
is-enable |
Whether the conversion task is enabled. |
name |
Session 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.
|
source |
Detailed input information. |
sink |
Detailed output(s) information. |
source
Parameter |
Description |
id |
Source ID. |
is-enable |
Whether input source switch is on. |
name |
def-channel-src-name. It can not be modified. |
type |
Source type. The options are - 1: RTMP/RTMPS
- 2: SRT Caller
- 3: SRT Listener
|
status |
Connection status. |
uptime |
Conversion task running time in ms. |
bitrate |
Transmission bitrate in bps. |
rtmp |
Indicates input RTMP/RTMPS stream when type = 1. |
srt |
Indicates input SRT Listener stream when type = 3. |
sink
sink is an Object. It needs to traverse the properties of the object to get the list of output streams under sink.
Parameter |
Description |
id |
Output stream ID. |
is-enable |
Whether output is enabled. |
name |
Output 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.
|
type |
Stream type. The options are - 1: RTMP/RTMPS
- 2: SRT Caller
- 3: SRT Listener
|
status |
Connection status. |
uptime |
Conversion task running time in ms. |
bitrate |
Transmission bitrate in bps. |
rtmp |
Indicates output RTMP/RTMPS stream when type = 1. |
srt |
Indicates output SRT Caller when type = 2. Indicates output SRT Listener stream when type = 3. |
rtmp
Parameter |
Description |
type |
Constant value: 1. |
url |
Server URL. |
key |
Stream key. |
is-auth |
Authentication state. - 0: disabled.
- 1: enabled. User name and password are required.
|
user |
User name. |
passwd |
User password. |
srt
Parameter |
Description |
ip |
IP Address or domain name. For an SRT Caller sink, you need to specify an SRT Listener address. |
port |
Port number ranges from 1 to 65535. |
latency |
Latency time ranges from 20ms to 8000ms. The default value is 120ms. |
bandwidth |
Cost of overhead in percentage, ranging from 5% to 100% and the default value is 25%. |
stream-id |
Stream ID. Only available for SRT Caller. The string 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. |
Status code |
Description |
0 |
Idle. |
1 |
Resolving DNS. |
2 |
Connecting. |
3 |
Handshaking. |
4 |
Connecting stream. |
5 |
Ready. |
6 |
State error. |
7 |
Failed to resolve DNS. |
8 |
Failed to connect to TCP port. |
9 |
Handshake failed. |
10 |
Stream connection failed. |
11 |
Auth failed. |
100 |
Failed to listen on port. |
101 |
Connection interrupted. |
102 |
Remote rejected your request. |
Response Example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"result": 0,
"channels": [
{
"id": 6,
"is-enable": 1,
"name": "Stream Conversion 0001",
"source": {
"id": 8,
"is-enable": 1,
"name": "def-channel-src-name",
"type": 3,
"status": 5,
"bitrate": 0,
"uptime": 0,
"rtmp": {
"type": 0, "url": "", "key": "",
"is-auth": 0, "user": "", "passwd": "", "param": ""
},
"srt": {
"ip": "0.0.0.0", "port": 8666, "latency": 120, "bandwidth": 0,
"stream-id": "", "enc-type": 0, "enc-pass": "", "Param": ""
}
},
"sink": {
"19": {
"id": 19,
"is-enable": 1,
"name": "rtmp",
"type": 1,
"status": 0,
"bitrate": 0,
"uptime": 0,
"rtmp": {
"type": 1, "url": "rtmps://10.0.1.32/live", "key": "234",
"is-auth": 0, "user": "", "passwd": "", "param": ""
},
"srt": {
"ip": "", "port": 0, "latency": 0, "bandwidth": 0,
"stream-id": "", "enc-type": 0, "enc-pass": "", "Param": ""
}
}
}
},
{
"id": 8,
"is-enable": 1,
"name": "Stream Conversion 0002",
"source": {
"id": 10,
"is-enable": 1,
"name": "def-channel-src-name",
"type": 1,
"status": 5,
"bitrate": 0,
"uptime": 1698,
"rtmp": {
"type": 1, "url": "rtmps://10.0.1.32:1936/live", "key": "22",
"is-auth": 0, "user": "", "passwd": "", "param": ""
},
"srt": {
"ip": "", "port": 0, "latency": 0, "bandwidth": 0,
"stream-id": "", "enc-type": 0, "enc-pass": "", "Param": ""
}
},
"sink": {
"11": {
"id": 11,
"is-enable": 1,
"name": "rtmp",
"type": 1,
"status": 0,
"bitrate": 0,
"uptime": 0,
"rtmp": {
"type": 1, "url": "rtmps://10.0.1.32:1936/live", "key": "12",
"is-auth": 0, "user": "", "passwd": "", "param": ""
},
"srt": {
"ip": "", "port": 0, "latency": 0, "bandwidth": 0,
"stream-id": "", "enc-type": 0, "enc-pass": "", "Param": ""
}
},
"16": {
"id": 16,
"is-enable": 0,
"name": "SRT Caller",
"type": 2,
"status": 0,
"bitrate": 0,
"uptime": 0,
"rtmp": {
"type": 0, "url": "", "key": "",
"is-auth": 0, "user": "", "passwd": "", "param": ""
},
"srt": {
"ip": "10.10.11.105", "port": 6666, "latency": 120, "bandwidth": 25,
"stream-id": "", "enc-type": 0, "enc-pass": "", "Param": ""
}
},
"20": {
"id": 20,
"is-enable": 1,
"name": "SRT Listener",
"type": 3,
"status": 0,
"bitrate": 0,
"uptime": 0,
"rtmp": {
"type": 0, "url": "", "key": "",
"is-auth": 0, "user": "", "passwd": "", "param": ""
},
"srt": {
"ip": "0.0.0.0", "port": 5236, "latency": 120, "bandwidth": 0,
"stream-id": "", "enc-type": 0, "enc-pass": "", "Param": ""
}
}
}
}
]
}