Modify Splash Screen
API Description
1、接口用于设置引导页开关以及引导图
2、接口URL中的{channelId}为频道号
3、(splashEnabled, timestamp, appId)参与sign签名,并和sign一起通过post表单传递,文件通过二进制流提交到服务器端。
4、接口支持https协议
API URL
http://api.polyv.net/live/v2/channelSetting/{channelId}/setSplash
Request Method
POST
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
If the switch is enabled and no splash screen has been set before, the uploaded image cannot be empty.
Splash screen requirements: Only jpg, jpeg, and png formats are supported. File size must not exceed 4MB.
Request Parameters Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details: Get Secret Key |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be saved 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 details: Signature Generation Rules |
| splashEnabled | true | String | Enable or disable the splash page Y: Enable N: Disable |
| imgfile | false | File | Supports jpg, jpeg, png formats. File size must not exceed 4MB |
Example
http://api.polyv.net/live/v2/channelSetting/1965681/setSplash
Form parameters:
appId=frlr1zazn3&sign=59FA01DD41788BA25D8FE31827C30BD2&splashEnabled=Y×tamp=1621840626094
Response Parameters Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure See details: Global Error Description |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, provides additional error details |
| data | String | On success, returns the image URL if an image was uploaded, or "success" if no image was uploaded. Returns an empty string on failure |
Java Request Example
For quick integration of the base code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. The HttpUtil.java and LiveSignUtil.java files used in the test cases are included in the download package.
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 static final Logger log = LoggerFactory.getLogger(WebInfoTest.class);
/**
* 修改引导图
* @throws IOException
*/
@Test
public void testSetSplash() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/live/v2/channelSetting/%s/setSplash","1965681");
String splashEnabled = "Y";
String path = getClass().getResource("/file/").getPath() + "dog.jpeg";
File imgfile = new File(path);
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("splashEnabled",splashEnabled);
Map<String, File> fileMap = new HashMap<>();
fileMap.put("imgfile",imgfile);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFile(url,requestMap,fileMap,"utf-8");
log.info("测试修改引导图:{}",response);
//do somethings
}
Response Example
For system-wide global error descriptions, see Global Error Description
Success Example
- Set splash screen without uploading an image
{
"code":200,
"status":"success",
"message":"",
"data":"success"
}
- Set splash screen and upload an image simultaneously
{
"code":200,
"status":"success",
"message":"",
"data":"//liveimages.videocc.net/uploaded/images/2021/03/fx0zmiovdd.jpeg"
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
