修改觀看頁預設模板設定
更新時間:2024-09-25 10:26:58
介面描述
1、修改观看页默认模板设置
2、接口支持https协议
介面URL
http://api.polyv.net/live/v4/user/template/page-setting/update
請求方式
POST
介面限制
1、介面同時支援HTTP、HTTPS,建議使用HTTPS確保介面安全,介面呼叫有頻率限制,詳細請查看
請求參數描述
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | true | String | 帳號appId【詳見取得金鑰】 |
| 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 | 成功回應的資料 |
| error | Object | 狀態碼非200時的錯誤資訊【詳見Error參數描述】 |
| 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
}
