videoPogressBarManagement
1. Set Video Keyframe
Description
通过视频id设置视频的打点信息
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/saveKeyFrame
Call Constraints
API calls are rate-limited. For details, see here. For common call exceptions, see here.
The request parameter
seconds(keyframe second [the Nth second]) must be less than the video length.The number of request parameter
desc(keyframe descriptions) must match the number ofseconds.
Unit Test
@Test
public void testSaveVideoKeyFrame() throws IOException, NoSuchAlgorithmException {
VodSaveVideoKeyFrameRequest vodSaveVideoKeyFrameRequest = new VodSaveVideoKeyFrameRequest();
Boolean vodSaveVideoKeyFrameResponse = null;
try {
vodSaveVideoKeyFrameRequest
//可通过 new VodQueryServiceImpl().queryVideoList()获取
.setVideoId(super.getTestVideoId())
.setDesc("junit测试打点1,junit测试打点2")
.setSeconds("1,5")
.setBtnSettingSwitch("Y")
.setBtnDesc("保利威")
.setBtnHref("http://www.polyv.net");
vodSaveVideoKeyFrameResponse = new VodEditServiceImpl().saveVideoKeyFrame(vodSaveVideoKeyFrameRequest);
Assert.assertTrue(vodSaveVideoKeyFrameResponse);
if (vodSaveVideoKeyFrameResponse) {
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 Test Description
On a successful request, a Boolean object is returned. The B-end processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be obtained viaPloyvSdkException.getMessage(), e.g., [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty] ]If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be obtained viaPloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID [corresponds to the vid field in the API documentation] |
| desc | true | String | Keyframe description. If uploading multiple keyframes, separate them with commas. |
| seconds | true | String | Keyframe second [the Nth second]. If uploading multiple keyframes, separate them with commas. |
| btnSettingSwitch | false | String | Button setting switch. Y: enabled; N: disabled; default is disabled [corresponds to the btnsettingswitch field in the API documentation] |
| btnDesc | false | String | Button description. Required when the button switch is enabled; not set when disabled [corresponds to the btndesc field in the API documentation] |
| btnHref | false | String | Button redirect URL. Required when the button switch is enabled; not set when disabled [corresponds to the btnhref field in the API documentation] |
Return Object Description
true indicates successful keyframing, false indicates failure.
2. Query Keyframe Information for a Single Video
Description
通过视频id查询单个视频的打点信息
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/keyframe/%s
Call Constraints
Unit Test
@Test
public void testListVideoKeyFrame() throws IOException, NoSuchAlgorithmException {
VodListVideoKeyFrameRequest vodListVideoKeyFrameRequest = new VodListVideoKeyFrameRequest();
VodListVideoKeyFrameResponse vodListVideoKeyFrameResponse = null;
try {
vodListVideoKeyFrameRequest
//可通过 new VodQueryServiceImpl().queryVideoList()获取
.setVideoId("1b448be32343357d5c4784d9ffd1bf5c_1");
vodListVideoKeyFrameResponse = new VodInfoServiceImpl().listVideoKeyFrame(vodListVideoKeyFrameRequest);
Assert.assertNotNull(vodListVideoKeyFrameResponse);
if (vodListVideoKeyFrameResponse != null) {
log.debug("测试查询单个视频的打点信息成功,{}", JSON.toJSONString(vodListVideoKeyFrameResponse));
}
} 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
On a successful request, a
VodListVideoKeyFrameResponseobject is returned. The B-end processes business logic based on this object.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be obtained viaPloyvSdkException.getMessage(), e.g., [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty] ]If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be obtained viaPloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID [corresponds to the vid field in the API documentation] |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| duration | String | Returned duration, e.g., 00:00:15 |
| keyFrameList | Array | List of keyframe information [corresponds to the keyframeList field in the API documentation] [See KeyFrame Parameter Description for details] |
KeyFrame Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| seconds | Integer | Keyframe time point, in seconds |
| keyContent | String | Keyframe details |
3. Delete Video Keyframe Information
Description
通过视频id与时间点删除视频的打点信息
接口地址(仅做说明使用):https://api.polyv.net/v2/video/delete-chapter-marker
Call Constraints
Unit Test
@Test
public void testDeleteVideoFrame() throws IOException, NoSuchAlgorithmException {
VodDeleteVideoFrameRequest vodDeleteVideoFrameRequest = new VodDeleteVideoFrameRequest();
Boolean vodDeleteVideoFrameResponse = null;
try {
vodDeleteVideoFrameRequest.setVideoId(super.getTestVideoId()).setTimePoints("24,120");
vodDeleteVideoFrameResponse = new VodEditServiceImpl().deleteVideoFrame(vodDeleteVideoFrameRequest);
Assert.assertTrue(vodDeleteVideoFrameResponse);
if (vodDeleteVideoFrameResponse) {
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 Test Description
On a successful request, a Boolean object is returned. The B-end processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be obtained viaPloyvSdkException.getMessage(), e.g., [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty] ]If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be obtained viaPloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID [corresponds to the vid field in the API documentation] |
| timePoints | false | String | Time points, in seconds. Separate multiple points with commas, e.g., "1, 2". If not provided, all keyframe information for the video will be deleted. |
Return Object Description
true indicates successful deletion, false indicates failure.
