查詢影片資訊
更新時間:2025-01-14 15:28:46
介面描述
1、通过视频id查询视频信息
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
介面URL
http://api.polyv.net/v2/video/{userid}/get-video-info
請求方式
GET
介面限制
1、介面同時支援HTTP及HTTPS,建議使用HTTPS以確保介面安全,介面呼叫有頻率限制,詳細請查看
請求參數描述
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| ptime | true | Long | 目前時間的毫秒級時間戳記,3分鐘內有效 |
| sign | true | String | 簽名,為40位大寫的SHA1值,產生簽名的secretkey金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己的伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| vid | true | String | 影片id(可支援多個,用英文逗號分隔),最多同時傳送100個影片id |
範例
http://api.polyv.net/v2/video/1b448be323/get-video-info
表單參數:
vid=1b448be3231361255350f047cd7ed6bb_1,1b448be323b8d9b9489dcd7e8e09f087_1&sign=29D75C8F042389E667A09D10C94F38A90DF05CC6&ptime=1617096538024
回應參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| code | Integer | 回應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明】 |
| status | String | 回應狀態文字資訊 |
| message | String | 回應描述資訊,當code為400或500時,輔助描述錯誤原因 |
| data | Array | 回應成功時返回影片詳細資訊【詳見data欄位說明】 |
data參數描述
| 欄位 | 類型 | 說明 |
|---|---|---|
| vid | String | 影片id |
| basicInfo | Object | 影片基礎資訊【詳見basicInfo參數描述】 |
| metaData | Object | 影片元資料【詳見metaData參數描述】 |
| transcodeInfos | Array | 轉碼資訊【詳見transcodeInfos參數描述】 |
| snapshotInfo | Object | 截圖資訊【詳見snapshotInfo參數描述】 |
basicInfo參數描述
| 欄位 | 類型 | 說明 |
|---|---|---|
| title | String | 影片標題 |
| description | String | 影片描述 |
| duration | Integer | 影片長度,單位:秒 |
| coverURL | String | 首圖地址,大圖 |
| miniCoverURL | String | 首圖地址,小圖 |
| largeCoverURL | String | 首圖地址,大圖,同coverURL |
| audioUrl | String | 音訊地址,如果影片沒有音訊,返回空字串 |
| creationTime | String | 建立時間,格式:yyyy-MM-dd HH:mm:ss |
| updateTime | String | 更新時間,格式:yyyy-MM-dd HH:mm:ss |
| size | Long | 原始檔案大小,單位:位元組 |
| status | Integer | 影片狀態碼 60/61:已發佈 10:等待編碼 20:正在編碼 40:編碼失敗 50:等待審核 51:審核不通過 -1:已刪除 |
| cateId | Long | 分類id,如1為預設分類 |
| cateName | String | 分類名稱 |
| tags | String | 影片標籤 |
| uploader | String | 上傳者 |
metaData參數描述
| 欄位 | 類型 | 說明 |
|---|---|---|
| size | Long | 原始檔案大小,單位:位元組 |
| format | String | 影片容器類型,如mp4、flv等 |
| duration | Integer | 原始影片長度,單位:秒 |
| bitrate | Integer | 影片位元率,單位:bps |
| fps | Integer | 影片幀率 |
| height | Integer | 解析度高,單位:像素 |
| width | Integer | 解析度寬,單位:像素 |
| codec | String | 編碼格式,如h264、h265等 |
transcodeInfos參數描述
| 欄位 | 類型 | 說明 |
|---|---|---|
| playUrl | String | 播放地址 |
| definition | String | 清晰度 SOURCE:原始清晰度 LD:普清 SD:標清 HD:高清 |
| bitrate | Integer | 影片位元率,單位:kbps |
| duration | Integer | 長度,單位:秒 |
| encrypt | Boolean | 影片是否加密 true:加密影片 false:非加密 |
| format | String | 轉碼格式,如mp4、flv、pdx、hls |
| fps | Integer | 影片幀率 |
| height | Integer | 解析度高,單位:像素 |
| width | Integer | 解析度寬,單位:像素 |
| status | String | 影片狀態 normal:正常播放 unavailable:無法正常播放 |
| fileSize | Long | 編碼後影片大小,單位:位元組 |
snapshotInfo參數描述
| 欄位 | 類型 | 說明 |
|---|---|---|
| imageUrl | String[] | 影片截圖url |
Java請求範例
快速接入基礎程式碼請下載相關依賴原始碼, 點擊下載原始碼,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 VodSignUtil.java 都包含在下載檔案中。
強烈建議您使用點播Java SDK完成API的功能對接,點播Java SDK 對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。
private static final Logger log = LoggerFactory.getLogger(VodVideoManagementTest.class);
/**
* 查询视频信息
* @throws Exception
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetVideoInfo() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/v2/video/%s/get-video-info", userId);
String vid = "1b448be3231361255350f047cd7ed6bb_1,1b448be323b8d9b9489dcd7e8e09f087_1";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("ptime", ptime);
requestMap.put("vid", vid);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFormBody(url, requestMap);
log.debug("测试查询视频信息,{}", response);
//do somethings
}
回應範例
系統全域錯誤說明詳見全域錯誤說明
成功範例
{
"code": 200,
"status": "success",
"message": "success",
"data": [
{
"vid": "1b448be323fddcd3f8823f534918039e_1",
"basicInfo": {
"title": "保利威宣传视频",
"description": "保利威是全球领先的企业直播服务商,隶属于广州易方信息科技股份有限公司,致力于通过可集成、可定制的视频直播技术,为企业搭建自主私域直播系统,并提供直播全流程运营与现场执行服务。",
"duration": 109,
"thumbnailURL": "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_0.jpg",
"coverURL": "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_0_b.jpg",
"audioUrl": "https://mpv.videocc.net/1b448be323/3/1b448be323efac457efa048ec56ae2a3_1.mp3",
"creationTime": "2022-12-13 09:14:07",
"updateTime": "2022-12-13 09:15:15",
"size": 18839865,
"status": 61,
"cateId": 1,
"cateName": "默认分类",
"tags": "宣传视频",
"uploader": "主账号",
"playTimes": 0,
"md5Checksum": "4b88804c015da508b5008f95846befc1",
"extContent": null
},
"metaData": {
"size": 18839865,
"format": "mp4",
"duration": 109,
"bitrate": 1211,
"fps": 30,
"height": 1080,
"width": 1920,
"codec": "h264"
},
"transcodeInfos": [
{
"playUrl": null,
"definition": "LD",
"bitrate": 399,
"duration": 109,
"encrypt": true,
"format": "pdx",
"fps": 30,
"height": 360,
"width": 640,
"status": "normal",
"fileSize": 7770204
},
{
"playUrl": "https://hls.videocc.net/1b448be323/e/1b448be323fddcd3f8823f534918039e_1.m3u8",
"definition": "LD",
"bitrate": 399,
"duration": 109,
"encrypt": true,
"format": "hls",
"fps": 30,
"height": 360,
"width": 640,
"status": "normal",
"fileSize": 7770204
},
{
"playUrl": null,
"definition": "SD",
"bitrate": 892,
"duration": 109,
"encrypt": true,
"format": "pdx",
"fps": 30,
"height": 540,
"width": 960,
"status": "normal",
"fileSize": 14509172
},
{
"playUrl": "https://hls.videocc.net/1b448be323/e/1b448be323fddcd3f8823f534918039e_2.m3u8",
"definition": "SD",
"bitrate": 892,
"duration": 109,
"encrypt": true,
"format": "hls",
"fps": 30,
"height": 540,
"width": 960,
"status": "normal",
"fileSize": 14509172
},
{
"playUrl": null,
"definition": "HD",
"bitrate": 1211,
"duration": 109,
"encrypt": true,
"format": "pdx",
"fps": 30,
"height": 1080,
"width": 1920,
"status": "normal",
"fileSize": 18866914
},
{
"playUrl": "https://hls.videocc.net/1b448be323/e/1b448be323fddcd3f8823f534918039e_3.m3u8",
"definition": "HD",
"bitrate": 1211,
"duration": 109,
"encrypt": true,
"format": "hls",
"fps": 30,
"height": 1080,
"width": 1920,
"status": "normal",
"fileSize": 18866914
}
],
"snapshotInfo": {
"imageUrl": [
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_0.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_1.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_2.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_3.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_4.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_5.jpg"
],
"bigImageUrl": [
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_0_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_1_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_2_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_3_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_4_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_5_b.jpg"
]
}
},
{
"vid": "1b448be323871ffe3d5a84a3638e82c2_1",
"basicInfo": {
"title": "保利威宣传视频",
"description": "保利威是全球领先的企业直播服务商,隶属于广州易方信息科技股份有限公司,致力于通过可集成、可定制的视频直播技术,为企业搭建自主私域直播系统,并提供直播全流程运营与现场执行服务。",
"duration": 109,
"thumbnailURL": "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_0.jpg",
"coverURL": "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_0_b.jpg",
"audioUrl": "",
"creationTime": "2022-12-12 17:47:19",
"updateTime": "2022-12-12 17:52:07",
"size": 18839865,
"status": 61,
"cateId": 1,
"cateName": "默认分类",
"tags": "宣传视频",
"uploader": "主账号",
"playTimes": 0,
"md5Checksum": "4b88804c015da508b5008f95846befc1",
"extContent": null
},
"metaData": {
"size": 18839865,
"format": "mp4",
"duration": 109,
"bitrate": 1211,
"fps": 30,
"height": 1080,
"width": 1920,
"codec": "h264"
},
"transcodeInfos": [
{
"playUrl": null,
"definition": "LD",
"bitrate": 399,
"duration": 109,
"encrypt": true,
"format": "pdx",
"fps": 30,
"height": 360,
"width": 640,
"status": "normal",
"fileSize": 7774918
},
{
"playUrl": "https://hls.videocc.net/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_1.m3u8",
"definition": "LD",
"bitrate": 399,
"duration": 109,
"encrypt": true,
"format": "hls",
"fps": 30,
"height": 360,
"width": 640,
"status": "normal",
"fileSize": 7774918
},
{
"playUrl": null,
"definition": "SD",
"bitrate": 892,
"duration": 109,
"encrypt": true,
"format": "pdx",
"fps": 30,
"height": 540,
"width": 960,
"status": "normal",
"fileSize": 14508330
},
{
"playUrl": "https://hls.videocc.net/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_2.m3u8",
"definition": "SD",
"bitrate": 892,
"duration": 109,
"encrypt": true,
"format": "hls",
"fps": 30,
"height": 540,
"width": 960,
"status": "normal",
"fileSize": 14508330
},
{
"playUrl": null,
"definition": "HD",
"bitrate": 1211,
"duration": 109,
"encrypt": true,
"format": "pdx",
"fps": 30,
"height": 1080,
"width": 1920,
"status": "normal",
"fileSize": 18866914
},
{
"playUrl": "https://hls.videocc.net/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_3.m3u8",
"definition": "HD",
"bitrate": 1211,
"duration": 109,
"encrypt": true,
"format": "hls",
"fps": 30,
"height": 1080,
"width": 1920,
"status": "normal",
"fileSize": 18866914
}
],
"snapshotInfo": {
"imageUrl": [
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_0.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_1.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_2.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_3.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_4.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_5.jpg"
],
"bigImageUrl": [
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_0_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_1_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_2_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_3_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_4_b.jpg",
"https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_5_b.jpg"
]
}
}
]
}
異常範例
{
"code": 400,
"status": "error",
"message": "找不到视频信息,请确认参数信息正确性",
"data": ""
}
