1、获取频道推流URL,由于推流地址可能发生变化,所以请在使用时获取
2、接口支持https协议
https://api.polyv.net/live/v3/channel/stream/get-push-url
https://api.polyv.net/live/v3/channel/stream/get-push-url?sign=DC99F41F08C04A8240E45F9200BD7F85×tamp=1642124373212&channelId=1958888&appId=frlr1zazn3
/**
* 查询频道推流地址
* @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
}
{
"code": 200,
"status": "success",
"message": "",
"data": "rtmp://push-d1.videocc.net/recordf/1b448be3231102820826401ff57?auth_key=1642220773-0-0-a1f935fcfcf63b7654ac86586ab0f6b6"
}
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}