Modify Channel Settings
Interface Description
1、修改频道设置
2、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
Interface URL
http://api.polyv.net/live/v4/channel/update
Request Method
POST
Interface Constraints
The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. API calls have frequency limits. See details
The seminar scenario does not support modifying: live viewing template (template), low-latency live streaming switch (pureRtcEnabled), number of link mic users (linkMicLimit), maximum concurrent viewers (maxViewer)
Legacy backend channels (scenario undefined newScene: undefined) do not support modifying: live viewing template (template)
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details for obtaining secret key |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid within 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See signature generation rules |
| channelId | true | String | Channel ID |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | false | String | Live stream name, maximum length 100 |
| password | false | String | Password, length 6-16 characters, must contain both numbers and letters |
| seminarHostPassword | false | String | Host password, valid only for seminar scenario channels, length 6-16 characters, must contain both numbers and letters |
| seminarAttendeePassword | false | String | Attendee password, valid only for seminar scenario channels, length 6-16 characters, must contain both numbers and letters |
| publisher | false | String | Host, maximum length 100 |
| template | false | String | Live viewing template Three-screen landscape: ppt Three-screen portrait: portrait_ppt Pure video landscape: alone Pure video portrait: portrait_alone Pure video fast landscape: topclass Pure video fast portrait: portrait_topclass Not supported for modification in legacy backend channels (scenario undefined newScene: undefined) Not supported for modification in seminar scenario For three-screen scenario (scene: ppt), modifiable values: ppt, portrait_ppt For pure video scenario (scene: alone), modifiable values: alone, portrait_alone For large class scenario (scene: topclass), modifiable values: topclass, portrait_topclass |
| pureRtcEnabled | false | String | Low-latency live streaming switch Y: Enable N: Disable |
| linkMicLimit | false | Integer | Number of link mic users, range: 0-16 |
| maxViewer | false | Integer | Maximum concurrent viewers |
| resetStartTime | false | String | Clear start time, Y: Yes, N: No (when Y, the startTime field must be empty or not provided) |
| startTime | false | Long | Live stream start time, 13-digit millisecond timestamp, must be greater than current time |
| endTime | false | Long | Live stream end time, 13-digit millisecond timestamp, must be greater than start time |
| resetEndTime | false | String | Clear end time, Y: Yes, N: No (when Y, the endTime field must be empty or not provided) |
| splashImg | false | String | Splash page image URL. Images not under Polyv domain must first be uploaded via Upload all channel decoration image materials |
| clientAloneTemplateBackgroundUrl | false | String | Client template background image URL |
| liveCdnBackgroundUrl | false | String | Video mixing background image URL |
| smallClassSizeLimit | false | Integer | Small class size limit, required only when the live scenario is small class. Optional values: 1, 6, 12 |
| isRecord | false | String | Small class recording switch, valid only when the live scenario is small class. Y: Enable, N: Disable. Default is disabled if not provided |
| h5LowLatencyFlvEnabled | false | String | Mobile H5 viewing page low-latency switch, Y: Enable, N: Disable |
Example
http://api.polyv.net/live/v4/channel/update?appId=frlr1zazn3&sign=B02AEC5A3EA38F7F0506E07E3DC88DB7&channelId=3630700×tamp=1670551295592
Request body JSON parameters:
{
"name": "部门宣讲",
"publisher": "张三",
"password": "mycAfnC9mkK3lsFc",
"template": "portrait_ppt",
"pureRtcEnabled": "Y",
"linkMicLimit": "16"
}
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure |
| status | String | Response result, determined by business logic. Returns success on success, error on failure |
| success | Boolean | Response result, determined by business logic. Returns true on success, false on failure |
| data | Object | Returns null for both success and failure |
| error | Object | Error information when status code is non-200 See Error field description |
| requestId | String | Request ID, a unique UUID generated for each request. For debugging and troubleshooting only, should not be tied to business logic |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to identify the specific error cause |
| desc | String | Error description, corresponds to error.code |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download source code. After downloading, add it to your own source code project. HttpUtil.java and LiveSignUtil.java in the test cases are included in the download file.
It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private final Logger log = LoggerFactory.getLogger(getClass());
/**
* 修改频道设置
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void updateChannelTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/channel/update";
String channelId = "3630700";
String name = "部门宣讲";
String password = "mycAfnC9mkK3lsFc";
String publisher = "张三";
String template = "portrait_ppt";
String pureRtcEnabled = "Y";
String linkMicLimit = "16";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("name", name);
jsonMap.put("password", password);
jsonMap.put("publisher", publisher);
jsonMap.put("template", template);
jsonMap.put("pureRtcEnabled", pureRtcEnabled);
jsonMap.put("linkMicLimit", linkMicLimit);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试修改频道设置成功:{}", response);
//do somethings
}
Response Example
Success Example
{
"code": 200,
"status": "success",
"requestId": "dc7ae621ef8e4f4a8e4976833f1dbbd4.69.16309852981551185",
"data": null,
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "4081dbac03e6441e8bdd301d8feee5a2.117.16360829141876029",
"error": {
"code": 30004,
"desc": "找不到频道"
},
"success": false
}
