1、根据发起转播的频道,批量创建接收转播的频道
2、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
http://api.polyv.net/live/v3/channel/transmit/batch-create
http://api.polyv.net/live/v3/channel/transmit/batch-create?appId=frlr1zazn3&sign=D02FA683640135D843D485EE84F6632A&channelId=2588188×tamp=1632809855078
@Test
public void testBatchCreateTransmitChannel() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/channel/transmit/batch-create";
String channelId = "2588188";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url,requestMap);
List<String> list = new ArrayList<>();
list.add("接收转播频道1");
list.add("接收转播频道2");
String json= JSON.toJSONString(list);
String response = HttpUtil.postJsonBody(url, json,null);
log.info("测试修改频道信息,返回值:{}", response);
}
{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"channelId": 2588440,
"name": "接收转播频道1",
"channelPasswd": "8pWtmd",
"authType": "phone",
"streamType": "client",
"debugEnabled": "N",
"playBackEnabled": "N",
"stream": "1b448be3231632809860172afac",
"status": "客户端推流/直播结束",
"categoryId": 340019,
"categoryName": "默认分类",
"isSmallClass": "N",
"scene": "ppt",
"newScene": null,
"template": null,
"createdTime": 1632809860000,
"appId": null,
"coverImage": "",
"type": "receive",
"startTime": null,
"publisher": "主持人",
"channelLogo": null,
"splashImg": "//liveimages.videocc.net/uploaded/images/2021/09/g2bta2pjbw.jpg",
"splashEnabled": "Y",
"pureRtcEnabled": "N",
"watchTimes": null,
"roomIds": null,
"transmitType": null,
"rtcType": null,
"channelSessionId": null,
"lastPushStreamTime": null
},
{
"channelId": 2588441,
"name": "接收转播频道2",
"channelPasswd": "8pWtmd",
"authType": "phone",
"streamType": "client",
"debugEnabled": "N",
"playBackEnabled": "N",
"stream": "1b448be323163280986017418fb",
"status": "客户端推流/直播结束",
"categoryId": 340019,
"categoryName": "默认分类",
"isSmallClass": "N",
"scene": "ppt",
"newScene": null,
"template": null,
"createdTime": 1632809860000,
"appId": null,
"coverImage": "",
"type": "receive",
"startTime": null,
"publisher": "主持人",
"channelLogo": null,
"splashImg": "//liveimages.videocc.net/uploaded/images/2021/09/g2bta2pjbw.jpg",
"splashEnabled": "Y",
"pureRtcEnabled": "N",
"watchTimes": null,
"roomIds": null,
"transmitType": null,
"rtcType": null,
"channelSessionId": null,
"lastPushStreamTime": null
}
]
}
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}