Query Live Streaming Push Information for a Channel
API Description
1、查询频道的直播推流信息
2、接口支持https协议
API URL
http://api.polyv.net/live/v3/channel/monitor/list-tencent-stream-info
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
Only supports channels using Tencent CDN
Only supports channels with status Live
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details on obtaining keys |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| channelId | true | String | Channel ID |
| startTime | false | String | Start time, defaults to 3 hours ago |
| endTime | false | String | End time, defaults to current time. Supports querying data from the last 7 days |
| 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 never be stored or used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server for response data. See signature generation rules |
Example
https://api.polyv.net/live/v3/channel/monitor/list-tencent-stream-info?appId=frlr1zazn3×tamp=1680831521000&sign=7B95CA869B5D121181FE3586ACBF10BA&channelId=3880533
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure See global error description |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, provides additional error details |
| error | Object | Error information when status code is non-200 See Error field description |
| data | Object | Returns replay video list information on success See data field description |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code for identifying the specific error |
| desc | String | Error description, corresponding to error.code |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| streamUrl | String | Push stream path |
| bitRate | Integer | Video bitrate, unit: bps |
| audioFrameRate | Integer | Audio frame rate |
| videoFrameRate | Integer | Video frame rate |
| time | Array | Data timestamp, format: %Y-%m-%d %H:%M:%S.%ms, precise to milliseconds |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded 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 static final Logger log = LoggerFactory.getLogger(AccountTest.class);
/**
* 获取腾讯cdn频道的直播实时推流信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetTxStreamInfo() 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/monitor/list-tencent-stream-info";
String channelId="3880533";
String startTime = "1680749400000";
String endTime="1680759580000";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("startTime", startTime);
requestMap.put("endTime", endTime);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试获取腾讯cdn频道的直播实时推流信息,返回值:{}", response);
//do somethings
}
Response Example
For global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"streamUrl": "recordf",
"bitRate": "1157120",
"audioFrameRate": "46",
"videoFrameRate": "13",
"time": "2023-04-07 09:45:24.443",
"timestamp": null
}
]
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "channel status not live",
"data": ""
}
