1、查询开关状态,可查询全局开关状态或频道开关状态
2、接口支持https协议
3、isClosePreview当enabled值为Y时,表示的是关闭系统观看页;closeDanmu当enabled值为Y时,表示的是关闭弹幕;closeChaterList当enabled值为Y时,表示的是关闭在线列表
4、当频道非三分屏场景时才返回:mobileAudio移动端音频开关,redPack红包开关,praise点赞语开关,chatPlayBack聊天回放开关
http://api.polyv.net/live/v3/channel/switch/get
https://api.polyv.net/live/v3/channel/switch/get?appId=frlr1zazn3&sign=0EBE4C9FCAEBB325135F0945497C7792&channelId=2191569×tamp=1621840901604
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(AccountTest.class);
/**
* 查询频道的功能开关状态
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testSwitchGet() 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/switch/get";
String channelId= String.valueOf(2191569);
//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));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道的功能开关状态,返回值:{}", response);
//do somethings
}
{
"code":200,
"status":"success",
"message":"",
"data":[
{
"type":"isClosePreview",
"enabled":"N"
},
{
"type":"mobileWatch",
"enabled":"Y"
},
{
"type":"autoPlay",
"enabled":"Y"
},
{
"type":"booking",
"enabled":"Y"
},
{
"type":"shareBtnEnabled",
"enabled":"Y"
},
{
"type":"rtsEnabled",
"enabled":"N"
},
{
"type":"chat",
"enabled":"Y"
},
{
"type":"consultingMenu",
"enabled":"Y"
},
{
"type":"closeDanmu",
"enabled":"N"
},
{
"type":"welcome",
"enabled":"Y"
},
{
"type":"viewerSendImgEnabled",
"enabled":"N"
},
{
"type":"sendFlowersEnabled",
"enabled":"Y"
},
{
"type":"pushSharingEnabled",
"enabled":"Y"
},
{
"type":"closeChaterList",
"enabled":"Y"
}
]
}
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}