查詢影片資訊
更新時間:2023-10-27 09:38:36
介面說明
1、通过子账号id和视频id,查询视频的详细信息
2、接口支持https协议
介面URL
http://api.polyv.net/v3/video/get-video-info
請求方式
GET
介面限制
1、介面同時支援HTTP、HTTPS,建議使用HTTPS確保介面安全,介面呼叫有頻率限制,詳細請查看
請求參數說明
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | true | String | 保利威點播子帳戶appId,取得路徑:保利威點播後台->設定->帳號管理 |
| timestamp | true | Long | 目前時間的毫秒級時間戳,3分鐘內有效 |
| sign | true | String | 簽名,32位元大寫MD5值【詳見MD5簽名產生規則】 |
| vids | true | String | 影片id,多個影片id用英文逗號分隔,例如: "1b448be32370f4822ac40fd926112a66_1,1b448be323d66f3dae8db5af9f1fdce6_1"; 取得路徑:保利威點播後台->影片列表; 也可以取得自【上傳影片】; |
| filter | false | String | 選擇需要回傳的影片資訊,多個以英文逗號分隔,預設為基礎資訊 basicInfo:基礎資訊 metaData:元資料 transcodeInfo:轉碼資訊 snapshotInfo:截圖資訊 例如:"basicInfo,metaData,transcodeInfo,snapshotInfo" |
範例
http://api.polyv.net/v3/video/get-video-info?filter=basicInfo%2CmetaData%2CtranscodeInfo%2CsnapshotInfo&vids=1b448be32370f4822ac40fd926112a66_1%2C1b448be323d66f3dae8db5af9f1fdce6_1&appId=a0Wmol5EwX&sign=A840DFCB355E7B3D23AC85EAD6089B18×tamp=1617939194034
回應參數說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| code | Integer | 回應狀態碼,200為成功回傳,非200為失敗【詳見全域錯誤說明】 |
| status | String | 回應狀態文字資訊 |
| requestId | String | 本次請求的業務流水號,便於客戶端/伺服器端排查問題 |
| error | Object | 回應失敗時回傳錯誤的詳細資訊【詳見error欄位說明】,回應成功時回傳空 |
| data | Array | 回應成功時回傳影片資訊列表【詳見data欄位說明】,回應失敗時回傳空 |
error欄位說明
| 欄位 | 類型 | 說明 |
|---|---|---|
| code | Integer | 錯誤碼 |
| desc | String | 錯誤描述【詳見全域錯誤說明】 |
data欄位說明
| 欄位 | 類型 | 說明 |
|---|---|---|
| vid | String | 影片id |
| basicInfo | Object | 影片的基礎資訊 【詳見basicInfo欄位說明】 |
| metaData | Object | 影片的元資料 【詳見metaData欄位說明】 |
| transcodeInfos | Array | 影片的轉碼資訊列表 【詳見transcodeInfos欄位說明】 |
| snapshotInfo | Object | 影片的截圖資訊 【詳見snapshotInfo欄位說明】 |
basicInfo欄位說明
| 欄位 | 類型 | 說明 |
|---|---|---|
| title | String | 影片標題 |
| description | String | 影片描述 |
| duration | Long | 來源影片時長,單位:秒 |
| coverURL | String | 首圖地址,大圖 |
| miniCoverURL | String | 首圖地址,小圖 |
| largeCoverURL | String | 首圖地址,大圖,同coverURL |
| creationTime | String | 建立時間 |
| updateTime | String | 更新時間 |
| size | Long | 來源檔案大小,單位:Bytes |
| status | Integer | 影片狀態碼,可以參考【status欄位說明】 |
| cateId | Long | 分類id;其中1為根目錄,即"預設分類" |
| cateName | String | 分類名稱 |
| tags | String | 標籤 |
| uploader | String | 上傳者 |
metaData欄位說明
| 欄位 | 類型 | 說明 |
|---|---|---|
| size | Long | 來源檔案大小,單位:Bytes |
| format | String | 影片容器類型,如mp4、flv等 |
| duration | Long | 來源影片時長,單位:秒 |
| bitrate | Integer | 影片碼率,單位:bps |
| fps | Integer | 影片幀率 |
| height | Integer | 解析度高,單位:px |
| width | Integer | 解析度寬,單位:px |
| codec | String | 編碼格式,例如:h264、h265等 |
transcodeInfos欄位說明
| 欄位 | 類型 | 說明 |
|---|---|---|
| playUrl | String | 播放地址 |
| definition | String | 清晰度 SOURCE:原始清晰度 LD:普清 SD:標清 HD:高清 |
| bitrate | Integer | 碼率kbps |
| duration | Long | 時長,秒 |
| encrypt | Boolean | 是否加密 1:加密影片 0:非加密 |
| format | String | 轉碼格式,如mp4、flv、pdx、hls |
| fps | Integer | 影片幀率 |
| height | Integer | 解析度高,單位:px |
| width | Integer | 解析度寬,單位:px |
| status | String | 影片狀態 normal:可以正常播放 unavailable:不能正常播放 |
snapshotInfo欄位說明
| 欄位 | 類型 | 說明 |
|---|---|---|
| imageUrl | String[] | 截圖url陣列 |
status欄位說明
| 影片狀態碼 | 說明 |
|---|---|
| 60/61 | 已發佈 |
| 10 | 等待編碼 |
| 20 | 正在編碼 |
| 50 | 等待審核 |
| 51 | 審核不通過 |
| -1 | 已刪除 |
Java請求範例
快速接入基礎程式碼請下載相關依賴原始碼, 點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 VodSignUtil.java 都包含在下載檔案中。
強烈建議您使用點播Java SDK完成API的功能對接,點播Java SDK 對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。
private static final Logger log = LoggerFactory.getLogger(VodSubAccountTest.class);
/**
* 查询视频信息
* @throws Exception
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetSubVideoInfo() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/v3/video/get-video-info";
String vids = "1b448be32370f4822ac40fd926112a66_1,1b448be323d66f3dae8db5af9f1fdce6_1";
String filter = "basicInfo,metaData,transcodeInfo,snapshotInfo";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("vids", vids);
requestMap.put("filter", filter);
//用md5进行签名,使用子账号的secretKey签名
requestMap.put("sign", VodSignUtil.getSignMd5(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.debug("测试查询视频信息,{}", response);
//do somethings
}
回應範例
系統全域錯誤說明詳見全域錯誤說明
成功範例
{
"requestId": "2a8a4861-5ab3-40b3-8855-1f9007347580",
"code": 200,
"status": "success",
"error": null,
"data": [
{
"vid": "1b448be32370f4822ac40fd926112a66_1",
"basicInfo": {
"title": "b",
"description": "",
"duration": 45,
"coverURL": "https://img.videocc.net/uimage/1/http://img.videocc.net/uimage/1/1b448be323/6/1b448be32370f4822ac40fd926112a66_1_b.jpg",
"creationTime": "2021-04-08 10:16:07",
"updateTime": "2021-04-08 14:03:21",
"size": 46573287,
"status": 61,
"cateId": 1617173363572,
"cateName": "分类名称2222",
"tags": "",
"uploader": "主账号"
},
"metaData": {
"size": 46573287,
"format": "mp4",
"duration": 45,
"bitrate": 7871,
"fps": 25,
"height": 720,
"width": 1280,
"codec": "h264"
},
"transcodeInfos": [
{
"playUrl": null,
"definition": "LD",
"bitrate": 171,
"duration": 45,
"encrypt": true,
"format": "pdx",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": "https://hls.videocc.net/1b448be323/6/1b448be32370f4822ac40fd926112a66_1.m3u8",
"definition": "LD",
"bitrate": 171,
"duration": 45,
"encrypt": true,
"format": "hls",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": null,
"definition": "SD",
"bitrate": 733,
"duration": 45,
"encrypt": true,
"format": "pdx",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": "https://hls.videocc.net/1b448be323/6/1b448be32370f4822ac40fd926112a66_2.m3u8",
"definition": "SD",
"bitrate": 733,
"duration": 45,
"encrypt": true,
"format": "hls",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": null,
"definition": "HD",
"bitrate": 958,
"duration": 45,
"encrypt": true,
"format": "pdx",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": "https://hls.videocc.net/1b448be323/6/1b448be32370f4822ac40fd926112a66_3.m3u8",
"definition": "HD",
"bitrate": 958,
"duration": 45,
"encrypt": true,
"format": "hls",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
}
],
"snapshotInfo": {
"imageUrl": [
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be32370f4822ac40fd926112a66_0.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be32370f4822ac40fd926112a66_1.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be32370f4822ac40fd926112a66_2.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be32370f4822ac40fd926112a66_3.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be32370f4822ac40fd926112a66_4.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be32370f4822ac40fd926112a66_5.jpg"
]
}
},
{
"vid": "1b448be323d66f3dae8db5af9f1fdce6_1",
"basicInfo": {
"title": "a",
"description": "",
"duration": 44,
"coverURL": "https://img.videocc.net/uimage/1/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_0_b.jpg",
"creationTime": "2021-04-08 10:15:49",
"updateTime": "2021-04-08 10:20:06",
"size": 43721963,
"status": 61,
"cateId": 1617173363572,
"cateName": "分类名称2222",
"tags": "",
"uploader": "主账号"
},
"metaData": {
"size": 43721963,
"format": "mp4",
"duration": 44,
"bitrate": 7577,
"fps": 25,
"height": 720,
"width": 1280,
"codec": "h264"
},
"transcodeInfos": [
{
"playUrl": null,
"definition": "LD",
"bitrate": 168,
"duration": 44,
"encrypt": true,
"format": "pdx",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": "https://hls.videocc.net/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_1.m3u8",
"definition": "LD",
"bitrate": 168,
"duration": 44,
"encrypt": true,
"format": "hls",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": null,
"definition": "SD",
"bitrate": 669,
"duration": 44,
"encrypt": true,
"format": "pdx",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": "https://hls.videocc.net/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_2.m3u8",
"definition": "SD",
"bitrate": 669,
"duration": 44,
"encrypt": true,
"format": "hls",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": null,
"definition": "HD",
"bitrate": 982,
"duration": 44,
"encrypt": true,
"format": "pdx",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
},
{
"playUrl": "https://hls.videocc.net/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_3.m3u8",
"definition": "HD",
"bitrate": 982,
"duration": 44,
"encrypt": true,
"format": "hls",
"fps": 25,
"height": 720,
"width": 1280,
"status": "normal"
}
],
"snapshotInfo": {
"imageUrl": [
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_0.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_1.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_2.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_3.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_4.jpg",
"https://img.videocc.net/uimage/1/1b448be323/6/1b448be323d66f3dae8db5af9f1fdce6_5.jpg"
]
}
}
]
}
異常範例
{
"requestId": "89733cbd-85fd-480b-bbad-23d51c2197f6",
"code": 403,
"status": "error",
"error": {
"code": 104,
"desc": "invalid signature"
},
"data": null
}
