1、获取cdn频道的直播实时推流信息(阿里、腾讯cdn)
2、接口支持https协议
http://api.polyv.net/live/v4/channel/monitor/list-stream-info
http://api.polyv.net/live/v4/channel/monitor/list-stream-info?appId=frlr1zazn3&sign=4815DC1E0AA6F22AC5D38D38924BEFDB&startTime=&endTime=&channelId=3889955×tamp=1683799860694
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(getClass());
/**
* 获取cdn频道的直播实时推流信息(阿里、腾讯cdn)
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void monitorListStreamInfoTest() 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/monitor/list-stream-info";
String channelId = "3889955";
String endTime = "";
String startTime = "";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("endTime", endTime);
requestMap.put("startTime", startTime);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试获取cdn频道的直播实时推流信息(阿里、腾讯cdn)成功:{}", response);
//do somethings
}
{
"code": 200,
"status": "success",
"requestId": "63181d5d82fc4dd785a33de52375bd48.71.16837998896517145",
"data": [
{
"streamUrl": "rtmp://push-d1.videocc.net/recordf/1b448be32316811158957436c19",
"bitRate": "1176815.9",
"audioFrameRate": "46.9",
"videoFrameRate": "15.016666",
"time": "2023-05-11T10:09:00Z",
"timestamp": 1683799740000
}
],
"success": true
}
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}