Get Channel Push URL
Updated: 2022-09-02 18:08:07
API Description
1、获取频道推流URL,由于推流地址可能发生变化,所以请在使用时获取
2、接口支持https协议
API URL
https://api.polyv.net/live/v3/channel/stream/get-push-url
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls are subject to rate limits. See details
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See 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 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 |
Example
https://api.polyv.net/live/v3/channel/stream/get-push-url?sign=DC99F41F08C04A8240E45F9200BD7F85×tamp=1642124373212&channelId=1958888&appId=frlr1zazn3
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure See Global Error Description |
| status | String | Response status text |
| message | String | Response description, provides error details when code is 400 or 500 |
| data | String | Push URL returned on successful request |
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 from the test cases are included in the download file.
/**
* 查询频道推流地址
* @throws IOException
*/
@Test
public void testGetPushUrl() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String url = "https://api.polyv.net/live/v3/channel/stream/get-push-url";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId","1965681");
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道观看条件接口返回值:{}",response);
//do somethings
}
Response Example
See Global Error Description for system-wide error descriptions.
Success Example
{
"code": 200,
"status": "success",
"message": "",
"data": "rtmp://push-d1.videocc.net/recordf/1b448be3231102820826401ff57?auth_key=1642220773-0-0-a1f935fcfcf63b7654ac86586ab0f6b6"
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
