playbackSercice
1. Query Recorded Videos
Description
查询录制视频
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/recordFiles
Call Constraints
- API calls are rate-limited. Click here for details. For common call exceptions, click here.
Unit Test
@Test
public void testGetRecordInfo() throws IOException, NoSuchAlgorithmException {
SeminarGetRecordInfoRequest seminarGetRecordInfoRequest = new SeminarGetRecordInfoRequest();
List<SeminarGetRecordInfoResponse> seminarGetRecordInfoResponse;
try {
String channelId = super.getChannelId();
seminarGetRecordInfoRequest.setChannelId(channelId)
.setStartDate(super.getDate(1643163720000L))
.setEndDate(super.getDate(1643163780000L));
seminarGetRecordInfoResponse = new SeminarPlaybackServiceImpl().getRecordInfo(seminarGetRecordInfoRequest);
Assert.assertNotNull(seminarGetRecordInfoResponse);
if (seminarGetRecordInfoResponse != null) {
//to do something ......
log.debug("测试查询录制视频成功 {}", JSON.toJSONString(seminarGetRecordInfoResponse));
}
} 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
SeminarGetRecordInfoResponseobject 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 found inPloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].If the server encounters an exception, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data. Request serial number: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| userId | true | String | POLYV user ID, consistent with the Polyv official website. Path: Official website -> Login -> Live (Development Settings) |
| startDate | false | Date | Start date, format: yyyy-MM-dd |
| endDate | false | Date | End date, format: yyyy-MM-dd |
| sessionId | false | String | Live session ID |
Return Object Description
The return object is List<SeminarGetRecordInfoResponse>. The specific elements of SeminarGetRecordInfoResponse are as follows:
| Parameter | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| fileId | String | Recording file ID |
| url | String | Recording file URL. MP4 is returned preferentially; if MP4 is unavailable, M3U8 is returned. |
| startTime | String | Recording start time, format: yyyyMMddHHmmss |
| endTime | String | Recording end time, format: yyyyMMddHHmmss |
| fileSize | Long | Recording file size (unit: bytes) |
| duration | Integer | Duration (unit: seconds) |
| bitrate | Integer | Recording file bitrate (unit: bytes) |
| resolution | String | Resolution, e.g., 1280x720 |
| channelSessionId | String | Live session ID |
| fileName | String | Recording file name |
| daysLeft | Integer | Remaining days of the recording file. >0: remaining days, -1: permanent. Expired recording file records are not returned. |
| origin | String | Recording file source. manual: manual recording, auto: automatic recording. |
| originSessionId | String | Original live session ID. If the recording file is from manual or automatic recording, it equals the current live session ID. |
| recordFileType | String | Recording file type. complete: complete replay, part: automatic recording segment, merge: manual merge, clip: clip. |
2. Delete Recorded Videos
Description
删除频道视频库中直播暂存的录制视频
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channel/recordFile/%s/delete-record
Call Constraints
API calls are rate-limited. Click here for details. For common call exceptions, click here.
The request parameters
sessionIdandstartTimecannot both be empty. Only one of these parameters must be submitted.
Unit Test
@Test
public void testDeleteRecord() throws IOException, NoSuchAlgorithmException {
SeminarDeleteRecordRequest seminarDeleteRecordRequest = new SeminarDeleteRecordRequest();
Boolean seminarDeleteRecordResponse;
try {
String channelId = super.getChannelId();
seminarDeleteRecordRequest.setChannelId(channelId).setStartTime(super.getDate(1643163515000L));
seminarDeleteRecordResponse = new SeminarPlaybackServiceImpl().deleteRecord(seminarDeleteRecordRequest);
Assert.assertTrue(seminarDeleteRecordResponse);
if (seminarDeleteRecordResponse) {
//to do something ......
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
If the request is correct, a
Booleanobject 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 found inPloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].If the server encounters an exception, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data. Request serial number: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| sessionId | false | String | Session ID of the recorded video |
| startTime | false | Date | Recording start time of the recorded video, format: yyyyMMddHHmmss, e.g., 20210317181043. [Can be obtained by querying channel recording video information.] |
Return Object Description
Return entity for deleting a recorded video.
