修改观看页默认模板设置
接口描述
1、修改观看页默认模板设置
2、接口支持https协议
接口URL
http://api.polyv.net/live/v4/user/template/page-setting/update
请求方式
POST
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
sign
true
String
签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据
【详见签名生成规则】
timestamp
true
String
当前13位毫秒级时间戳,3分钟内有效
autoPlayEnabled
false
String
自动播放开关,Y:开启,N:关闭
barrageEnabled
false
String
弹幕开关,Y:开启,N:关闭
barrageSpeed
false
String
弹幕速度,340:缓慢,270:较慢,200:标准,130:较快,60:快速
bookingEnabled
false
String
微信预约功能开关,Y:开启,N:关闭
closePreviewEnabled
false
String
观看页开关,Y:不显示观看页(仅允许集成SDK观看),N:显示观看页
flashPlayerEnabled
false
String
flash播放器开关,Y:开启,N:关闭
forbidFirefoxEnabled
false
String
禁止Firefox开关,Y:开启,N:关闭
mobileAudioEnabled
false
String
音视频切换开关,Y:开启,N:关闭
mobilePvShowLocation
false
String
观看次数移动端显示位置,player:播放器,desc:直播介绍
mobileWatchEnabled
false
String
移动观看页开关,Y:开启,N:关闭
pvShowEnabled
false
String
观看次数开关,Y:开启,N:关闭
recordingProtectEnabled
false
String
防弹窗播放开关,Y:开启,N:关闭
showCountdownEnabled
false
String
回放中显示“下一场次”倒计时 开关值,Y:开启,N:关闭
switchPlayerEnabled
false
String
允许观众切换h5及flash播放器,Y:允许,N:不允许;flash播放器开关为N时,该值不生效
viewerVerificationEnabled
false
String
观众实名认证开关,Y:开启,N:关闭
watchFeedbackEnabled
false
String
观众投诉开关,Y:开启,N:关闭
watchLangType
false
String
观看页语言,zh_CN:中文,en:英文,follow_browser:跟随浏览器
watchLayout
false
String
观看页布局,ppt文档为主、video视频为主、only-video仅视频、followTeacher跟随讲师
pictureInPictureEnabled
false
String
小窗播放开关,Y:开启,N:关闭
示例
http://api.polyv.net/live/v4/user/template/page-setting/update?autoPlayEnabled=N&mobileAudioEnabled=Y&watchFeedbackEnabled=Y&sign=5FB6EEFA7EB92B6D710A9E5889A8F405&barrageSpeed=60&switchPlayerEnabled=Y&pvShowEnabled=Y&showCountdownEnabled=Y&mobileWatchEnabled=Y&viewerVerificationEnabled=N&bookingEnabled=N&mobilePvShowLocation=player&appId=frlr1zazn3&closePreviewEnabled=Y&watchLayout=followTeacher&flashPlayerEnabled=N&barrageEnabled=Y&recordingProtectEnabled=N&forbidFirefoxEnabled=N&watchLangType=follow_browser×tamp=1686884060082
响应参数描述
code
Integer
状态码,与 http 状态码相同,用于确定基本的响应状态
data
Object
成功响应的数据
requestId
String
请求ID,每次请求生成的唯一的 UUID,仅可用于排查、调试,不应该和业务挂上钩
status
String
响应结果,由业务决定,成功返回success,失败返回error
success
Boolean
是否成功响应
Error参数描述
code
Integer
错误代码,用于确定具体的错误原因
desc
String
错误描述,与 error.code 对应
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(getClass());
/**
* 修改观看页默认模板设置
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void pageSettingUpdateTest() 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/user/template/page-setting/update";
String autoPlayEnabled = "N";
String barrageEnabled = "Y";
String barrageSpeed = "60";
String bookingEnabled = "N";
String closePreviewEnabled = "Y";
String flashPlayerEnabled = "N";
String forbidFirefoxEnabled = "N";
String mobileAudioEnabled = "Y";
String mobilePvShowLocation = "player";
String mobileWatchEnabled = "Y";
String pvShowEnabled = "Y";
String recordingProtectEnabled = "N";
String showCountdownEnabled = "Y";
String switchPlayerEnabled = "Y";
String viewerVerificationEnabled = "N";
String watchFeedbackEnabled = "Y";
String watchLangType = "follow_browser";
String watchLayout = "followTeacher";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("autoPlayEnabled", autoPlayEnabled);
requestMap.put("barrageEnabled", barrageEnabled);
requestMap.put("barrageSpeed", barrageSpeed);
requestMap.put("bookingEnabled", bookingEnabled);
requestMap.put("closePreviewEnabled", closePreviewEnabled);
requestMap.put("flashPlayerEnabled", flashPlayerEnabled);
requestMap.put("forbidFirefoxEnabled", forbidFirefoxEnabled);
requestMap.put("mobileAudioEnabled", mobileAudioEnabled);
requestMap.put("mobilePvShowLocation", mobilePvShowLocation);
requestMap.put("mobileWatchEnabled", mobileWatchEnabled);
requestMap.put("pvShowEnabled", pvShowEnabled);
requestMap.put("recordingProtectEnabled", recordingProtectEnabled);
requestMap.put("showCountdownEnabled", showCountdownEnabled);
requestMap.put("switchPlayerEnabled", switchPlayerEnabled);
requestMap.put("viewerVerificationEnabled", viewerVerificationEnabled);
requestMap.put("watchFeedbackEnabled", watchFeedbackEnabled);
requestMap.put("watchLangType", watchLangType);
requestMap.put("watchLayout", watchLayout);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postFormBody(url, null);
log.info("测试修改观看页默认模板设置成功:{}", response);
//do somethings
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"code": 200,
"status": "success",
"requestId": "d2a25acab50240e1b344a1c045de36ae.67.16868840687251021",
"data": null,
"success": true
}
异常示例
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
Last updated
Was this helpful?