infoService
1. Query Single Video Information
Description
通过视频id查询单个视频的信息
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/get-video-msg
Call Constraints
- The API call is subject to rate limits. For details, please refer to [/vod/java/limit]. For common call exceptions, please refer to [/vod/java/exceptionDoc].
Unit Testing
@Test
public void testGetVideo() throws IOException, NoSuchAlgorithmException {
VodGetVideoRequest vodGetVideoRequest = new VodGetVideoRequest();
VodGetVideoResponse vodGetVideoResponse = null;
try {
vodGetVideoRequest.setVideoId(super.getTestVideoId());
vodGetVideoResponse = new VodInfoServiceImpl().getVideo(vodGetVideoRequest);
Assert.assertNotNull(vodGetVideoResponse);
if (vodGetVideoResponse != null) {
log.debug("测试查询单个视频信息成功,{}", JSON.toJSONString(vodGetVideoResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, a
VodGetVideoResponseobject is returned, and the B-side processes business logic based on this object.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID [corresponds to the vid field in the API documentation] |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| swfLink | String | Returns the flash link [corresponds to the swf_link field in the API documentation] |
| tag | String | Video tag |
| mp4 | String | MP4 source file |
| playerWidth | Integer | Video width [corresponds to the playerwidth field in the API documentation] |
| title | String | Video title |
| duration | String | Video duration, e.g., 00:00:48 |
| filesize | Long[] | File sizes of each encoded video definition, type is array |
| firstImage | String | Video thumbnail [corresponds to the first_image field in the API documentation] |
| times | Integer | Number of plays |
| context | String | Video description |
| originalDefinition | String | Best resolution, e.g., 1280x720 [corresponds to the original_definition field in the API documentation] |
| images | String[] | Video screenshots |
| playerHeight | Integer | Video height [corresponds to the playerheight field in the API documentation] |
| uploadTime | Date | Upload time, format: yyyy-MM-dd HH:mm:ss [corresponds to the ptime field in the API documentation] |
| videoId | String | Video ID [corresponds to the vid field in the API documentation] |
| previewVideoId | String | Preview video ID [corresponds to the previewVid field in the API documentation] |
| categoryId | String | Category ID, e.g., 1 for root directory [corresponds to the cataid field in the API documentation] |
| defaultVideo | String | User's default playback video [corresponds to the default_video field in the API documentation] |
| df | Integer | Video bitrate number |
| SDFlv | String | Smooth bitrate FLV format video URL [corresponds to the flv1 field in the API documentation] |
| HDFlv | String | High-definition bitrate FLV format video URL [corresponds to the flv2 field in the API documentation] |
| FHDFlv | String | Ultra-high-definition bitrate FLV format video URL [corresponds to the flv3 field in the API documentation] |
| SDMp4 | String | Smooth bitrate MP4 format video URL [corresponds to the mp4_1 field in the API documentation] |
| HDmp4 | String | High-definition bitrate MP4 format video URL [corresponds to the mp4_2 field in the API documentation] |
| FHDmp4 | String | Ultra-high-definition bitrate MP4 format video URL [corresponds to the mp4_3 field in the API documentation] |
| hls | String[] | Index file, records the m3u8 links for each definition. The first element is the smooth link, the second is high-definition, the third is ultra-high-definition. Array length is 1-3. |
| SDHls | String | Smooth definition m3u8 |
| HDHls | String | High-definition m3u8 |
| FHDHls | String | Ultra-high-definition m3u8 |
| imagesBig | String[] | Large video screenshot URLs [corresponds to the images_b field in the API documentation] |
| seed | Integer | 1 for encrypted video, 0 for non-encrypted |
| status | Integer | Video status: 60/61 published; 10 waiting for encoding; 20 encoding; 50 pending review; 51 review failed; -1 deleted; |
| keepSource | Integer | Whether it is the source file: 0 for no, 1 for yes [corresponds to the keepsource field in the API documentation] |
| uploader | Uploader | Uploader information [see Uploader parameter description] |
| hlsLevel | String | Encryption level: open for non-authorized encryption, web for web authorization, app for app authorization, wxa_app for mini-program authorization |
| categoryName | String | Category name [corresponds to the cataname field in the API documentation] |
| imageUrls | Array | Small video screenshot URLs |
| sourceFileSize | String | Source video file size, unit: byte [corresponds to the source_filesize field in the API documentation] |
| md5CheckSum | String | MD5 value of the source video file uploaded to the POLYV cloud platform, used to verify if the upload was incorrect or complete [corresponds to the md5checksum field in the API documentation] |
Uploader Parameter Description
| Parameter | Type | Description |
|---|---|---|
| String | Uploader's email | |
| name | String | Uploader's name |
| role | String | Uploader's role, e.g., admin, uploader, primary account |
2. Query Video Authorization Playback Switch
Description
通过视频id查询视频授权播放开关状态
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/authplay-status
Call Constraints
- The API call has a frequency limit. For details, please refer to [/vod/java/limit]. For common call exceptions, please refer to [/vod/java/exceptionDoc].
Unit Testing
@Test
public void testGetVideoPlayStatus() throws IOException, NoSuchAlgorithmException {
VodGetVideoPlayStatusRequest vodGetVideoPlayStatusRequest = new VodGetVideoPlayStatusRequest();
Boolean vodGetVideoPlayStatusResponse = null;
try {
vodGetVideoPlayStatusRequest
//可通过 new VodQueryServiceImpl().queryVideoList()获取
.setVideoId(super.getTestVideoId());
vodGetVideoPlayStatusResponse = new VodInfoServiceImpl().getVideoPlayStatus(vodGetVideoPlayStatusRequest);
Assert.assertTrue(vodGetVideoPlayStatusResponse);
if (vodGetVideoPlayStatusResponse) {
log.debug("测试查询视频授权播放开关成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID [corresponds to the vid field in the API documentation] |
Return Object Description
true indicates the switch is on, false indicates the switch is off.
3. Query Video Duration and Size
Description
通过视频id或分类id查询视频的时长和大小
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/getSizeByCata
Call Constraints
The API call has a frequency limit. For details, see here. For common call exceptions, see here.
When
videoIdsis provided, query byvideoIds; when onlycategoryIdsis provided, query bycategoryIds;videoIdsandcategoryIdscannot both be empty; if both are provided,videoIdstakes precedence.
Unit Test
@Test
public void testGetVideoSize() throws IOException, NoSuchAlgorithmException {
VodGetVideoSizeRequest vodGetVideoSizeRequest = new VodGetVideoSizeRequest();
List<VodGetVideoSizeResponse> vodGetVideoSizeResponseList = null;
try {
vodGetVideoSizeRequest.setVideoIds(super.getTestVideoId()).setCategoryIds("1602300731843");
vodGetVideoSizeResponseList = new VodInfoServiceImpl().getVideoSize(vodGetVideoSizeRequest);
Assert.assertNotNull(vodGetVideoSizeResponseList);
if (vodGetVideoSizeResponseList != null) {
log.debug("测试根据分类批量查询视频时长和大小成功,{}", JSON.toJSONString(vodGetVideoSizeResponseList));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
If the request is correct, a
VodGetVideoSizeResponseobject is returned, and the B-side processes business logic based on this object.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoIds | true | String | Multiple video IDs (separated by English commas, half-width), e.g., 1b8be3,239c2e [Corresponds to the vids field in the API documentation] |
| categoryIds | false | String | Multiple category IDs (separated by commas). When vids is provided, query by vids; when only cataid is provided, query by cataid; vids and cataid cannot both be empty [Corresponds to the cataid field in the API documentation] |
Return Object Description
The return object is List<VodGetVideoSizeResponse>. The specific elements of VodGetVideoSizeResponse are as follows:
| Parameter Name | Type | Description |
|---|---|---|
| categoryId | String | Category ID [corresponds to the cataid field in the API documentation] |
| videos | Array | List of video results [see Video Parameter Description for details] |
Video Parameter Description
| Parameter | Type | Description |
|---|---|---|
| videoId | String | Video ID [corresponds to the vid field in the API documentation] |
| duration | String | Duration, format: hh:mm:ss. Example: 00:03:11 |
| filesize1 | Long | Size of the encoded bitrate 1 FLV, in Bytes |
| filesize2 | Long | Size of the encoded bitrate 2 FLV, in Bytes |
| filesize3 | Long | Size of the encoded bitrate 3 FLV, in Bytes |
4. Query Video Information from WeChat Share Page
Description
通过视频id查询微信分享页的视频信息
接口地址(仅做说明使用):https://api.polyv.net/v2/video/wechat-share/%s/video-info
Call Constraints
- The API call is subject to rate limits. Click here for details. For common call exceptions, click here for details.
Unit Testing
@Test
public void testGetWeChatShareVideoInfo() throws IOException, NoSuchAlgorithmException {
VodGetWeChatShareVideoInfoRequest vodGetWeChatShareVideoInfoRequest = new VodGetWeChatShareVideoInfoRequest();
VodGetWeChatShareVideoInfoResponse vodGetWeChatShareVideoInfoResponse = null;
try {
vodGetWeChatShareVideoInfoRequest.setVideoId(super.getTestVideoId());
vodGetWeChatShareVideoInfoResponse = new VodInfoServiceImpl().getWeChatShareVideoInfo(
vodGetWeChatShareVideoInfoRequest);
Assert.assertNotNull(vodGetWeChatShareVideoInfoResponse);
if (vodGetWeChatShareVideoInfoResponse != null) {
log.debug("测试查询微信分享页的视频相关信息成功,{}", JSON.toJSONString(vodGetWeChatShareVideoInfoResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, return a
VodGetWeChatShareVideoInfoResponseobject, based on which the B-side handles the business logic.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID [corresponds to the vid field in the API documentation] |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| videoCoverImg | String | Video cover image |
| videoTitle | String | Video title for WeChat sharing |
| videoDesc | String | Video description |
| videoIcon | String | Video icon |
| originalPlayTimes | Integer | Initial play count |
| originalLikeNum | Integer | Initial like count |
5. Query Video Playback Preview Duration
Description
通过视频id查询视频播放预览时长
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/get-preview-duration
Call Constraints
Unit Testing
@Test
public void testGetVideoPreviewDuration() throws IOException, NoSuchAlgorithmException {
VodGetVideoPreviewDurationRequest vodGetVideoPreviewDurationRequest = new VodGetVideoPreviewDurationRequest();
Integer vodGetVideoPreviewDurationResponse = null;
try {
vodGetVideoPreviewDurationRequest.setVideoId(super.getTestVideoId());
vodGetVideoPreviewDurationResponse = new VodInfoServiceImpl().getVideoPreviewDuration(
vodGetVideoPreviewDurationRequest);
Assert.assertNotNull(vodGetVideoPreviewDurationResponse);
if (vodGetVideoPreviewDurationResponse != null) {
log.debug("测试查询视频播放预览时长成功,{}", JSON.toJSONString(vodGetVideoPreviewDurationResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, an Integer object is returned, and the B-side processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID [corresponds to the vid field in the API documentation] |
Return Object Description
Video playback preview duration, in seconds.
6. Query the Thumbnail of a Single Video
Description
通过视频id查询单个视频的首图
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/get-image
Call Constraints
- The API call has a frequency limit. For details, please refer to [/vod/java/limit]. For common call exceptions, please refer to [/vod/java/exceptionDoc].
Unit Testing
@Test
public void testGetVideoFirstImage() throws IOException, NoSuchAlgorithmException {
VodGetVideoFirstImageRequest vodGetVideoFirstImageRequest = new VodGetVideoFirstImageRequest();
String vodGetVideoFirstImageResponse = null;
try {
vodGetVideoFirstImageRequest.setVideoId(super.getTestVideoId()).setThumbnail(1);
vodGetVideoFirstImageResponse = new VodInfoServiceImpl().getVideoFirstImage(vodGetVideoFirstImageRequest);
Assert.assertNotNull(vodGetVideoFirstImageResponse);
if (vodGetVideoFirstImageResponse != null) {
log.debug("测试查询单个视频的首图成功,{}", vodGetVideoFirstImageResponse);
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, a String object is returned, and the B-side processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID [corresponds to the vid field in the API documentation] |
| thumbnail | false | Integer | Whether it is a thumbnail of the video cover image. Value 1: Yes; Value 0: No. Default is 0: Not a thumbnail of the video cover image [corresponds to the t field in the API documentation] |
Return Object Description
First image address
7. Query Video Password
Description
通过视频id查询视频密码
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/video-setting-page
Call Constraints
- The API call has a frequency limit. For details, please refer to [/vod/java/limit]. For common call exceptions, please refer to [/vod/java/exceptionDoc].
Unit Testing
@Test
public void testQueryVideoPassword() throws IOException, NoSuchAlgorithmException {
VodQueryVideoPasswordRequest vodQueryVideoPasswordRequest = new VodQueryVideoPasswordRequest();
VodQueryVideoPasswordResponse vodQueryVideoPasswordResponse = null;
try {
vodQueryVideoPasswordRequest.setVideoId(super.getTestVideoId());
vodQueryVideoPasswordResponse = new VodInfoServiceImpl().queryVideoPassword(vodQueryVideoPasswordRequest);
Assert.assertNotNull(vodQueryVideoPasswordResponse);
if (vodQueryVideoPasswordResponse != null) {
log.debug("测试查询视频密码成功,{}", JSON.toJSONString(vodQueryVideoPasswordResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, return a
VodQueryVideoPasswordResponseobject, based on which the B-side handles business logic.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID [corresponds to the vids field in the API documentation] |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| isShowPassword | Boolean | Whether to show the password, default is false |
| password | String | Video password |
| videoId | String | Video ID |
| title | String | Video title |
8. Batch Query Video Play Counts
Description
通过视频id批量查询视频播放次数
接口地址(仅做说明使用):https://api.polyv.net/v2/data/%s/play-times
Call Constraints
- The API call has a frequency limit. For details, please refer to [/vod/java/limit]. For common call exceptions, please refer to [/vod/java/exceptionDoc].
Unit Testing
@Test
public void testGetVideosPlayTimes() throws IOException, NoSuchAlgorithmException {
VodGetVideosPlayTimesRequest vodGetVideosPlayTimesRequest = new VodGetVideosPlayTimesRequest();
List<VodGetVideosPlayTimesResponse> vodGetVideosPlayTimesResponseList = null;
try {
vodGetVideosPlayTimesRequest.setVideoIds(
"1b448be3234406608b7838c7ef6b597c_1,1b448be323a146649ad0cc89d0faed9c_1").setRealTime(0);
vodGetVideosPlayTimesResponseList = new VodInfoServiceImpl().getVideosPlayTimes(
vodGetVideosPlayTimesRequest);
Assert.assertNotNull(vodGetVideosPlayTimesResponseList);
if (vodGetVideosPlayTimesResponseList != null) {
log.debug("测试批量查询视频播放次数成功,{}", JSON.toJSONString(vodGetVideosPlayTimesResponseList));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, return a
VodGetVideosPlayTimesResponseobject, and the B-side processes business logic based on this object.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed fields [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoIds | true | String | Multiple video IDs (separated by English commas, half-width), recommended not to exceed 200, e.g., 1b8be3,239c2e [Corresponds to the vids field in the API documentation] |
| realTime | false | Integer | Whether real-time, 1 for real-time, 0 for non-real-time, default is 0: non-real-time |
Return Object Description
The return object is List<VodGetVideosPlayTimesResponse>. The specific elements of VodGetVideosPlayTimesResponse are as follows:
| Parameter | Type | Description |
|---|---|---|
| videoId | String | Video ID [corresponds to the vid field in the API documentation] |
| times | Integer | Number of plays |
9. Query Video Information
Description
通过视频id查询视频信息
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/get-video-info
Call Constraints
- The API call has a frequency limit. For details, please refer to [/vod/java/limit]. For common call exceptions, please refer to [/vod/java/exceptionDoc].
Unit Testing
@Test
public void testGetVideoInfo() throws IOException, NoSuchAlgorithmException {
VodAccountQueryVideoInfoRequest vodAccountQueryVideoInfoRequest = new VodAccountQueryVideoInfoRequest();
List<VodAccountQueryVideoInfoResponse> vodAccountQueryVideoInfoResponse;
try {
vodAccountQueryVideoInfoRequest.setVideoIds(super.getTestVideoId());
vodAccountQueryVideoInfoResponse = new VodInfoServiceImpl().getVideoInfo(vodAccountQueryVideoInfoRequest);
Assert.assertNotNull(vodAccountQueryVideoInfoResponse);
if (vodAccountQueryVideoInfoResponse != null) {
//to do something ......
log.debug("测试查询视频信息成功 {}", JSON.toJSONString(vodAccountQueryVideoInfoResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, return a VodAccountQueryVideoInfoResponse object, based on which the B-side processes business logic.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoIds | true | String | Video ID(s) (multiple IDs supported, separated by commas) [Corresponds to the vid field in the API documentation] |
Return Object Description
The return object is List<VodAccountQueryVideoInfoResponse>. The specific elements of VodAccountQueryVideoInfoResponse are as follows:
| Parameter | Type | Description |
|---|---|---|
| videoId | String | Video ID [corresponds to the vid field in the API documentation] |
| basicInfo | BasicInfo | Basic information of the queried video [see BasicInfo parameter description] |
| transcodeInfos | Array | Transcoding information of the queried video [see TranscodeInfos parameter description] |
| metaData | MetaData | Metadata of the queried video [see MetaData parameter description] |
| snapshotInfo | SnapshotInfo | Snapshots of the queried video [see SnapshotInfo parameter description] |
BasicInfo Parameter Description
| Parameter | Type | Description |
|---|---|---|
| title | String | Video title |
| description | String | Video description |
| duration | Integer | Source video duration, in seconds |
| coverURL | String | Cover image URL, large image |
| creationTime | Date | Creation time, format: yyyy-MM-dd HH:mm:ss |
| updateTime | Date | Update time, format: yyyy-MM-dd HH:mm:ss |
| size | Long | Source file size, in Bytes |
| status | Integer | Video status code; 60/61: Published; 10: Waiting for encoding; 20: Encoding; 50: Waiting for review; 51: Review failed; -1: Deleted |
| categoryId | String | Category ID, e.g., 1 for root directory [corresponds to the cateId field in the API documentation] |
| categoryName | String | Category name [corresponds to the cateName field in the API documentation] |
| tags | String | Tags |
| uploader | String | Uploader |
TranscodeInfos Parameter Description
| Parameter | Type | Description |
|---|---|---|
| playUrl | String | Playback URL |
| definition | String | Quality: SOURCE (original), LD (low definition), SD (standard definition), HD (high definition) |
| duration | Integer | Duration in seconds |
| encrypt | Boolean | True for encrypted video, false for non-encrypted |
| format | String | Transcoding format, e.g., mp4, flv, pdx, hls |
| fps | Integer | Video frame rate |
| bitrate | Integer | Bitrate in kbps |
| height | Integer | Resolution height in pixels |
| width | Integer | Resolution width in pixels |
| status | String | Video status: normal (playable), unavailable (cannot play) |
| fileSize | Long | Encoded video size in bytes |
MetaData Parameter Description
| Parameter | Type | Description |
|---|---|---|
| size | Long | Source file size, in Bytes |
| format | String | Video container type, e.g., mp4, flv |
| duration | Integer | Source video duration, in seconds |
| bitrate | Integer | Video bitrate, in bps |
| fps | Integer | Video frame rate |
| height | Integer | Resolution height, in px |
| width | Integer | Resolution width, in px |
| codec | String | Encoding format, e.g., h264, h265 |
SnapshotInfo Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| imageUrl | Array | Array of screenshot URLs |
