重製課件參數設定
更新時間:2023-06-09 09:08:29
介面URL
https://api.polyv.net/live/v3/channel/pptRecord/setting
介面說明
1、接口用于设置重制课件参数
2、接口支持https
支援格式
JSON
請求方式
POST
請求數限制
TRUE
請求參數
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | 是 | string | 從API設定中取得,在直播系統登記的appId |
| timestamp | 是 | long | 13位當前毫秒級時間戳 |
| sign | 是 | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| channelId | 是 | int | 頻道號 |
| globalSettingEnabled | 是 | string | 是否使用通用設定,Y是,N否 |
| type | 是 | int | 影片佈局方式,0.三分屏、1.純文件 |
| videoRatio | 否 | int | 攝影機畫面比例,新版重製有效,預設0,0表示16:9、1表示4:3 |
| brandImgFile | 否 | File | 展示圖片,新版重製有效,攝影機畫面比例為16:9時尺寸為480X810,攝影機畫面比例為4:3時尺寸為480X720,支援jpg和png格式 |
| backgroundImgFile | 否 | File | 背景圖片,舊版重製有效,尺寸為1280X720,支援jpg和png格式 |
回應成功JSON範例:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"result": true
}
}
回應欄位說明
| 參數名 | 說明 |
|---|---|
| code | 狀態碼,成功為200,簽名失敗為403,參數錯誤為400,伺服器端錯誤為500 |
| status | 成功為success,錯誤時為error |
| message | 成功為"",錯誤時為錯誤描述資訊 |
| data | 回應資料 |
| data.result | 處理結果, true成功 |
回應失敗JSON範例:
參數錯誤
{
"code": 400,
"status": "error",
"message": "param validate error",
"data": ""
}
未輸入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
appId不正確
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
時間戳錯誤
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
簽名錯誤
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
非法頻道號
{
"code": 403,
"status": "error",
"message": "illegal channel id: %s",
"data": ""
}
java請求範例
public void testAddRecordTask() {
String url = "https://api.polyv.net/live/v3/channel/pptRecord/setting";
// appId和加密串
String appId = "xxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxx";
int channelId = 123;
Map<String, String> params = new HashMap<>();
params.put("channelId", String.valueOf(channelId));
params.put("globalSettingEnabled", "N");
params.put("type", "0");
params.put("videoRatio", "0");
// 调用Polyv的工具类方法设置sign
PolyvTool.setLiveSign(params, appId, appSecret);
String content = HttpClientUtil.getInstance()
.sendHttpPost(url, params);
System.out.println(content);
}
