set-channel-sink
Use the interface to modify the output settings.
Only available for users with administrative rights.
Prototype
| Protocol | HTTP/HTTPS POST | 
| URL | ip[:port]/sc_cloud/channel/set-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 which you can add 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.  You can modify the parameter by using set-channel-sink-name.  | 
| is-enable | Whether output switch is on.  You can modify the parameter by using set-channel-sink-enable.  | 
| type | Stream type. The options are  
  | 
| rtmp | Indicates output RTMP/RTMPS stream when type = 1. Request Body refers to RTMP/RTMPS. | 
| srt | Indicates output SRT Caller stream when type = 2. Request Body refers to SRT Caller. Indicates output SRT Listener stream when type = 3. Request Body refers to SRT Listener.  | 
rtmp
| Parameter | Description | 
|---|---|
| type | Constant value: 1. | 
| url | Server URL. | 
| key | Stream key. | 
| is-auth | Authentication state. 
  | 
| user | User name. | 
| passwd | User 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:
  | 
| enc-pass | Encryption passphrase. It is 10 to 79 characters when enc-type is 0. | 
Request Example
- RTMP/RTMPS
 
POST /sc_cloud/channel/set-sink HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 212
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
  "id": 13,
  "protocol": {
    "id": 24,
    "name": "output-rtmp-new",
    "is-enable": 1,
    "type": 1,
    "rtmp": {
      "type": 1,
      "url": "rtmp://10.2.3.63/live",
      "key": "addkey",
      "is-auth": 1,
      "user": "test",
      "passwd": "12345678",
      "name": "output-rtmp"
    }
  }
}
- SRT Caller
 
POST /sc_cloud/channel/set-sink HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 245
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
  "id": 13,
  "protocol": {
    "id": 25,
    "name": "output-srt caller",
    "is-enable": 1,
    "type": 2,
    "srt": {
      "ip": "10.0.2.3",
      "port": 678,
      "latency": 120,
      "enc-type": 24,
      "enc-pass": "passphrase",
      "stream-id": "modify caller",
      "bandwidth": 25,
      "name": "output-srt caller-new"
    }
  }
}
- SRT Listener
 
POST /sc_cloud/channel/set-sink HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 206
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
  "id": 13,
  "protocol": {
    "id": 26,
    "name": "output-srt listener",
    "is-enable": 1,
    "type": 3,
    "srt": {
      "ip": "0.0.0.0",
      "port": 666,
      "latency": 120,
      "enc-type": 16,
      "enc-pass": "fsfsfffffff",
      "name": "output-srt listener-new"
    }
  }
}
Response Parameters
Response Header
| Parameter | Description | 
|---|---|
| Content-Type | Value: 'application/json; charset=UTF-8' | 
Response Body
| Parameter | Description | 
|---|---|
| result | Result code. The options are as follows:
  | 
| method | set-channel-sink | 
Response Example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 40
Connection: keep-alive
{
  "method": "set-channel-sink",
  "result": 0
}