设置频道防录屏信息
旧版接口地址跑马灯设置(旧版)
接口描述
1、通过频道号,设置频道防录屏信息
2、接口支持https协议
接口URL
http://api.polyv.net/live/v3/channel/anti/record/setting
请求方式
POST
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
timestamp
true
Long
当前13位毫秒级时间戳,3分钟内有效
sign
true
String
签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据
【详见签名生成规则】
channelId
true
String
频道号
enable
false
String
防录屏开关,默认为开启 Y:开启 N:关闭
antiRecordType
true
String
防录屏方式 marquee:跑马灯 watermark:水印
modelType
true
String
防录屏类型,水印方式时设置自定义URL无效 fixed:固定值 nickname:登录用户名 diyurl:URL自定义跑马灯
fontSize
true
String
字体大小 防录屏方式为跑马灯时:设置数值,范围1-256 防录屏方式为水印时: small:小 middle:中 large:大
opacity
false
Integer
透明度,不传默认为80,范围0-100
fontColor
false
String
跑马灯字体颜色,色值,例如:#FFFFFF
autoZoomEnabled
false
String
跑马灯自定义缩放,默认为关闭 Y:开启 N:关闭
doubleEnabled
false
String
双跑马灯,默认为关闭 Y:开启 N:关闭
showMode
false
String
跑马灯显示方式,默认为滚动 roll:滚动 flicker:闪烁
示例
http://api.polyv.net/live/v3/channel/anti/record/setting
表单参数:
doubleEnabled=N&autoZoomEnabled=Y&sign=5C3360AE6C5ED07D973D7E75DAF2646B&showMode=flicker&modelType=fixed&content=test&antiRecordType=marquee&appId=frlr1zazn3&fontSize=20&opacity=80&channelId=2453970&fontColor=%23FFF×tamp=1629967807901
响应参数描述
status
String
响应状态文本信息
message
String
响应描述信息,当code为400或者500的时候,辅助描述错误原因
data
String
请求失败时为空,请求成功时为"SUCCESS"
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(MarqueeTest.class);
/**
* 设置频道防录屏信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void marqueeSettingTest() 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/anti/record/setting";
String channelId = "2453970";
String antiRecordType = "marquee";
String modelType = "fixed";
String content = "test";
String opacity = "80";
String fontSize = "20";
String fontColor = "#FFF";
String autoZoomEnabled = "Y";
String doubleEnabled = "N";
String showMode = "flicker";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("antiRecordType", antiRecordType);
requestMap.put("modelType", modelType);
requestMap.put("content", content);
requestMap.put("opacity", opacity);
requestMap.put("fontSize", fontSize);
requestMap.put("fontColor", fontColor);
requestMap.put("autoZoomEnabled", autoZoomEnabled);
requestMap.put("doubleEnabled", doubleEnabled);
requestMap.put("showMode", showMode);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(url, requestMap);
log.info("测试设置频道防录屏信息:{}", response);
//do somethings
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"code": 200,
"status": "success",
"message": "",
"data": "SUCCESS"
}
异常示例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Last updated
Was this helpful?