channelPlayback
1. Add Videos from On-Demand to the Video Library
Description
将点播中的视频添加到视频库
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/playback/add
Call Constraints
The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
For on-demand videos, set the tag to the channel number, separated by commas for multiple entries.
Unit Test
@Test
public void testAddChannelVideoPlayback() throws Exception, NoSuchAlgorithmException {
LiveCreateChannelVideoPlaybackRequest liveCreateChannelVideoPlaybackRequest =
new LiveCreateChannelVideoPlaybackRequest();
LiveCreateChannelVideoPlaybackResponse liveCreateChannelVideoPlaybackResponse;
try {
liveCreateChannelVideoPlaybackRequest.setChannelId(getAloneChannelId())
.setVideoId("1b448be323f85566b217d3988dbb35a8_1")
.setListType("vod")
.setSetAsDefault("Y");
liveCreateChannelVideoPlaybackResponse = new LiveChannelPlaybackServiceImpl().addChannelVideoPlayback(
liveCreateChannelVideoPlaybackRequest);
Assert.assertNotNull(liveCreateChannelVideoPlaybackResponse);
if (liveCreateChannelVideoPlaybackResponse != null) {
//to do something ......
log.debug("测试将点播中的视频添加到视频库成功{}", JSON.toJSONString(liveCreateChannelVideoPlaybackResponse));
}
} 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, it returns a
LiveCreateChannelVideoPlaybackResponseobject, based on which the B-side processes 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.LivexxxRequest] 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| videoId | true | String | The on-demand video to be added as a replay [corresponds to the vid field in the API documentation] |
| listType | false | String | playback - replay list, vod - on-demand list; |
| setAsDefault | false | String | Position in the video library list when added, default is N. Y: pin to top of the replay list, N: pin to bottom of the replay list |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| videoId | String | ID generated by the live streaming system |
| videoPoolId | String | VOD video VID |
| userId | String | User ID in the VOD backend |
| channelId | String | Live channel ID corresponding to the replay video |
| title | String | Video title |
| firstImage | String | Video thumbnail |
| duration | String | Video length, e.g., 00:00:30 |
| myBr | String | Default video playback quality: 1 for smooth, 2 for HD, 3 for ultra HD |
| qid | String | Visitor information collection ID |
| seed | String | Video encryption status: 1 for encrypted, 0 for non-encrypted |
| createdTime | Date | Date added as a replay video |
| lastModified | Date | Last modification date of the video |
| url | String | Video playback URL. Note: If the video is encrypted, this URL is inaccessible. |
| channelSessionId | String | Used for PPT data requests, related to PPT live replay; value is null for regular live replays |
| mergeInfo | String | Video merge information |
| startTime | String | Live streaming start time |
| liveType | String | Scene type of the replay video |
2. Asynchronous Batch Transfer of Recorded Files to VOD
Description
异步批量转存录制文件到点播
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/record/convert
Call Constraints
- The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testConvertChannelVideoListAsync() throws Exception, NoSuchAlgorithmException {
LiveConvertChannelVideoListAsyncRequest liveConvertChannelVideoListAsyncRequest =
new LiveConvertChannelVideoListAsyncRequest();
Boolean liveConvertChannelVideoResponse;
try {
liveConvertChannelVideoListAsyncRequest.setChannelId("1951952")
.setFileIds("dfcfabd4e3db60892b625aeddf80b242,4329a8920588b257c3d66414bd37f8d8")
.setFileName("删除-直播录制转点播")
.setCataId(null)
.setCallbackUrl(null);
liveConvertChannelVideoResponse = new LiveChannelPlaybackServiceImpl().convertChannelVideoListAsync(
liveConvertChannelVideoListAsyncRequest);
Assert.assertNotNull(liveConvertChannelVideoResponse);
if (liveConvertChannelVideoResponse) {
//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 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.LivexxxRequest] 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| fileIds | true | String | IDs of the recorded video files to be transferred, multiple IDs separated by commas |
| fileName | false | String | File name after transfer; currently, multiple file names are not supported |
| cataId | false | Long | Directory ID in VOD for the transfer; defaults to the root directory ID of VOD |
| callbackUrl | false | String | Callback URL for notification upon successful transfer; see Appendix for related parameters |
| appId | false | String | POLYV user APP_ID; required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET; required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates successful submission, false indicates failed submission. The actual success of the transfer depends on the callback.
3. Asynchronously Merge Live Recording Files
Description
异步合并直播录制文件
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/record/merge
Call Constraints
- The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testMergeChannelVideoAsync() throws Exception, NoSuchAlgorithmException {
LiveMergeChannelVideoAsyncRequest liveMergeChannelVideoAsyncRequest = new LiveMergeChannelVideoAsyncRequest();
Boolean liveMergeChannelVideoAsyncResponse;
try {
liveMergeChannelVideoAsyncRequest.setChannelId("1951952")
.setFileIds("dfcfabd4e3db60892b625aeddf80b242,4329a8920588b257c3d66414bd37f8d8")
.setFileName("测试合并-可删除")
.setCallbackUrl(null)
.setAutoConvert("Y")
.setMergeMp4("Y");
liveMergeChannelVideoAsyncResponse = new LiveChannelPlaybackServiceImpl().mergeChannelVideoAsync(
liveMergeChannelVideoAsyncRequest);
Assert.assertTrue(liveMergeChannelVideoAsyncResponse);
if (liveMergeChannelVideoAsyncResponse) {
//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 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. For error details, refer toPloyvSdkException.getMessage(), e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, failed fields: [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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| fileIds | true | String | IDs of recorded video files to merge, separated by commas. Obtain fileId by querying the video library list. |
| fileName | false | String | File name of the merged video |
| callbackUrl | false | String | URL for callback upon merge success or failure, can include custom parameters |
| autoConvert | false | String | Pass "Y" to automatically save to the corresponding on-demand category (Live Replay - Channel ID - Session) |
| mergeMp4 | false | String | Pass "Y" to merge MP4 files; pass "N" or leave empty to merge m3u8 files |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is invoked). Obtain from the POLYV official website: Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is invoked). Obtain from the POLYV official website: Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates successful submission, false indicates failed submission. The actual success of the merge is determined by the callback.
Callback Description
This interface processes asynchronously. If you need to obtain the result of the transfer, you can submit the callbackUrl parameter when making the request. After the program successfully or fails to transfer, a callback notification will be sent to the callbackUrl.
| Parameter Name | Type | Description |
|---|---|---|
| status | String | Interface processing result, values: success, error |
| code | String | Error code: userExpired - user expired; spaceOverSize - insufficient on-demand storage space; unknown - unknown exception |
| userId | String | User ID |
| channelId | String | Channel ID |
| fileId | String | Transferred file ID |
| sign | String | Encrypted string for verification, generated by the rule md5(AppSecret+timestamp), where AppSecret is the secret key of the live streaming system |
| timestamp | String | 13-digit millisecond timestamp |
4. Query Channel Recording Video Information
Description
查询频道录制视频信息
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/recordFiles
Call Constraints
- The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testListChannelVideo() throws Exception, NoSuchAlgorithmException {
LiveChannelVideoListRequest liveChannelVideoListRequest = new LiveChannelVideoListRequest();
LiveChannelVideoListResponse liveChannelVideoListResponse;
try {
liveChannelVideoListRequest.setChannelId("1951952")
.setStartDate(getDate(2020, 1, 1))
.setEndDate(getDate(2020, 10, 14))
.setSessionIds("fs4j2z8wcb,fs8p8eso44");
liveChannelVideoListResponse = new LiveChannelPlaybackServiceImpl().listChannelVideo(
liveChannelVideoListRequest);
Assert.assertNotNull(liveChannelVideoListResponse);
if (liveChannelVideoListResponse != null) {
//to do something ......
log.debug("查询频道录制视频信息成功{}", JSON.toJSONString(liveChannelVideoListResponse));
}
} 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
LiveChannelVideoListResponseobject is returned, and the B-side processes business logic based on this object.If request parameter validation fails, a
PloyvSdkExceptionis thrown. SeePloyvSdkException.getMessage()for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, 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 |
|---|---|---|---|
| userId | false | String | POLYV user ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
| channelId | true | String | The channel number for which to set channel details, e.g., 1938028. |
| startDate | false | Date | Start date (the date the recording was generated), format: yyyy-MM-dd. |
| endDate | false | Date | End date, format: yyyy-MM-dd. |
| sessionIds | false | String | Session IDs, separated by commas for multiple IDs (only query videos whose transfer source is channel recordings). |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| channelVedioInfos | Array | Video library video information [See ChannelVedioInfo Parameter Description] |
ChannelVideoInfo Parameter Description
| Parameter | Type | Description |
|---|---|---|
| fileId | String | Recording file ID |
| channelId | String | Channel ID |
| url | String | Recording file URL, returns mp4 first; if mp4 is unavailable, returns m3u8 |
| startTime | Date | Recording start time |
| endTime | Date | Recording end time |
| fileSize | Long | Recording file size (unit: bytes) |
| duration | Integer | Duration (unit: seconds) |
| bitrate | Integer | Recording file bitrate (unit: bytes) |
| resolution | String | Resolution |
| channelSessionId | String | Live streaming 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 streaming session ID. When the recording file is manually or automatically recorded, it equals the current live streaming session ID. |
| recordFileType | String | Recording file type: complete (full playback), part (automatic recording segment), merge (manual merge), clip (trimming) |
5. Query Video Library List
Description
查询视频库列表
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channel/recordFile/%s/playback/list
Call Constraints
- The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testListChannelVideoLibrary() throws Exception, NoSuchAlgorithmException {
LiveListChannelVideoLibraryRequest liveListChannelVideoLibraryRequest =
new LiveListChannelVideoLibraryRequest();
LiveListChannelVideoLibraryResponse liveListChannelVideoLibraryResponse;
try {
liveListChannelVideoLibraryRequest.setChannelId(super.createChannel())
.setListType("playback");
liveListChannelVideoLibraryResponse = new LiveChannelPlaybackServiceImpl().listChannelVideoLibrary(
liveListChannelVideoLibraryRequest);
Assert.assertNotNull(liveListChannelVideoLibraryResponse);
if (liveListChannelVideoLibraryResponse != null) {
//to do something ......
log.debug("测试查询视频库列表成功{}", JSON.toJSONString(liveListChannelVideoLibraryResponse));
}
} 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
LiveListChannelVideoLibraryResponseobject 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.LivexxxRequest] 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, 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| listType | false | String | playback - replay list, vod - on-demand list; default is vod for normal live streaming scenarios, playback for three-screen scenarios |
| sessionIds | false | String | Session IDs, separated by commas for multiple entries (only queries videos whose source is channel recordings) |
| currentPage | false | Integer | Page number, default is 1 (corresponds to the page field in the API documentation) |
| pageSize | false | Integer | Number of data entries displayed per page, default is 20 entries per page |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| contents | Array | Video library video information [see ChannelVideoLibrary parameter description] |
| pageSize | Integer | Number of data items displayed per page, default is 20 items per page |
| currentPage | Integer | Current page [corresponds to the pageNumber field in the API documentation] |
| totalItems | Integer | Total number of records |
| totalPage | Integer | Total number of pages [corresponds to the totalPages field in the API documentation] |
ChannelVideoLibrary Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| videoId | String | ID generated by the live streaming system |
| videoPoolId | String | VOD video VID |
| userId | String | User ID in the VOD backend |
| channelId | String | Live channel ID corresponding to the replay video |
| title | String | Video title |
| firstImage | String | Video thumbnail |
| duration | String | Video length, e.g., 00:27:10 |
| myBr | Integer | Default video playback quality 1: Smooth 2: HD 3: Ultra HD |
| qid | String | Visitor information collection ID |
| seed | Integer | Video encryption status, 1 indicates encrypted, 0 indicates unencrypted |
| createdTime | Date | Date added as a replay video |
| lastModified | Date | Last modification date of the video |
| asDefault | String | Whether it is the default playback video, value is Y/N |
| url | String | Video playback URL. Note: If the video is encrypted, this URL is inaccessible |
| channelSessionId | String | Used for PPT data requests, related to PPT live replay; value is null for regular live replays |
| mergeInfo | String | Video merge information, to be supplemented later |
| startTime | Date | Live streaming start time |
| liveType | String | alone: Event live, ppt: Three-screen, topclass: Large class, seminar: Seminar |
| ordertime | Integer | Sort field for associated VOD videos |
| rank | Integer | Sort value, higher value indicates higher priority |
| width | Integer | Video width |
| height | Integer | Video height |
| status | String | Status of the associated VOD video |
| fileUrl | String | Video URL |
| fileId | String | Temporary file ID before replay video transfer |
| origin | String | manual: Manual recording, auto: Automatic recording, merge: Merge, clip: Clip |
| callbackUrl | String | Callback URL set when transferring the video |
| errorCount | Integer | Number of processing failures |
| lang | String | zh_CN: Chinese, EN: English |
| videoIdEN | String | English replay videoId |
| enFileUrl | String | English replay file URL |
| watchUrl | String | URL to watch the replay video |
| originSessionId | String | Source session ID |
6. Query Channel Live Session Information
Description
查询频道直播场次信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/session/list
Call Constraints
- The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testListChannelSessionInfo() throws Exception, NoSuchAlgorithmException {
LiveListChannelSessionInfoRequest liveListChannelSessionInfoRequest = new LiveListChannelSessionInfoRequest();
LiveListChannelSessionInfoResponse liveListChannelSessionInfoResponse;
try {
Calendar instance = Calendar.getInstance();
instance.set(2020, 10, 1);
liveListChannelSessionInfoRequest.setChannelId(createChannel())
.setStartDate(instance.getTime())
.setEndDate(new Date())
.setCurrentPage(1);
liveListChannelSessionInfoResponse = new LiveChannelPlaybackServiceImpl().listChannelSessionInfo(
liveListChannelSessionInfoRequest);
Assert.assertNotNull(liveListChannelSessionInfoResponse);
if (liveListChannelSessionInfoResponse != null) {
//to do something ......
log.debug("测试查询频道直播场次信息成功{}", JSON.toJSONString(liveListChannelSessionInfoResponse));
}
} 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 Description
If the request is correct, it returns a
LiveListChannelSessionInfoResponseobject, 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.LivexxxRequest] 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| startDate | false | Date | Start date, format yyyy-MM-dd HH:mm:ss |
| endDate | false | Date | End date, format yyyy-MM-dd HH:mm:ss |
| currentPage | false | Integer | Page number, defaults to 1 [corresponds to the page field in the API documentation] |
| pageSize | false | Integer | Number of data items displayed per page, defaults to 20 |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| contents | Array | Channel live session information [see ChannelSessionInfo parameter description] |
| pageSize | Integer | Number of data items displayed per page, default is 20 items per page |
| currentPage | Integer | Current page [corresponds to the pageNumber field in the API documentation] |
| totalItems | Integer | Total number of records |
| totalPage | Integer | Total number of pages [corresponds to the totalPages field in the API documentation] |
ChannelSessionInfo Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| sessionId | String | Session ID |
| startTime | Date | Live broadcast start time |
| endTime | Date | Live broadcast end time |
7. Query Channel Playback Switch Status
Description
查询频道的回放开关状态
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/playback/get-enabled
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 testGetChannelPlayBackEnabledInfo() throws Exception, NoSuchAlgorithmException {
LiveChannelPlaybackEnabledInfoRequest liveChannelPlaybackEnabledInfoRequest =
new LiveChannelPlaybackEnabledInfoRequest();
String liveChannelPlaybackEnabledInfoResponse;
try {
liveChannelPlaybackEnabledInfoRequest.setChannelId(createChannel());
liveChannelPlaybackEnabledInfoResponse = new LiveChannelPlaybackServiceImpl().getChannelPlayBackEnabledInfo(
liveChannelPlaybackEnabledInfoRequest);
Assert.assertNotNull(liveChannelPlaybackEnabledInfoResponse);
if ("Y".equals(liveChannelPlaybackEnabledInfoResponse)) {
//to do something ......
log.debug("测试查询频道的回放开关状态成功{}", liveChannelPlaybackEnabledInfoResponse);
}
} 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 viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] 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 Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
Y for enabled, N for disabled
8. Query Recording File Information by Specified File ID
Description
查询指定文件ID的录制文件信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/record/get
Call Constraints
- The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testGetChannelVideoOnly() throws Exception, NoSuchAlgorithmException {
LiveChannelVideoOnlyRequest liveChannelVideoOnlyRequest = new LiveChannelVideoOnlyRequest();
LiveChannelVideoOnlyResponse liveChannelVideoOnlyResponse;
try {
String channelId = super.getAloneNewChannelId();
String fileId = listChannelFileIds(channelId).get(0);
liveChannelVideoOnlyRequest.setChannelId(channelId)
.setFileId(fileId);
liveChannelVideoOnlyResponse = new LiveChannelPlaybackServiceImpl().getChannelVideoOnly(
liveChannelVideoOnlyRequest);
Assert.assertNotNull(liveChannelVideoOnlyResponse);
if (liveChannelVideoOnlyResponse != null) {
//to do something ......
log.debug("测试查询指定文件ID的录制文件信息成功{}", JSON.toJSONString(liveChannelVideoOnlyResponse));
}
} 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
LiveChannelVideoOnlyResponseobject is returned, and the B-side processes the 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.LivexxxRequest] 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| fileId | true | String | File ID |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| bitrate | Integer | Bitrate |
| channelId | String | Channel ID |
| channelSessionId | String | Channel session ID |
| originSessionId | String | Original session ID |
| createdTime | Date | Creation time |
| duration | Integer | Duration |
| endTime | Date | End time |
| fileId | String | File ID |
| filename | String | File name |
| filesize | Long | File size |
| height | Integer | Height |
| liveType | String | Live type |
| m3u8 | String | m3u8 file URL |
| mp4 | String | MP4 URL |
| startTime | Date | Start time |
| userId | String | POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live (Development Settings) |
| width | Integer | Width |
9. Set Channel Playback Settings
Description
设置频道回放设置
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/playback/set-setting
Call Constraints
API calls are subject to rate limits. For details, see here. For common call exceptions, see here.
When the request parameter
typeissingle,origincan be set torecord. When set toplaybackorvod,videoIdmust also be specified.When the request parameter
typeislist,origincan be set toplaybackorvod.
Unit Test
@Test
public void testUpdateChannelPlaybackSetting() throws Exception, NoSuchAlgorithmException {
LiveChannelPlaybackSettingRequest liveChannelPlaybackSettingRequest;
Boolean liveChannelPlaybackSettingResponse;
try {
String channelId = super.createChannel();
//videoId可通过new LiveChannelPlaybackServiceImpl().listChannelVideoLibrary()获取
List<String> videoIds = listChannelVideoIds(channelId);
liveChannelPlaybackSettingRequest = new LiveChannelPlaybackSettingRequest();
liveChannelPlaybackSettingRequest.setChannelId(channelId)
.setPlaybackEnabled("Y")
.setType("single")
.setOrigin("playback")
.setVideoId(videoIds.get(0))
.setSectionEnabled("N")
.setChatPlaybackEnabled("N");
liveChannelPlaybackSettingResponse = new LiveChannelPlaybackServiceImpl().updateChannelPlaybackSetting(
liveChannelPlaybackSettingRequest);
Assert.assertNotNull(liveChannelPlaybackSettingResponse);
if (liveChannelPlaybackSettingResponse) {
//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 Boolean object is returned, and the B-side processes the 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.LivexxxRequest] 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 Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| playbackEnabled | false | String | Playback toggle, Y-Enable, N-Disable |
| type | false | String | Playback mode, single-Single playback, list-List playback |
| origin | false | String | Playback source, record-Temporary storage, playback-Playback list, vod-VOD list |
| videoId | false | String | Video ID for single playback |
| sectionEnabled | false | String | Chapter toggle, Y-Enable, N-Disable |
| chatPlaybackEnabled | false | String | Chat replay, Y-Enable, N-Disable |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain via registration on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain via registration on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates success, false indicates failure
10. Setting the Background Playback Switch
Description
设置后台回放开关
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelSetting/%s/setPlayBackEnabled
Call Constraints
- The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testUpdateChannelPlayBackEnabledSetting() throws Exception, NoSuchAlgorithmException {
LiveChannelPlaybackEnabledRequest liveChannelPlaybackEnabledRequest = new LiveChannelPlaybackEnabledRequest();
String liveChannelPlaybackEnabledResponse;
try {
liveChannelPlaybackEnabledRequest.setChannelId(createChannel())
.setPlayBackEnabled("Y");
liveChannelPlaybackEnabledResponse =
new LiveChannelPlaybackServiceImpl().updateChannelPlayBackEnabledSetting(
liveChannelPlaybackEnabledRequest);
Assert.assertNotNull(liveChannelPlaybackEnabledResponse);
if (liveChannelPlaybackEnabledResponse != null) {
//to do something ......
log.debug("测试设置后台回放开关成功{}", liveChannelPlaybackEnabledResponse);
}
} 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. For error details, refer toPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] 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 |
|---|---|---|---|
| userId | false | String | POLYV user ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
| playBackEnabled | true | String | The status of the playback switch (on/off). Values are Y/N. Required. |
| channelId | false | String | Channel ID. Optional. If not provided, the playback switch for all channel IDs of the user will be set to on/off. |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
Successfully returned channel number
11. Set Video Library List Sorting
Description
设置视频库列表排序
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/playback/sort
Call Constraints
Unit Testing
@Test
public void testSetChannelVideoSort() throws Exception, NoSuchAlgorithmException {
LiveChannelVideoSortRequest liveChannelVideoSortRequest = new LiveChannelVideoSortRequest();
Boolean liveChannelVideoSortResponse;
try {
List<String> videoIdList = listChannelVideoIds("1965681");//992d36fa40,f1574595e1
Collections.shuffle(videoIdList);
liveChannelVideoSortRequest.setChannelId("1965681")
.setVideoIds(videoIdList)
.setListType("playback");
liveChannelVideoSortResponse = new LiveChannelPlaybackServiceImpl().setChannelVideoSort(
liveChannelVideoSortRequest);
Assert.assertNotNull(liveChannelVideoSortResponse);
if (liveChannelVideoSortResponse) {
//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 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.LivexxxRequest] 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| videoIds | true | Array | List of complete playback video IDs, stored in the request body. The number of requested video IDs must match the number of playback list items, and cannot be fewer, missing, or more. |
| listType | false | String | playback - playback list, vod - video-on-demand list; |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates success, false indicates failure
12. Set the Default Video for the Video Library List
Description
设置视频库列表的默认视频
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channel/recordFile/%s/playback/set-Default
Call Constraints
- The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testSetChannelDefaultVideo() throws Exception, NoSuchAlgorithmException {
LiveChannelDefaultVideoRequest liveChannelDefaultVideoRequest = new LiveChannelDefaultVideoRequest();
Boolean liveChannelDefaultVideoResponse;
try {
final String channelId = super.createChannel();
liveChannelDefaultVideoRequest.setChannelId(channelId)
.setVideoId(super.listChannelVideoIds(channelId).get(0))
.setListType("playback");
liveChannelDefaultVideoResponse = new LiveChannelPlaybackServiceImpl().setChannelDefaultVideo(
liveChannelDefaultVideoRequest);
Assert.assertNotNull(liveChannelDefaultVideoResponse);
if (liveChannelDefaultVideoResponse) {
//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 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.LivexxxRequest] 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| videoId | true | String | ID generated by the live streaming system, obtainable from the response data of the playback list interface |
| listType | false | String | playback - playback list, vod - video-on-demand list; |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates success, false indicates failure
13. Delete Recorded Files from Live Broadcast Staging
Description
删除直播暂存中的录制文件
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channel/recordFile/%s/delete-record
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 testDeleteChannelVideo() throws Exception, NoSuchAlgorithmException {
LiveDeleteChannelVideoRequest liveDeleteChannelVideoRequest = new LiveDeleteChannelVideoRequest();
Boolean liveDeleteChannelVideoResponse;
try {
liveDeleteChannelVideoRequest.setChannelId("1951952")
.setStartTime(getDate(2020, 10, 16, 11, 12, 34));
liveDeleteChannelVideoResponse = new LiveChannelPlaybackServiceImpl().deleteChannelVideo(
liveDeleteChannelVideoRequest);
Assert.assertNotNull(liveDeleteChannelVideoResponse);
if (liveDeleteChannelVideoResponse) {
//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 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.LivexxxRequest] 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| sessionId | false | String | Session ID of the recorded video |
| startTime | false | Date | Start time of the recorded video, can be obtained from the Get Channel Recording Information API |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates successful deletion, false indicates deletion failure.
14. Delete a Video from the Video Library List
Description
删除视频库列表中的视频
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channel/recordFile/%s/playback/delete
Call Constraints
- The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testDeleteChannelPlaybackVideo() throws Exception, NoSuchAlgorithmException {
LiveDeleteChannelPlaybackVideoRequest liveDeleteChannelPlaybackVideoRequest =
new LiveDeleteChannelPlaybackVideoRequest();
Boolean liveDeleteChannelPlaybackVideoResponse;
try {
String channelId = super.createChannel();
String videoId = "07f5bbeb67";
liveDeleteChannelPlaybackVideoRequest.setChannelId(channelId)
.setVideoId(videoId)
.setListType("playback");
liveDeleteChannelPlaybackVideoResponse = new LiveChannelPlaybackServiceImpl().deleteChannelPlaybackVideo(
liveDeleteChannelPlaybackVideoRequest);
Assert.assertNotNull(liveDeleteChannelPlaybackVideoResponse);
if (liveDeleteChannelPlaybackVideoResponse) {
//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 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.LivexxxRequest] 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, 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| videoId | true | String | ID generated by the live streaming system, obtainable from the response data of the playback list API |
| listType | false | String | playback - playback list, vod - video-on-demand list; |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtainable by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtainable by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates successful deletion, false indicates failed deletion
15. Modify Playback Video Name
Description
修改回放视频名称
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/playback/update-title
Call Constraints
- The API call is subject to rate limits. For details, see here. For common call exceptions, see here.
Unit Testing
@Test
public void testUpdatePlaybackTitle() throws Exception, NoSuchAlgorithmException {
LiveUpdatePlaybackTitleRequest liveUpdatePlaybackTitleRequest = new LiveUpdatePlaybackTitleRequest();
Boolean liveUpdatePlaybackTitleResponse;
try {
String channelId = super.createChannel();
String videoId = "992d36fa40";
liveUpdatePlaybackTitleRequest.setChannelId(channelId)
.setVideoId(videoId)
.setTitle("修改标题后");
liveUpdatePlaybackTitleResponse = new LiveChannelPlaybackServiceImpl().updatePlaybackTitle(
liveUpdatePlaybackTitleRequest);
Assert.assertTrue(liveUpdatePlaybackTitleResponse);
if (liveUpdatePlaybackTitleResponse) {
//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 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. SeePloyvSdkException.getMessage()for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| videoId | true | String | Playback video ID |
| title | true | String | Playback video title |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates modification succeeded, false indicates modification failed.
16. Export Merged Recording File and Callback MP4 Download URL
Description
导出合并的录制文件并回调mp4下载地址
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/record/merge-mp4
Call Constraints
The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
This interface performs file merging as an asynchronous process.
The recording files merged through this interface must be processed within 8 hours.
Recording in three-panel mode will automatically undergo courseware remastering before merging into MP4.
The MP4 download URL is valid for 30 days. After that, it needs to be re-exported.
Unit Test
@Test
public void testMergeMp4Record() throws Exception, NoSuchAlgorithmException {
LiveMergeMp4RecordRequest liveMergeMp4RecordRequest = new LiveMergeMp4RecordRequest();
LiveMergeMp4RecordResponse liveMergeMp4RecordResponse;
try {
String channelId = super.createChannel();
liveMergeMp4RecordRequest.setChannelId(channelId)
.setStartTime(super.getDate(1603848613000l))
.setEndTime(super.getDate(1603854259000l))
.setCallbackUrl(null)
.setFileName("testMergeMp4");
liveMergeMp4RecordResponse = new LiveChannelPlaybackServiceImpl().mergeMp4Record(liveMergeMp4RecordRequest);
Assert.assertNotNull(liveMergeMp4RecordResponse);
if (liveMergeMp4RecordResponse != null) {
//to do something ......
log.debug("测试导出合并的录制文件并回调mp4下载地址成功,{}", JSON.toJSONString(liveMergeMp4RecordResponse));
}
} 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
LiveMergeMp4RecordResponseobject is returned, and the B-side processes the 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.LivexxxRequest] 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 Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| startTime | true | Date | Start time of the recording file. The maximum interval with endTime must not exceed 8 hours. |
| endTime | true | Date | End time of the recording file. The maximum interval with startTime must not exceed 8 hours. |
| callbackUrl | false | String | URL for callback on merge success or failure |
| fileName | false | String | File name after merging |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is invoked to set up multi-account calls). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() is invoked to set up multi-account calls). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| fileId | String | File ID |
| fileUrl | String | Returns the merged file URL if merged; returns an empty string if merging is in progress |
Callback Description
This interface processes requests asynchronously. If you need to obtain the merge result, you can submit the callbackUrl parameter when making the request. After the program successfully completes the merge, a callback notification will be sent to the callbackUrl.
| Parameter | Type | Description |
|---|---|---|
| status | String | Interface processing result, values: success, error |
| channelId | String | Channel ID, returned on success |
| fileId | String | Merged file ID, returned on success |
| fileIds | String | All file IDs before merging, returned on success |
| fileUrl | String | URL of the merged MP4, returned on success |
| fileName | String | Name of the merged file, returned on success |
17. Query Playback Settings for Multiple Channels
Description
查询多个频道回放设置和视频列表
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/playback/list
Call Constraints
- The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testGetPlaybackList() throws IOException, NoSuchAlgorithmException {
LiveGetPlaybackListRequest liveGetPlaybackListRequest = new LiveGetPlaybackListRequest();
List<LiveGetPlaybackListResponse> liveGetPlaybackListResponse;
try {
String channelId = super.createChannel();
liveGetPlaybackListRequest.setChannelIds(channelId);
liveGetPlaybackListResponse = new LiveChannelPlaybackServiceImpl().getPlaybackList(
liveGetPlaybackListRequest);
Assert.assertNotNull(liveGetPlaybackListResponse);
if (liveGetPlaybackListResponse != null) {
//to do something ......
log.debug("测试查询多个频道回放列表成功 {}", JSON.toJSONString(liveGetPlaybackListResponse));
}
} 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
LiveGetPlaybackListResponseobject, based on which the B-side processes business logic.If request parameter validation fails, a
PloyvSdkExceptionis thrown. SeePloyvSdkException.getMessage()for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, 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 Name | Required | Type | Description |
|---|---|---|---|
| channelIds | true | String | Channel IDs separated by English commas, e.g., 10000,100001. Maximum of 100. |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
The return object is List<LiveGetPlaybackListResponse>. The specific elements of LiveGetPlaybackListResponse are as follows:
| Parameter | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| playBackEnabled | String | Playback feature toggle: Y - Enabled, N - Disabled |
| origin | String | Playback source: record - Temporary storage, playback - Playback list, vod - VOD list |
| type | String | Playback mode: single - Single video playback, list - List playback |
| videoList | Array | Video list. Returns only one video when playback mode is single, returns the first 10 videos for list playback. Also returns the video list when playback is disabled. See PlaybackVideoList parameter description |
| globalSettingEnabled | String | Whether global settings are enabled: Y - Enabled, N - Disabled |
PlaybackVideoList Parameter Description
| Parameter | Type | Description |
|---|---|---|
| videoId | String | ID generated by the live streaming system (has a value when the replay source is from the replay list or on-demand list) |
| videoPoolId | String | On-demand video videoPoolId (has a value when the replay source is from the replay list or on-demand list) |
| fileId | String | Temporary file ID of the replay video before transfer (has a value when the replay source is from temporary storage) |
| duration | String | Video duration, format: HH:mm:ss |
| name | String | Video name |
18. Trimming Recorded Files
Description
裁剪直播录制视频文件,裁剪文件过程为异步处理过程
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/record/clip
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 testClipRecordFile() throws IOException, NoSuchAlgorithmException {
LiveClipRecordFileRequest liveClipRecordFileRequest = new LiveClipRecordFileRequest();
Boolean liveClipRecordFileResponse;
try {
liveClipRecordFileRequest.setChannelId("3948351");
liveClipRecordFileRequest.setFileId("c1a6650a221144b605b433fe6978f4b1");
liveClipRecordFileRequest.setDeleteTimeFrame("[{\"start\":1, \"end\":30},{\"start\":50, \"end\":60}]");
liveClipRecordFileResponse = new LiveChannelPlaybackServiceImpl().clipRecordFile(liveClipRecordFileRequest);
Assert.assertNotNull(liveClipRecordFileResponse);
if (liveClipRecordFileResponse != null) {
//to do something ......
log.debug("测试裁剪录制文件成功 {}", JSON.toJSONString(liveClipRecordFileResponse));
}
} 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.LivexxxRequest] 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| fileId | true | String | File ID [Can be obtained by querying channel recording video information] |
| deleteTimeFrame | true | String | Time range to be trimmed and removed. Input format requirements: (1) start and end values are in seconds, format: [{"start":xx, "end":xx},{"start":xx, "end":xx}] (2) Multiple ranges must be sorted in ascending order by time (3) Time ranges must not overlap (4) Maximum of 100 time ranges allowed [Example: To trim and remove the 1st to 14th second and the 25th to 30th second, the input string should be [{"start":1, "end":14},{"start":25, "end":30}] ] Error description: (1) There is a certain time error in the trimming range (2) Reason for error: The replay defaults to m3u8 format trimming. Since m3u8 video trimming is precise to each ts segment, the system determines which ts segments are included in the time range to be removed and trims them accordingly. For more precise trimming, please contact POLYV customer service to enable mp4 trimming |
| callbackUrl | false | String | URL for callback on trimming success or failure |
| autoConvert | false | String | Whether to automatically save the replay to on-demand, default is N. Y: Yes, N: No |
| fileName | false | String | File name after trimming |
| appId | false | String | POLYV user APP_ID. Required when calling with multiple accounts (i.e., after calling initMultiAccount() to set up multi-account calls). Obtain by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. Required when calling with multiple accounts (i.e., after calling initMultiAccount() to set up multi-account calls). Obtain by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
Crop Recording File Return Entity
19. Query Channel Playback Settings
Description
查询频道回放设置
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/playback/get-setting
Call Constraints
- The API call is subject to rate limits. For details, see here. For common call exceptions, see here.
Unit Testing
@Test
public void testGetPlaybackSetting() throws IOException, NoSuchAlgorithmException {
LiveGetPlaybackSettingRequest liveGetPlaybackSettingRequest = new LiveGetPlaybackSettingRequest();
LiveGetPlaybackSettingResponse liveGetPlaybackSettingResponse;
try {
String channelId = super.createChannel();
liveGetPlaybackSettingRequest.setChannelId(channelId);
liveGetPlaybackSettingResponse = new LiveChannelPlaybackServiceImpl().getPlaybackSetting(
liveGetPlaybackSettingRequest);
Assert.assertNotNull(liveGetPlaybackSettingResponse);
if (liveGetPlaybackSettingResponse != null) {
//to do something ......
log.debug("测试查询频道回放设置成功 {}", JSON.toJSONString(liveGetPlaybackSettingResponse));
}
} 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
LiveGetPlaybackSettingResponseobject, based on which the B-side processes business logic.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| type | String | Playback type: single (single video playback), list (list playback) |
| playbackEnabled | String | Playback toggle: Y (enabled), N (disabled) |
| origin | String | Playback video source: record (recorded file), playback (playback list), vod (VOD list) |
| videoId | String | Playback video ID |
| videoName | String | Playback video name |
| sectionEnabled | String | Playback settings, chapter toggle: Y (enabled), N (disabled) |
| globalSettingEnabled | String | Apply global settings: Y (yes), N (no) |
| chatPlaybackEnabled | String | Chat replay: Y (enabled), N (disabled) |
