/api/input/source/add
Use this interface to add an input for a channel.
Input/Output editing permissions are required.
Prototype
| Protocol | HTTP/HTTPS POST |
| URL | ip[:port]/api/input/source/add |
| Content-Type | Request: Content-Type: application/json Response: Content-Type: application/json |
Request Cookies
| Parameter | Description |
|---|---|
| mwcloud-sid | A string that is used to identify current logged-in user. |
| mwcloud-uid | Current logged-in username. |
Request Body
| Parameter | Description |
|---|---|
| name | Name |
| config | Refer to Source configuration section. |
Source configuration
| Parameter | Description |
|---|---|
| type | Configuration type, 1 represents URL type, source information is configured through the url field. |
| url | Source address |
Supported protocols include RTMP, RTSP, and TS OVER SRT/UDP/RTP.
RTSP
Support for standard RTSP addresses
rtsp://192.168.1.58:899/stream
RTMP
Support for standard RTMP addresses
rtmp://192.168.1.58/live/key
MPEG-TS over UDP
Support for standard UDP addresses
// Multicast
udp://ip:port
// Unicast
udp://0.0.0.0:port
MPEG-TS over SRT
Support for ffmpeg srt url
// Caller
srt://ip:port?mode=caller&latency=125&streamid=test&passphrase=1234567890
// Listener
srt://0.0.0.0:port?mode=listener&latency=125&streamid=test
| URL | Description |
|---|---|
| ip | Listener: 0.0.0.0 caller: legal IP address (cannot be:0.0.0.0) |
| port | Port number, range is from 1 to 65535. |
| mode | Mode, options are caller and listener. |
| latency | latency time, range is from 20 to 8000. |
| passphrase | Encrypted password, optional, set it only when encryption is enabled. |
| streamid | Stream ID, length is from 0 to 256. |
MPEG-TS over RTP
Support for standard RTP addresses
// Multicast
rtp://ip:port
// Unicast
rtp://0.0.0.0:port
Request Example
POST /api/input/source/add HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: xx
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
"name": "srt test",
"config": {
"type": 1,
"url": "srt://10.10.11.117:9000?mode=caller"
}
}
Response Parameters
Response Header
| Parameter | Description |
|---|---|
| Content-Type | Value: 'application/json; charset=UTF-8' |
Response Body
| Parameter | Description |
|---|---|
| result | Result code |
Response Example
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
content-length: 12
{
"result": 0
}