Query Video Information
Updated: 2023-10-27 09:38:36
API Description
1、通过子账号id和视频id,查询视频的详细信息
2、接口支持https协议
API URL
http://api.polyv.net/v3/video/get-video-info
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | POLYV VOD sub-account appId. Path: POLYV VOD Console -> Settings -> Account Management |
| timestamp | true | Long | Current time in milliseconds, valid for 3 minutes |
| sign | true | String | Signature, 32-bit uppercase MD5 value See MD5 Signature Generation Rules |
| vids | true | String | Video IDs, multiple IDs separated by commas. Example: "1b448be32370f4822ac40fd926112a66_1,1b448be323d66f3dae8db5af9f1fdce6_1"; Path: POLYV VOD Console -> Video List; Also obtainable from Upload Video; |
| filter | false | String | Select video information to return, multiple separated by commas. Default is basic info. basicInfo: Basic information metaData: Metadata transcodeInfo: Transcoding information snapshotInfo: Snapshot information Example: "basicInfo,metaData,transcodeInfo,snapshotInfo" |
Example
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
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 for success, non-200 for failure See Global Error Description |
| status | String | Response status text |
| requestId | String | Business request ID for troubleshooting on client/server side |
| error | Object | Error details returned on failure [See error field description](/vod/api/sub_account/sub_get_video_info.md?id=error字段说明], empty on success |
| data | Array | Video information list returned on success [See data field description](/vod/api/sub_account/sub_get_video_info.md?id=data字段说明], empty on failure |
error Field Description
| Field | Type | Description |
|---|---|---|
| code | Integer | Error code |
| desc | String | Error description See Global Error Description |
data Field Description
| Field | Type | Description |
|---|---|---|
| vid | String | Video ID |
| basicInfo | Object | Basic video information See basicInfo field description |
| metaData | Object | Video metadata See metaData field description |
| transcodeInfos | Array | List of video transcoding information See transcodeInfos field description |
| snapshotInfo | Object | Video snapshot information See snapshotInfo field description |
basicInfo Field Description
| Field | Type | Description |
|---|---|---|
| title | String | Video title |
| description | String | Video description |
| duration | Long | Source video duration, unit: seconds |
| coverURL | String | Cover image URL, large |
| miniCoverURL | String | Cover image URL, small |
| largeCoverURL | String | Cover image URL, large, same as coverURL |
| creationTime | String | Creation time |
| updateTime | String | Update time |
| size | Long | Source file size, unit: Bytes |
| status | Integer | Video status code, refer to status field description |
| cateId | Long | Category ID; 1 is the root directory, i.e., "Default Category" |
| cateName | String | Category name |
| tags | String | Tags |
| uploader | String | Uploader |
metaData Field Description
| Field | Type | Description |
|---|---|---|
| size | Long | Source file size, unit: Bytes |
| format | String | Video container type, e.g., mp4, flv |
| duration | Long | Source video duration, unit: seconds |
| bitrate | Integer | Video bitrate, unit: bps |
| fps | Integer | Video frame rate |
| height | Integer | Resolution height, unit: px |
| width | Integer | Resolution width, unit: px |
| codec | String | Encoding format, e.g., h264, h265 |
transcodeInfos Field Description
| Field | Type | Description |
|---|---|---|
| playUrl | String | Playback URL |
| definition | String | Definition SOURCE: Original LD: Low Definition SD: Standard Definition HD: High Definition |
| bitrate | Integer | Bitrate kbps |
| duration | Long | Duration, seconds |
| encrypt | Boolean | Whether encrypted 1: Encrypted video 0: Not encrypted |
| format | String | Transcoding format, e.g., mp4, flv, pdx, hls |
| fps | Integer | Video frame rate |
| height | Integer | Resolution height, unit: px |
| width | Integer | Resolution width, unit: px |
| status | String | Video status normal: Playable normally unavailable: Not playable normally |
snapshotInfo Field Description
| Field | Type | Description |
|---|---|---|
| imageUrl | String[] | Snapshot URL array |
status Field Description
| Video Status Code | Description |
|---|---|
| 60/61 | Published |
| 10 | Waiting for encoding |
| 20 | Encoding |
| 50 | Waiting for review |
| 51 | Review failed |
| -1 | Deleted |
Java Request Example
For quick integration, download the relevant dependency source code. Click to download source code. After downloading, add it to your project. The test case files HttpUtil.java and VodSignUtil.java are included in the download.
It is strongly recommended to use the VOD Java SDK for API integration. The VOD Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
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
}
Response Example
See Global Error Description for system-wide error descriptions.
Success Example
{
"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"
]
}
}
]
}
Error Example
{
"requestId": "89733cbd-85fd-480b-bbad-23d51c2197f6",
"code": 403,
"status": "error",
"error": {
"code": 104,
"desc": "invalid signature"
},
"data": null
}
