channelOperate
1. Create Channel
Description
创建一个直播频道,返回直播频道相关的基础信息。
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/create
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 testCreateChannelV2() throws Exception, NoSuchAlgorithmException {
LiveChannelV2Request liveChannelRequest = new LiveChannelV2Request();
LiveChannelV2Response liveChannelResponse = null;
try {
liveChannelRequest.setName("gateway 从入门到精通")
.setNewScene(LiveConstant.NewSceneType.ALONE.getCode())
.setTemplate("alone")
.setCategoryId(391352)
.setSeminarAttendeePassword(super.getRandomString(6))
.setSeminarHostPassword(super.getRandomString(7))
.setEndTime(super.getDate(2034,11,11))
.setOnlyOneLiveEnabled("N");
liveChannelResponse = new LiveChannelOperateServiceImpl().createChannelV2(liveChannelRequest);
Assert.assertNotNull(liveChannelResponse);
if (liveChannelResponse != null) {
//to do something ......
log.debug("频道创建成功{}", JSON.toJSONString(liveChannelResponse));
log.debug("网页开播地址:https://live.polyv.net/web-start/login?channelId={}",
liveChannelResponse.getChannelId());
log.debug("网页观看地址:https://live.polyv.cn/watch/{} ", liveChannelResponse.getChannelId());
//TODO 此处创建完成后删除了频道,正式使用需删除该语句
super.deleteChannel(liveChannelResponse.getChannelId());
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 LiveChannelV2Response 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, 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 |
|---|---|---|---|
| name | true | String | Live broadcast name, maximum length 100 |
| newScene | true | String | Live broadcast scene (topclass - large class, double - dual-teacher class (requires activation), train - enterprise training, seminar - seminar, alone - event marketing) |
| template | true | String | Live broadcast template (ppt - three-screen (landscape), portrait_ppt - three-screen (portrait), alone - pure video (landscape), portrait_alone - pure video (portrait), topclass - pure video - fast (landscape), portrait_topclass - pure video - fast (portrait), seminar - seminar, guide (directing, requires activation)) When the live scene is topclass, this field supports ppt, portrait_ppt, alone, portrait_alone, topclass, portrait_topclass When the live scene is train, guide, or alone, this field supports ppt, portrait_ppt, alone, portrait_alone When the live scene is double, this field supports ppt, alone When the live scene is seminar, this field supports seminar |
| channelPasswd | false | String | Instructor login password, valid when the live scene is not a seminar, length 6-16 characters. If not provided, the system will randomly generate one. |
| seminarHostPassword | false | String | Seminar host password, only valid when the live scene is a seminar, length 6-16 characters. If not provided, the system will randomly generate one. The seminar host password and attendee password cannot be the same. |
| seminarAttendeePassword | false | String | Seminar attendee password, only valid when the live scene is a seminar, length 6-16 characters. If not provided, the system will randomly generate one. The seminar host password and attendee password cannot be the same. |
| pureRtcEnabled | false | String | Live broadcast delay: Y for no delay, N for normal delay |
| type | false | String | Relay type: normal (not enabled), transmit (initiate relay), receive (receive relay) (this feature requires activation) |
| doubleTeacherType | false | String | Online dual-teacher: transmit (large room), receive (small room) |
| cnAndEnLiveEnabled | false | String | Bilingual live broadcast switch: Y for on, N for off |
| splashImg | false | String | Splash page image URL. Images not hosted on Polyv domain need to be uploaded via Upload Image Resource |
| linkMicLimit | false | Integer | Maximum number of participants in co-streaming, up to 16. A value of 0 means co-streaming is disabled. If this field is empty, the account's default maximum co-streaming number will be used (can be modified by contacting business support). |
| categoryId | false | Integer | Category ID, can be obtained via the "Query Live Categories" API |
| startTime | false | Date | Start time, format: yyyy-MM-dd HH:mm:ss [Note: Only used for countdown display before the live broadcast, does not affect the instructor's start operation] |
| endTime | false | Date | End time, format: yyyy-MM-dd HH:mm:ss [Note: Only used for determining the live status display when not started, does not affect the instructor's start operation] |
| subAccount | false | String | Sub-account email. If filled, the channel will be created under this sub-account (the sub-account cannot be deleted or disabled). Currently cannot be retrieved via API. |
| onlyOneLiveEnabled | false | String | Channel can only start and end once (channels that have already ended cannot start a new live broadcast) Y: enabled, N: disabled, default is N |
| 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 (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 (Development Settings) |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| userId | String | POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings) |
| channelPasswd | String | Instructor login password. Not null when the live streaming scenario is not a seminar. Length: 6-16 characters. |
| seminarHostPassword | String | Seminar host password. Only not null when the live streaming scenario is a seminar. Length: 6-16 characters. |
| seminarAttendeePassword | String | Seminar attendee password. Only not null when the live streaming scenario is a seminar. Length: 6-16 characters. |
2. Batch Create Channels
Description
批量创建频道
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/create-batch
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 testCreateChannelListV2() throws IOException, NoSuchAlgorithmException {
LiveCreateChannelListV2Request liveCreateChannelListV2Request = new LiveCreateChannelListV2Request();
List<LiveCreateChannelListV2Response> liveCreateChannelListV2Response;
try {
List<LiveCreateChannelListV2Request.ChannelV2CreateBatch> channelV2CreateBatch = new ArrayList<>();
channelV2CreateBatch.add(LiveCreateChannelListV2Request.ChannelV2CreateBatch.builder()
.name("测试批量创建频道1(可删)")
.newScene(LiveConstant.NewSceneType.ALONE.getCode())
.template(LiveConstant.Template.ALONE.getCode())
.channelPasswd(super.getRandomString(8))
.pureRtcEnabled(LiveConstant.Flag.YES.getFlag())
.categoryId(391352)
.linkMicLimit(2)
.startTime(super.getDate(System.currentTimeMillis() + 600 * 1000))
.build());
channelV2CreateBatch.add(LiveCreateChannelListV2Request.ChannelV2CreateBatch.builder()
.name("测试批量创建频道2(可删)")
.newScene(LiveConstant.NewSceneType.SEMINAR.getCode())
.template(LiveConstant.Template.SEMINAR.getCode())
.seminarHostPassword(super.getRandomString(8))
.seminarAttendeePassword(super.getRandomString(8))
.categoryId(391352)
.subAccount("test-dev@qq.com")
.build());
liveCreateChannelListV2Request.setChannels(channelV2CreateBatch);
liveCreateChannelListV2Response = new LiveChannelOperateServiceImpl().createBatchV2(
liveCreateChannelListV2Request);
Assert.assertNotNull(liveCreateChannelListV2Response);
if (liveCreateChannelListV2Response != null) {
//to do something ......
log.debug("测试批量创建频道成功{}", JSON.toJSONString(liveCreateChannelListV2Response));
//TODO 此处创建完成后删除了频道,正式使用需删除该语句
liveCreateChannelListV2Response.stream()
.forEach(channel -> super.tryDeleteChannel(channel.getChannelId()));
}
} 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
LiveCreateChannelListV2Responseobject 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 |
|---|---|---|---|
| channels | true | Array | Batch channel creation request body See ChannelV2CreateBatch parameter description |
| 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) |
ChannelV2CreateBatch Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | true | String | Live stream name, maximum length 100 |
| newScene | true | String | Live stream scenario (topclass - Large class, double - Dual-teacher class (requires activation), train - Enterprise training, seminar - Seminar, alone - Event marketing) |
| template | true | String | Live stream template (ppt - Three-panel (landscape), portrait_ppt - Three-panel (portrait), alone - Pure video (landscape), portrait_alone - Pure video (portrait), topclass - Pure video - Express (landscape), portrait_topclass - Pure video - Express (portrait), seminar - Seminar) When the scenario is topclass, this field supports ppt, portrait_ppt, alone, portrait_alone, topclass, portrait_topclass When the scenario is train or alone, this field supports ppt, portrait_ppt, alone, portrait_alone When the scenario is double, this field supports ppt, alone When the scenario is seminar, this field supports seminar |
| channelPasswd | false | String | Instructor login password, valid when the scenario is not seminar, length 6-16 characters. If not provided, it will be randomly generated by the system. |
| seminarHostPassword | false | String | Seminar host password, valid only when the scenario is seminar, length 6-16 characters. If not provided, it will be randomly generated by the system. The host password and attendee password must be different. |
| seminarAttendeePassword | false | String | Seminar attendee password, valid only when the scenario is seminar, length 6-16 characters. If not provided, it will be randomly generated by the system. The host password and attendee password must be different. |
| pureRtcEnabled | false | String | Live stream latency: Y - No latency, N - Normal latency |
| type | false | String | Relay type: normal - Not enabled, transmit - Initiate relay, receive - Receive relay (requires activation). Some live stream scenarios do not support relay settings. Please refer to the API constraints for details. |
| doubleTeacherType | false | String | Online dual-teacher: transmit - Main room, receive - Small room |
| cnAndEnLiveEnabled | false | String | Bilingual live stream switch: Y - On, N - Off |
| splashImg | false | String | Splash page image URL. For images not hosted on Polyv domain, please call Upload Image Resource first. |
| linkMicLimit | false | Integer | Maximum number of participants in co-streaming, up to 16 |
| categoryId | false | Integer | Category ID, can be obtained via the "Query Live Stream Categories" API |
| startTime | false | Date | Start time |
| subAccount | false | String | Sub-account email. If filled, the channel will be created under this sub-account (the sub-account cannot be deleted or disabled). Currently, it cannot be retrieved via the API. |
Return Object Description
The return object is a List<LiveCreateChannelListV2Response>, with the specific element content of LiveCreateChannelListV2Response as follows:
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| userId | String | Verification information |
| scene | String | Live streaming scenario |
| channelPasswd | String | Instructor login password, used in non-seminar scenarios, length 6-16 characters |
| seminarHostPassword | String | Seminar host password, returned only when the live streaming scenario is a seminar, length 6-16 characters |
| seminarAttendeePassword | String | Seminar attendee password, returned only when the live streaming scenario is a seminar, length 6-16 characters |
3. Create and Initialize a Channel
Description
根据请求参数与默认模板创建频道
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/create-init
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 testCreateChannelInitV2() throws IOException, NoSuchAlgorithmException {
LiveChannelInitV2Request liveChannelInitV2Request = new LiveChannelInitV2Request();
LiveChannelInitV2Response liveChannelInitV2Response;
try {
//基础信息
LiveChannelInitV2Request.BasicSetting basicSetting = new LiveChannelInitV2Request.BasicSetting().setName(
"创建并初始化新版后台频道-验证码观看")
.setChannelPasswd(getRandomString(6))
.setNewScene(LiveConstant.NewSceneType.TOPCLASS.getCode())
.setTemplate(LiveConstant.Template.PPT.getCode())
.setCategoryId(391352)
.setDescription("这是一个描述")
.setLinkMicLimit(1)
.setSubAccount("test-dev@qq.com");
liveChannelInitV2Request.setBasicSetting(basicSetting);
//主要观看条件 验证码观看
LiveChannelInitV2Request.MasterAuthSetting masterAuthSetting =
new LiveChannelInitV2Request.MasterAuthSetting().setAuthType(
LiveConstant.AuthType.CODE.getDesc())
.setEnabled("Y")
.setAuthCode("123456")
.setQCodeTips("提示文案")
.setQCodeImg("https://live.polyv.net/static/images/live-header-logo.png");
liveChannelInitV2Request.setMasterAuthSetting(masterAuthSetting);
//回放设置
LiveChannelInitV2Request.PlaybackSetting playbackSetting = new LiveChannelInitV2Request.PlaybackSetting();
playbackSetting.setPlaybackEnabled("N");
liveChannelInitV2Request.setPlaybackSetting(playbackSetting);
//设置角色
LiveChannelInitV2Request.Roles assistantRole = new LiveChannelInitV2Request.Roles();
assistantRole.setNickName("孙助教").setActor("助教").setPasswd(getRandomString(6)).setRole("Assistant");
LiveChannelInitV2Request.Roles guestRole = new LiveChannelInitV2Request.Roles();
guestRole.setNickName("赵嘉宾").setActor("嘉宾").setPasswd(getRandomString(6)).setRole("Guest");
List<LiveChannelInitV2Request.Roles> roles = new ArrayList<>();
roles.add(assistantRole);
roles.add(guestRole);
liveChannelInitV2Request.setRoles(roles);
liveChannelInitV2Response = new LiveChannelOperateServiceImpl().createChannelInitV2(
liveChannelInitV2Request);
Assert.assertNotNull(liveChannelInitV2Response);
if (liveChannelInitV2Response != null) {
//to do something ......
log.debug("测试创建并初始化频道(新版后台)成功 {}", JSON.toJSONString(liveChannelInitV2Response));
//TODO 此处创建完成后删除了频道,正式使用需删除该语句
super.tryDeleteChannel(liveChannelInitV2Response.getChannelId());
}
} 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
LiveChannelInitV2Responseobject, 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.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 |
|---|---|---|---|
| basicSetting | true | BasicSetting | Basic channel information [See BasicSetting Parameter Description] |
| masterAuthSetting | false | MasterAuthSetting | Primary viewing condition. If this field is not passed, the default template will be used to set the value. [See MasterAuthSetting Parameter Description] |
| playbackSetting | false | PlaybackSetting | Playback settings. If this field is not passed, the default template will be used to set the value. [See PlaybackSetting Parameter Description] |
| roles | false | Array | Role settings, including instructor, teaching assistant, and guest. If this field is not passed, the default template will be used to set role information. If this field is passed but the instructor is not set, the default template will be used to set instructor information. If this field is passed but the teaching assistant and guest are not set, they will not be created. A maximum of 10 roles can be set. [See Roles Parameter Description] |
| 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). 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 calls). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
BasicSetting Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| name | true | String | Live broadcast name, maximum length 50 characters |
| newScene | true | String | Live broadcast scenario (topclass - large class, double - dual-teacher class (requires activation), train - enterprise training, seminar - seminar, alone - event marketing) |
| template | false | String | Live broadcast template (ppt - three-screen (landscape), portrait_ppt - three-screen (portrait), alone - pure video (landscape), portrait_alone - pure video (portrait), topclass - pure video - fast (landscape), portrait_topclass - pure video - fast (portrait), seminar - seminar). When the live scenario is topclass, this field supports ppt, portrait_ppt, alone, portrait_alone, topclass, portrait_topclass. When the live scenario is train or alone, this field supports ppt, portrait_ppt, alone, portrait_alone. When the live scenario is double, this field supports ppt, alone. When the live scenario is seminar, this field supports seminar. |
| channelPasswd | false | String | Instructor login password, valid when the live scenario is not a seminar, length 6-16 characters. If not provided, the system will randomly generate one. |
| seminarHostPassword | false | String | Seminar host password, valid only when the live scenario is a seminar, length 6-16 characters. If not provided, the system will randomly generate one. |
| seminarAttendeePassword | false | String | Seminar attendee password, valid only when the live scenario is a seminar, length 6-16 characters. If not provided, the system will randomly generate one. |
| categoryId | false | Integer | Category ID |
| startTime | false | Date | Live broadcast start time |
| pureRtcEnabled | false | String | No-delay live broadcast switch, Y: enabled, N: disabled |
| type | false | String | Channel type: transmit for rebroadcasting, receive for receiving rebroadcasts, normal for regular channels |
| doubleTeacherType | false | String | Online dual-teacher room type: transmit for large room, receive for small room |
| cnAndEnLiveEnabled | false | String | Chinese-English bilingual live broadcast switch: Y for enabled, N for disabled |
| linkMicLimit | false | Integer | Maximum number of participants in co-streaming, up to 16 people |
| description | false | String | Live broadcast introduction, maximum 1024 characters |
| logoImg | false | String | Live broadcast logo image |
| splashImg | false | String | Splash page image URL. Images not under the Polyv domain must first be uploaded via Upload Image Resource |
| coverImg | false | String | Player cover image, displayed when there is no live broadcast or replay |
| subAccount | false | String | Sub-account email. When filled, the channel will be created under this sub-account (the sub-account cannot be deleted or disabled). Currently, it cannot be retrieved via the API. |
| watchLangType | false | String | Watch page language (zh_CN: Chinese, en: English, ja: Japanese, ko: Korean, zh_TW: Traditional Chinese, follow_browser: Follow browser) |
| allowSwitchLangEnabled | false | String | Allow viewers to switch language switch Y: Allow N: Not allowed |
MasterAuthSetting Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| enabled | true | String | Whether to enable viewing conditions: Y for enabled, N for disabled |
| authType | false | String | Type of viewing condition: code (verification code), pay (paid), custom (custom authorization), external (external authorization), direct (independent authorization) |
| authCode | false | String | Required when authType is code. Viewing verification code, maximum length of 8 characters |
| codeAuthTips | false | String | Optional when authType is code. Welcome title, maximum length of 20 characters, default: "Welcome to this live stream" |
| qCodeTips | false | String | Optional when authType is code. Verification code prompt text, maximum length of 30 characters, default: "Scan QR code to get verification code" |
| qCodeImg | false | String | Optional when authType is code. QR code image URL |
| payAuthTips | true | String | Required when authType is pay. Welcome title, maximum length of 20 characters |
| price | true | Float | Required when authType is pay. Price, in yuan |
| watchEndTime | false | Date | Optional when authType is pay. Paid validity end date |
| validTimePeriod | false | Integer | Optional when authType is pay. Paid validity duration, in days. When both watchEndTime and validTimePeriod are empty, payment is valid indefinitely |
| customKey | true | String | Required when authType is custom. SecretKey, maximum length of 10 characters |
| customUri | true | String | Required when authType is custom. Custom URL |
| externalKey | true | String | Required when authType is external. SecretKey, maximum length of 10 characters |
| externalUri | true | String | Required when authType is external. Custom URL |
| externalRedirectUri | false | String | Optional when authType is external. Failure redirect URL |
| externalEntryText | false | String | Optional when authType is external. Entry text, default: "Login to watch" |
| directKey | true | String | Required when authType is direct. Independent authorization SecretKey, maximum length of 10 characters |
PlaybackSetting Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| playbackEnabled | false | String | Playback switch Y: Enabled N: Disabled |
| sectionEnabled | false | String | Playback settings, chapter switch Y: Enabled N: Disabled |
| type | false | String | Playback mode single: Single playback list: List playback |
| origin | false | String | Playback source record: Temporary storage playback: Playback list Note: When type is single, this value can only be record; when type is list, this value can only be playback or vod; |
Roles Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| role | true | String | Role type: Teacher, Assistant, Guest |
| nickName | false | String | Role nickname |
| actor | false | String | Role title |
| passwd | false | String | Role password, length 6-16 characters, must contain numbers and letters |
| avatar | false | String | URL of the role avatar image, must include the protocol |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| name | String | Channel name |
| userId | String | POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings) |
| channelPasswd | String | Lecturer login password, used in non-seminar scenarios, length 6-16 characters |
| seminarHostPassword | String | Seminar host password, returned only when the live streaming scenario is a seminar, length 6-16 characters |
| seminarAttendeePassword | String | Seminar attendee password, returned only when the live streaming scenario is a seminar, length 6-16 characters |
| publisher | String | Host name |
| description | String | Live streaming description |
| newScene | String | Live streaming scenario (topclass - large class, double - dual-teacher class (requires activation), train - corporate training, seminar - seminar, alone - event marketing) |
| template | String | Live streaming template (ppt - three-screen (landscape), portrait_ppt - three-screen (portrait), alone - pure video (landscape), portrait_alone - pure video (portrait), topclass - pure video - fast (landscape), portrait_topclass - pure video - fast (portrait), seminar - seminar). When the live streaming scenario is topclass, this field supports ppt, portrait_ppt, alone, portrait_alone, topclass, portrait_topclass. When the live streaming scenario is train or alone, this field supports ppt, portrait_ppt, alone, portrait_alone. When the live streaming scenario is double, this field supports ppt, alone. When the live streaming scenario is seminar, this field supports seminar. |
| linkMicLimit | Integer | Number of participants in co-streaming |
| pureRtcEnabled | String | Live streaming latency: Y - No latency, N - Normal latency |
| type | String | Channel type: transmit - relay broadcasting, receive - receiving relay, normal - regular channel |
| currentTimeMillis | Date | Current 13-digit millisecond timestamp |
4. Creating an MR Channel
Description
创建MR频道
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/mr/create
Call Constraints
- The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
Unit Testing
@Test
public void testCreateMrChannel() throws IOException, NoSuchAlgorithmException {
LiveCreateMrChannelRequest liveCreateMrChannelRequest = new LiveCreateMrChannelRequest();
LiveCreateMrChannelResponse liveCreateMrChannelResponse;
try {
liveCreateMrChannelRequest.setName("SDK测试创建MR频道")
.setStartTime(getXDay(new Date(), 10))
.setChannelPasswd(getRandomString(16));
liveCreateMrChannelResponse = new LiveChannelOperateServiceImpl().createMrChannel(
liveCreateMrChannelRequest);
Assert.assertNotNull(liveCreateMrChannelResponse);
if (liveCreateMrChannelResponse != null) {
//to do something ......
log.debug("测试创建MR频道成功 {}", JSON.toJSONString(liveCreateMrChannelResponse));
//TODO 此处创建完成后删除了频道,正式使用需删除该语句
super.tryDeleteChannel(liveCreateMrChannelResponse.getChannelId());
}
} 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
LiveCreateMrChannelResponseobject 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 |
|---|---|---|---|
| name | true | String | Live stream name, maximum length 100 |
| categoryId | false | Integer | Category ID |
| startTime | false | Date | Start time, 13-digit millisecond timestamp |
| channelPasswd | false | String | MR console password, length 6-16 characters; if not provided, it will be randomly generated by the system |
| assistantPasswd | false | String | MR live assistant role password, length 6-16 characters; if not provided, it will be randomly generated by the system |
| splashImg | false | String | Splash page image URL. For images not under the Polyv domain, you must first call Upload Image Resource to upload |
| subAccount | false | String | Sub-account email. Once submitted, the channel account's permissions in the backend will follow the sub-account's channel permissions |
| 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 |
|---|---|---|
| channelId | String | Channel ID |
| name | String | Channel name |
| userId | String | Live streaming account userId |
| channelPasswd | String | MR Live - Console login password |
| assistantAccount | String | MR Live - Live assistant account |
| assistantPasswd | String | MR Live - Live assistant login password |
5. Query Channel Information
Description
查询频道信息
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/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 testGetChannelInfo() throws Exception, NoSuchAlgorithmException {
LiveChannelInfoRequest liveChannelInfoRequest = new LiveChannelInfoRequest();
LiveChannelInfoResponse liveChannelInfoResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveChannelInfoRequest.setChannelId(channelId);
liveChannelInfoResponse = new LiveChannelOperateServiceImpl().getChannelInfo(liveChannelInfoRequest);
Assert.assertNotNull(liveChannelInfoResponse);
if (liveChannelInfoResponse != null) {
//to do something ......
log.debug("查询频道信息成功{}", JSON.toJSONString(liveChannelInfoResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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
LiveChannelInfoResponseobject is returned. 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 |
| 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 | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| userId | String | POLYV user ID, consistent with the POLYV official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings) |
| name | String | Live channel name |
| description | String | Live channel description |
| url | String | Live streaming push URL |
| stream | String | Live stream name |
| logoImage | String | Player logo |
| logoOpacity | Float | Logo opacity, value range [0-1], 1 means fully opaque |
| logoPosition | String | Logo position |
| logoHref | String | Logo click-through link |
| coverImage | String | Cover image displayed before playback |
| coverHref | String | Cover image click-through link |
| waitImage | String | Image displayed while waiting for stream push |
| waitHref | String | Click-through link for the image displayed while waiting for stream push |
| cutoffImage | String | Image displayed when stream is cut off |
| cutoffHref | String | Click-through link for the image displayed when stream is cut off |
| advertType | String | Ad type |
| advertDuration | String | Ad duration, in seconds |
| advertWidth | String | Ad area width |
| advertHeight | String | Ad area height |
| advertImage | String | Image ad |
| advertHref | String | Ad click-through link |
| advertFlvVid | String | Video ad ID |
| advertFlvUrl | String | Video ad link |
| playerColor | String | Player control bar color |
| autoPlay | Boolean | Auto-play |
| warmUpFlv | String | Initial warm-up video |
| passwdRestrict | Boolean | Viewing password restriction, requires entering a viewing password to play the stream |
| passwdEncrypted | String | Encrypted ciphertext of the viewing password |
| isOnlyAudio | String | Audio-only stream push |
| isLowLatency | String | Low latency |
| m3u8Url | String | Live stream pull (playback) m3u8 URL |
| m3u8Url1 | String | Live stream pull (playback) m3u8 URL 1 |
| m3u8Url2 | String | Live stream pull (playback) m3u8 URL 2 |
| m3u8Url3 | String | Live stream pull (playback) m3u8 URL 3 |
| currentTimeMillis | Long | Server-returned timestamp (milliseconds) |
| channelLogoImage | String | Channel icon |
| publisher | String | Host name |
| scene | String | Live streaming scene: alone (event live), topclass (large class), ppt (three-screen), seminar (seminar) |
| categoryId | String | Category ID |
| categoryName | String | Category name |
| channelPasswd | String | Channel password |
| channelViewerPasswd | String | Participant password |
| streamType | String | client (client push), pull (stream pull), thirdpull (third-party pull), disk (hard drive push), audio (audio live streaming) |
| pureRtcEnabled | String | No-delay live streaming switch, Y: enabled, N: disabled |
| type | String | transmit (initiate relay), normal (regular channel), receive (receive relay) |
| cnAndEnLiveEnabled | String | Bilingual live streaming room switch, Y: enabled, N: disabled |
| pushEnUrl | String | English push URL |
| closeDanmu | String | N: danmaku not disabled, Y: danmaku disabled |
| linkMicLimit | Integer | -1: use account's mic connection limit, 0-16: number of mic connections |
6. Query Basic Channel Information
Description
查询频道基本信息,观看页状态与新版后台一致
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/basic/get
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 testGetChannelDetail() throws IOException, NoSuchAlgorithmException {
LiveChannelBasicInfoV2Request liveChannelBasicInfoV2Request = new LiveChannelBasicInfoV2Request();
LiveChannelBasicInfoV2Response liveChannelBasicInfoV2Response;
try {
String channelId = super.createChannel();
liveChannelBasicInfoV2Request.setChannelId(channelId);
liveChannelBasicInfoV2Response = new LiveChannelOperateServiceImpl().getChannelDetail(
liveChannelBasicInfoV2Request);
Assert.assertNotNull(liveChannelBasicInfoV2Response);
if (liveChannelBasicInfoV2Response != null) {
//to do something ......
log.debug("测试查询频道信息成功 {}", JSON.toJSONString(liveChannelBasicInfoV2Response));
}
} 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
LiveChannelBasicInfoV2Responseobject 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 |
| 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 | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| name | String | Channel name |
| scene | String | Live streaming scenario: alone (event shooting); ppt (three-screen split); topclass (large class); seminar (seminar) |
| newScene | String | New backend live streaming scenario. If undefined, use the value of scene. undefined: Undefined topclass: Large class double: Dual-teacher class (requires permission) train: Enterprise training seminar: Seminar alone: Event marketing |
| template | String | New backend live streaming template. If it is a legacy channel, this field is undefined. undefined: Undefined ppt: Document + video alone: Video only (professional) topclass: Video only (fast) seminar: Seminar portrait_ppt: Document + video (portrait) portrait_alone: Video (portrait) |
| channelPasswd | String | Channel password |
| publisher | String | Host name |
| startTime | Date | Live streaming start time; null when closed |
| endTime | Date | Live streaming end time |
| pageView | Integer | Cumulative page views |
| likes | Integer | Number of likes on the viewing page |
| coverImg | String | Channel icon URL |
| splashImg | String | Splash page image URL |
| splashEnabled | String | Splash page toggle (values: Y/N) |
| desc | String | Live streaming description |
| consultingMenuEnabled | String | Consultation/Question toggle (values: Y/N) |
| maxViewerRestrict | String | Toggle to limit maximum online viewers (values: Y/N) |
| maxViewer | Integer | Maximum number of online viewers |
| watchStatus | String | Viewing page status: live (live streaming), playback (playback), end (ended), waiting (waiting), unStart (not started) |
| watchStatusText | String | Viewing page status description |
| userCategory | UserCategory | Information about the category the channel belongs to See UserCategory parameter description |
| authSettings | Array | List of live streaming viewing conditions See AuthSetting parameter description |
| linkMicLimit | Integer | Channel's limit on the number of people in a co-stream |
| createdAccountId | String | Creator's account ID; returns the main account's userId when created by the main account |
| createdAccountEmail | String | Creator's account email |
| createdTime | Date | Creation time |
| clientAloneTemplateBackgroundUrl | String | Client template background image URL |
| liveCdnBackgroundUrl | String | Video stream mixing background image URL |
| labelData | Array | Array of label IDs |
UserCategory Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| categoryId | Integer | Category ID |
| categoryName | String | Category Name |
| userId | String | POLYV User ID, consistent with the one on the Polyv official website. To obtain it: Official Website -> Login -> Live Streaming (Development Settings) |
| rank | Integer | Category sort order value |
AuthSetting Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| userId | String | POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings) |
| rank | Integer | Used to implement two viewing conditions for one channel, value is 1 or 2 (1 for primary condition, 2 for secondary condition) |
| globalSettingEnabled | String | Whether to enable global settings (Y/N) |
| enabled | String | Whether to enable viewing conditions (Y/N) |
| authType | String | Viewing condition type (1. No restriction none 2. Verification code code 3. Paid viewing pay 4. Whitelist viewing phone 5. Registration viewing info 6. Share viewing wxshare 7. Custom authorization custom 8. External authorization external) |
| authTips | String | Whitelist viewing prompt message |
| payAuthTips | String | Paid viewing prompt message |
| authCode | String | Verification code for the verification code viewing method |
| qCodeTips | String | QR code prompt for the verification code viewing method [corresponds to the qcodeTips field in the API documentation] |
| qCodeImg | String | QR code image for the verification code viewing method [corresponds to the qcodeImg field in the API documentation] |
| price | Float | Price for paid viewing |
| watchEndTime | Date | Paid viewing expiration time; null means one-time payment, valid forever |
| validTimePeriod | Integer | Paid viewing duration limit (in days) |
| customKey | String | Key for custom authorization viewing |
| customUri | String | Interface address for custom authorization viewing |
| externalKey | String | Key for external authorization viewing |
| externalUri | String | Interface address for external authorization viewing |
| externalRedirectUri | String | Redirect URL for external authorization viewing when users directly access the viewing page |
| directKey | String | Independent authorization key |
| trialWatchEnabled | String | Trial watch toggle, Y: enable trial, N: disable trial |
| trialWatchTime | Integer | Trial watch duration, in minutes |
| trialWatchEndTime | Date | Trial watch expiration date; null means valid indefinitely for the channel |
| whiteListInputTips | String | Whitelist input prompt |
| whiteListEntryText | String | Whitelist entry text |
| infoDesc | String | Registration viewing description field |
| customTeacherId | String | Custom instructor ID |
7. Query Authorization and Co-hosting Token
Description
查询授权和连麦的token
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/common/get-chat-token
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 testGetChannelAuthToken() throws Exception, NoSuchAlgorithmException {
LiveChannelAuthTokenRequest liveChannelAuthTokenRequest = new LiveChannelAuthTokenRequest();
LiveChannelAuthTokenResponse liveChannelAuthTokenResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveChannelAuthTokenRequest.setUserId(getRandomString(32))
.setChannelId(channelId)
.setRole(LiveConstant.Role.ADMIN.getDesc())
.setOrigin(null);
liveChannelAuthTokenResponse = new LiveChannelOperateServiceImpl().getChannelAuthToken(
liveChannelAuthTokenRequest);
Assert.assertNotNull(liveChannelAuthTokenResponse);
if (liveChannelAuthTokenResponse != null) {
//to do something ......
log.debug("查询授权和连麦的token成功{}", JSON.toJSONString(liveChannelAuthTokenResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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, a
LiveChannelAuthTokenResponseobject 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 |
|---|---|---|---|
| userId | true | String | C-end viewer ID |
| channelId | true | String | Channel ID |
| role | true | String | Role, values include: teacher, admin, guest, assistant, viewer, etc. |
| origin | false | String | Viewing source, can be web, client, app, etc. |
| 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 |
|---|---|---|
| token | String | Token value required for the link interface, valid for 6 hours |
| mediaChannelKey | String | Key required for co-hosting |
8. Modify Channel Settings
Description
修改频道的相关设置
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/basic/update
Call Constraints
Unit Testing
@Test
public void testUpdateChannelSetting() throws Exception, NoSuchAlgorithmException {
LiveChannelSettingRequest liveChannelSettingRequest = new LiveChannelSettingRequest();
Boolean liveChannelSettingResponse;
try {
//准备测试数据
String channelId = getAloneChannelId();
LiveChannelSettingRequest.BasicSetting basicSetting = new LiveChannelSettingRequest.BasicSetting().setName(
"Junit测试(勿删)888")
.setChannelPasswd(getRandomString(7))
.setCategoryId(340019)
.setMaxViewer(0)
.setPageView(1000)
.setLikes(2000)
.setCoverImg("https://www.polyv.net/")
.setStartTime(0l)
.setDesc("这是一个描述")
.setPublisher("sadboy主讲")
.setLinkMicLimit(-1)
.setReceiveChannelIds(null);
LiveChannelSettingRequest.AuthSetting authSetting = new LiveChannelSettingRequest.AuthSetting().setAuthType(
LiveConstant.AuthType.CODE.getDesc())
.setRank(1)
.setEnabled("Y")
.setAuthCode("123456")
.setQcodeTips("提示文案")
.setQcodeImg("https://live.polyv.net/static/images/live-header-logo.png");
List<LiveChannelSettingRequest.AuthSetting> authSettings =
new ArrayList<LiveChannelSettingRequest.AuthSetting>();
authSettings.add(authSetting);
liveChannelSettingRequest.setChannelId(channelId)
.setBasicSetting(basicSetting)
.setAuthSettings(authSettings);
liveChannelSettingResponse = new LiveChannelOperateServiceImpl().updateChannelSetting(
liveChannelSettingRequest);
Assert.assertTrue(liveChannelSettingResponse);
if (liveChannelSettingResponse) {
//to do something ......
log.debug("测试修改频道的相关设置成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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, 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 | The channel ID for which channel details need to be set, e.g., 1938028 |
| basicSetting | false | BasicSetting | Basic settings See BasicSetting parameter description |
| authSettings | false | Array | Viewing condition settings See AuthSetting parameter description |
| 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) |
BasicSetting Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | false | String | Channel name |
| channelPasswd | false | String | Channel password, max 16 characters, must contain both letters and numbers |
| publisher | false | String | Host name |
| startTime | false | Long | Live stream start time, 13-digit timestamp; set to 0 to hide the start time display |
| pageView | false | Integer | Cumulative view count |
| likes | false | Integer | Number of likes |
| coverImg | false | String | Cover image URL |
| splashImg | false | String | Splash page image URL; images not under the Polyv domain must be uploaded via Upload Image Resource first |
| splashEnabled | false | String | Splash page toggle (Y, N) |
| desc | false | String | Live stream description |
| consultingMenuEnabled | false | String | Consultation/Question toggle (Y, N) |
| maxViewerRestrict | false | String | Whether to limit the maximum number of viewers (Y, N) |
| maxViewer | false | Integer | Maximum concurrent viewers |
| categoryId | false | Integer | Category ID of the channel (obtainable via the "Get Live Categories" API) |
| linkMicLimit | false | Integer | -1 <= number of co-hosts <= account's co-host limit; -1: use account's co-host limit, max 16 people |
| operation | false | String | Whether to add or remove relay association; Y: add association, N: remove association (Note: only effective when channel relay is enabled) (Y, N) |
| receiveChannelIds | false | String | Channel IDs to receive relay, separated by commas (Note: only effective when channel relay is enabled) |
| closeBarrage | false | String | Whether to disable the barrage feature; N: do not disable, Y: disable; [Corresponds to the closeDanmu field in the API documentation] |
| showBarrageInfoEnabled | false | String | Whether to display barrage info by default; Y: show, N: hide; [Corresponds to the showDanmuInfoEnabled field in the API documentation] |
| pureRtcEnabled | false | String | Whether to enable low-latency live streaming; leave empty to not modify the field, cannot be modified during a live stream; Y: yes, N: no |
| customTeacherId | false | String | Custom instructor ID, up to 32 ASCII visible characters |
| labelData | false | Array | Array of label IDs; pass null to not modify |
AuthSetting Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| rank | true | Integer | General parameter: 1 for primary viewing condition, 2 for secondary viewing condition |
| enabled | true | String | General parameter: Whether enabled, Y for enabled, N for disabled |
| authType | false | String | General parameter: Pay to view - pay, verification code to view - code, whitelist to view - phone, registration to view - info, custom authorization to view - custom, external authorization - external, direct authorization - direct |
| subAuthType | false | String | Corresponding value when authType is none, public - public viewing, wx - WeChat authorization |
| wxAuthExpireValue | false | String | When subAuthType is wx, the corresponding WeChat authorization validity period, e.g., 3d means 3 days, 3h means 3 hours |
| payAuthTips | false | String | Pay to view parameter: Welcome title |
| price | false | Float | Pay to view parameter: Price, in yuan |
| watchEndTime | false | Date | Pay to view parameter: Payment validity end date. When both watchEndTime and validTimePeriod are empty, payment is valid permanently |
| validTimePeriod | false | Integer | Pay to view parameter: Payment validity duration, in days. When both watchEndTime and validTimePeriod are empty, payment is valid permanently |
| authCode | false | String | Verification code to view parameter: Verification code |
| qcodeTips | false | String | Verification code to view parameter: Prompt text |
| qcodeImg | false | String | Verification code to view parameter: Official account QR code URL |
| authTips | false | String | When authType is phone, set parameter, optional. Prompt text |
| whiteListEntryText | false | String | When authType is phone, set parameter, optional. Whitelist entry text |
| whiteListInputTips | false | String | When authType is phone, set parameter, optional. Whitelist input prompt |
| infoFields | false | Array | Registration to view parameter, maximum of 5 [See InfoField parameter description] |
| infoAuthTips | false | String | When authType is info, set parameter, optional. Welcome title |
| infoDesc | false | String | When authType is info, set parameter, optional. Prompt information |
| infoEntryText | false | String | When authType is info, set parameter, optional. Entry text |
| externalKey | false | String | External authorization parameter: SecretKey |
| externalUri | false | String | External authorization parameter: Custom URL |
| externalRedirectUri | false | String | External authorization parameter: Redirect URL |
| externalEntryText | false | String | External authorization viewing, entry text |
| externalButtonEnabled | false | String | External authorization viewing, login button. Y for enabled, N for disabled. When enabled, the guide page will display a login button when users access the link |
| customKey | false | String | Custom authorization parameter: SecretKey |
| customUri | false | String | Custom authorization parameter: Custom URL |
| directKey | false | String | Direct authorization parameter: Direct authorization SecretKey |
| codeAuthTips | false | String | Password viewing condition prompt information |
| codeEntryText | false | String | Password viewing entry text |
| payEntryText | false | String | Pay entry text |
| expectedArrivalEnabled | false | String | Whitelist viewing attendance list switch, Y - on, N - off, default is N |
| onceWhitelistEnabled | false | String | Whitelist viewing does not allow repeated use, default is N, Y: yes, N: no |
| privacyStatus | false | String | Whether to enable privacy statement, Y - on, N - off, default is N |
| privacyContent | false | String | Privacy statement content |
| inviteWatchAuditEnabled | false | String | Invite viewing audit switch, Y - on, N - off, default is N |
InfoField Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | false | String | Registration info name, up to 8 characters |
| type | true | String | Registration type: name-name, text-text, mobile phone number-mobile, number-number, dropdown option-option. This field is required when registering for viewing |
| options | false | String | For dropdown options, the option values separated by commas. Maximum of 8 options; each option up to 8 characters |
| placeholder | false | String | Text input hint, up to 8 characters |
| sms | false | String | SMS verification toggle: Y to enable, N to disable |
Return Object Description
true indicates success, false indicates failure
9. Modify Channel Settings
Description
修改频道设置
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/update
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 testUpdateChannel() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelRequest liveUpdateChannelRequest = new LiveUpdateChannelRequest();
Boolean liveUpdateChannelResponse;
try {
String channelId = super.createChannel();
liveUpdateChannelRequest.setChannelId(channelId)
.setPassword(getRandomString(8))
.setPublisher("主持人sadboy");
liveUpdateChannelResponse = new LiveChannelOperateServiceImpl().updateChannel(liveUpdateChannelRequest);
Assert.assertTrue(liveUpdateChannelResponse);
if (liveUpdateChannelResponse) {
//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. 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 |
| name | false | String | Live stream name, maximum length 100 |
| password | false | String | Password, length 6-16 characters, must contain both letters and numbers |
| seminarHostPassword | false | String | Host password, valid only for seminar channel scenarios, length 6-16 characters, must contain both letters and numbers |
| seminarAttendeePassword | false | String | Attendee password, valid only for seminar channel scenarios, length 6-16 characters, must contain both letters and numbers |
| publisher | false | String | Host, maximum length 100 |
| template | false | String | Live viewing template: Three-split landscape: ppt; Three-split portrait: portrait_ppt; Video-only landscape: alone; Video-only portrait: portrait_alone; Video-only fast landscape: topclass; Video-only fast portrait: portrait_topclass. Not modifiable for legacy backend channels (undefined newScene) or seminar scenarios. For three-split scenes (scene: ppt), modifiable values: ppt, portrait_ppt. For video-only scenes (scene: alone), modifiable values: alone, portrait_alone. For large class scenes (scene: topclass), modifiable values: topclass, portrait_topclass |
| pureRtcEnabled | false | String | Low-latency live stream toggle: Y: Enable, N: Disable |
| linkMicLimit | false | Integer | Number of participants in co-streaming, range: 0-16 |
| maxViewer | false | Integer | Maximum concurrent online viewers |
| startTime | false | Date | Live stream start time, must be later than current time |
| endTime | false | Date | Live stream end time, must be later than start time |
| splashImg | false | String | Splash page image URL. Images not under a Polyv domain must be uploaded via Upload Image Resource |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is invoked). Obtain by registering on the Polyv official website: Website -> Login -> Live (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is invoked). Obtain by registering on the Polyv official website: Website -> Login -> Live (Development Settings) |
Return Object Description
Modify channel settings return entity
10. Setting Channel Details
Description
设置频道详情
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/detail/update
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 testUpdateChannelDetail() throws Exception, NoSuchAlgorithmException {
LiveChannelDetailRequest liveChannelDetailRequest = new LiveChannelDetailRequest();
Boolean liveChannelDetailResponse;
try {
//准备测试数据
String channelId = super.createChannel();
String newPassword = getRandomString(16);
liveChannelDetailRequest.setChannelId(channelId).setField("channelPasswd").setValue(newPassword);
liveChannelDetailResponse = new LiveChannelOperateServiceImpl().updateChannelDetail(
liveChannelDetailRequest);
Assert.assertNotNull(liveChannelDetailResponse);
if (liveChannelDetailResponse) {
//to do something ......
log.debug("频道{}修改密码为{}成功", channelId, newPassword);
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 | The channel ID for which to set channel details, e.g., 1938028 |
| field | true | String | The field name to update: channelPasswd - channel password; maxViewer - maximum concurrent viewers |
| value | false | String | The field value to update. It is optional only when setting unlimited maximum viewers; otherwise, it is required. When field is channelPasswd, value must be 1-16 characters long, required, and must contain both English letters and numbers. When field is maxViewer, value ranges from 0 to 2147483647, where 0 or not passing the value means unlimited concurrent viewers, and it is optional |
| 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: 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: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates modification succeeded, false indicates modification failed
11. Set Channel Password
Description
设置频道密码
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/passwdSetting
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 testUpdateChannelPassword() throws Exception, NoSuchAlgorithmException {
LiveChannelPasswordSettingRequest liveChannelPasswordSettingRequest = new LiveChannelPasswordSettingRequest();
Boolean liveChannelPasswordSettingResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveChannelPasswordSettingRequest.setChannelId(channelId).setPasswd(getRandomString(6));
liveChannelPasswordSettingResponse = new LiveChannelOperateServiceImpl().updateChannelPassword(
liveChannelPasswordSettingRequest);
Assert.assertNotNull(liveChannelPasswordSettingResponse);
if (liveChannelPasswordSettingResponse) {
//to do something ......
log.debug("设置频道密码成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 |
|---|---|---|---|
| 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 | false | String | Channel ID. Note: If this parameter is empty, the modification will apply to all channels of the user. |
| passwd | true | String | The password to be modified. Must contain both letters and numbers. |
| 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
true indicates the password was set successfully, false indicates the setting failed.
12. Set Channel Single Sign-On Token
Description
设置频道单点登录token
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/set-token
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 testCreateChannelToken() throws Exception, NoSuchAlgorithmException {
LiveCreateChannelTokenRequest liveCreateChannelTokenRequest = new LiveCreateChannelTokenRequest();
Boolean liveCreateChannelTokenResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveCreateChannelTokenRequest.setChannelId(channelId).setToken(LiveSignUtil.generateUUID());
liveCreateChannelTokenResponse = new LiveChannelOperateServiceImpl().createChannelToken(
liveCreateChannelTokenRequest);
Assert.assertNotNull(liveCreateChannelTokenResponse);
if (liveCreateChannelTokenResponse) {
//to do something ......
log.debug("设置频道单点登录token成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 |
| token | true | String | Unique string |
| 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: 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: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates the token was set successfully, false indicates the setting failed.
13. Delete Live Channel
Description
删除直播频道
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/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 testDeleteChannel() throws Exception, NoSuchAlgorithmException {
LiveDeleteChannelRequest liveDeleteChannelRequest = new LiveDeleteChannelRequest();
Boolean liveDeleteChannelResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveDeleteChannelRequest.setChannelId(channelId);
liveDeleteChannelResponse = new LiveChannelOperateServiceImpl().deleteChannel(liveDeleteChannelRequest);
Assert.assertNotNull(liveDeleteChannelResponse);
if (liveDeleteChannelResponse) {
//to do something ......
log.debug("删除直播频道成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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, 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 | 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: 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
true indicates successful deletion, false indicates deletion failure.
14. Batch Delete Channels
Description
批量删除频道
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/basic/batch-delete
Call Constraints
- The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
Unit Testing
@Test
public void testDeleteChannelList() throws Exception, NoSuchAlgorithmException {
LiveDeleteChannelListRequest liveDeleteChannelListRequest = new LiveDeleteChannelListRequest();
Boolean liveDeleteChannelListResponse;
try {
//准备测试数据
String[] channelIds = new String[]{super.createChannel(), super.createChannel(), super.createChannel()};
liveDeleteChannelListRequest.setChannelIds(channelIds);
liveDeleteChannelListResponse = new LiveChannelOperateServiceImpl().deleteChannelList(
liveDeleteChannelListRequest);
Assert.assertNotNull(liveDeleteChannelListResponse);
if (liveDeleteChannelListResponse) {
//to do something ......
log.debug("批量删除频道成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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. 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 Name | Required | Type | Description |
|---|---|---|---|
| channelIds | true | String[] | List of channel IDs, up to 100 channels can be deleted at a time, must be placed in the request body |
| 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
true indicates a successful batch deletion, false indicates a failed batch deletion, and there is no partial success.
15. Create Role
Description
创建频道的助教或嘉宾角色
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/account/create
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 testCreateAccount() throws Exception {
LiveCreateAccountRequest liveCreateAccountRequest = new LiveCreateAccountRequest();
LiveCreateAccountResponse liveCreateAccountResponse;
try {
String channelId = super.createChannel();
liveCreateAccountRequest.setChannelId(channelId)
.setRole("Assistant")
.setActor("助教boy")
.setNickName("王助教")
.setPasswd(super.getRandomString(6))
.setPurviewList(Arrays.asList(new LiveCreateAccountRequest.Purview().setCode(
LiveConstant.RolePurview.CHAT_LIST_ENABLED.getCode())
.setEnabled(LiveConstant.Flag.YES.getFlag())));
liveCreateAccountResponse = new LiveChannelOperateServiceImpl().createAccount(liveCreateAccountRequest);
Assert.assertNotNull(liveCreateAccountResponse);
if (liveCreateAccountResponse != null) {
//to do something ......
log.debug("测试创建角色成功 {}", JSON.toJSONString(liveCreateAccountResponse));
//TODO 此处创建完成后删除了角色,正式使用需删除该语句
super.deleteSonChannel(liveCreateAccountResponse.getAccount());
}
} 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
LiveCreateAccountResponseobject 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.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 |
| role | true | String | Role: Assistant or Guest |
| actor | false | String | Title; defaults to "Assistant" for assistants. Title length must be between 1 and 10 characters. |
| nickName | false | String | Nickname; a random nickname is generated by default. Nickname length must be between 1 and 15 characters. |
| avatar | false | String | Avatar; defaults to the initial avatar (JPG, PNG format images). Must include http:// or https://. |
| passwd | false | String | Role password; a random password is generated by default. Password length must be between 6 and 16 characters. |
| purviewList | false | Array | Permissions [see Purview Parameter Description for details] |
| 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). |
Purview Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| code | true | String | Permission chatListEnabled: Online list (assistant only) pageTurnEnabled: Page turning (assistant only, and can only be set for one assistant) monitorEnabled: Monitoring (assistant only, and can only be set for one assistant) chatAuditEnabled: Chat audit (assistant only) |
| enabled | true | String | Switch Y: On N: Off |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| account | String | Teaching assistant/guest account |
| userId | String | User ID |
| channelId | String | Channel ID |
| passwd | String | Role password |
| nickname | String | Role name |
| stream | String | Role stream name, invalid when used alone |
| status | String | Role status Y: Enabled N: Disabled |
| createdTime | Date | Role creation time, 13-digit millisecond timestamp |
| lastModified | Date | Last modification time of the role, 13-digit millisecond timestamp |
| sort | Integer | Channel role sequence number |
| avatar | String | Role avatar |
| actor | String | Role title |
| role | String | Role Assistant: Teaching assistant Guest: Guest |
| monitorEnabled | String | Monitoring permission Y: Enabled N: Disabled |
| pageTurnEnabled | String | Page turning permission Y: Enabled N: Disabled |
| chatListEnabled | String | Online list permission Y: Enabled N: Disabled |
16. Query Role
Description
查询角色
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelAccount/%s/account
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 testGetSonChannelInfo() throws Exception, NoSuchAlgorithmException {
LiveSonChannelInfoRequest liveSonChannelInfoRequest = new LiveSonChannelInfoRequest();
LiveSonChannelInfoResponse liveSonChannelInfoResponse;
try {
//准备测试数据
String channelId = super.createChannel();
String sonChannelId = createSonChannel(channelId);
liveSonChannelInfoRequest.setAccount(sonChannelId).setChannelId(channelId);
liveSonChannelInfoResponse = new LiveChannelOperateServiceImpl().getSonChannelInfo(
liveSonChannelInfoRequest);
Assert.assertNotNull(liveSonChannelInfoResponse);
if (liveSonChannelInfoResponse != null) {
//to do something ......
log.debug("测试查询角色信息成功{}", JSON.toJSONString(liveSonChannelInfoResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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
LiveSonChannelInfoResponseobject 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 |
| account | true | String | Assistant/Guest account |
| 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: 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: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| account | String | Assistant/Guest account |
| userId | String | POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings) |
| channelId | String | Channel ID |
| passwd | String | Role password |
| nickname | String | Role name |
| stream | String | Role stream name (invalid when used alone) |
| status | String | Role status |
| createdTime | Date | Role creation time |
| lastModified | Date | Last modification time of the role |
| sort | Integer | Sequence number of the role in the channel |
| avatar | String | Role avatar |
| pageTurnEnabled | String | Assistant page turning permission (only one role can have this) |
| notifyEnabled | String | Permission to publish announcements (Y/N) |
| checkinEnabled | String | Permission to enable check-in (Y/N) |
| voteEnabled | String | Permission to initiate voting (Y/N) |
| role | String | Role Assistant: Assistant Guest: Guest |
| chatListEnabled | String | Switch for displaying the online list on the assistant page: Y: Enable, N: Disable |
| chatAuditEnabled | String | Assistant chat audit: Y: Enable, N: Disable |
| monitorEnabled | String | Assistant monitoring switch: Y: Enable, N: Disable |
| roundTourEnabled | String | Assistant round-robin switch: Y: Enable, N: Disable |
| watchLockEnabled | String | Switch for locking the live streaming room: Y: Enable, N: Disable |
| pushUrl | String | Sub-channel push URL (for sub-channel push, please refer to the backend director console) |
17. Query All Role Information Under a Channel ID
Description
查询频道号下所有角色信息
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelAccount/%s/accounts
Call Constraints
- The API call is subject to frequency limits. Click here for details. For common call exceptions, click here for details.
Unit Testing
@Test
public void testGetSonChannelInfoList() throws Exception, NoSuchAlgorithmException {
LiveSonChannelInfoListRequest liveSonChannelInfoListRequest = new LiveSonChannelInfoListRequest();
LiveSonChannelInfoListResponse liveSonChannelInfoResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveSonChannelInfoListRequest.setChannelId(channelId);
liveSonChannelInfoResponse = new LiveChannelOperateServiceImpl().getSonChannelInfoList(
liveSonChannelInfoListRequest);
Assert.assertNotNull(liveSonChannelInfoResponse);
if (liveSonChannelInfoResponse != null) {
//to do something ......
log.debug("查询频道号下所有角色信息成功{}", JSON.toJSONString(liveSonChannelInfoResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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
LiveSonChannelInfoListResponseobject, 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 | 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
| Parameter Name | Type | Description |
|---|---|---|
| sonChannelInfos | Array | Role information [see LiveSonChannelInfoResponse parameter description] |
LiveSonChannelInfoResponse Parameter Description
| Parameter | Type | Description |
|---|---|---|
| account | String | Assistant/Guest account |
| userId | String | POLYV user ID, consistent with the one on the POLYV official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings) |
| channelId | String | Channel ID |
| passwd | String | Role password |
| nickname | String | Role name |
| stream | String | Role stream name (invalid when used alone) |
| status | String | Role status |
| createdTime | Date | Role creation time |
| lastModified | Date | Last modification time of the role |
| sort | Integer | Sequence number of the role in the channel |
| avatar | String | Role avatar |
| pageTurnEnabled | String | Assistant page turning permission (only one role can have this) |
| notifyEnabled | String | Permission to publish announcements (Y/N) |
| checkinEnabled | String | Permission to enable check-in (Y/N) |
| voteEnabled | String | Permission to initiate voting (Y/N) |
| role | String | Role Assistant: Assistant Guest: Guest |
| chatListEnabled | String | Toggle for displaying the online list on the assistant page: Y: Enable, N: Disable |
| chatAuditEnabled | String | Toggle for assistant chat review: Y: Enable, N: Disable |
| monitorEnabled | String | Toggle for assistant monitoring: Y: Enable, N: Disable |
| roundTourEnabled | String | Toggle for assistant round-robin tour: Y: Enable, N: Disable |
| watchLockEnabled | String | Toggle for locking the live streaming room: Y: Enable, N: Disable |
| pushUrl | String | Sub-channel push URL (for sub-channel push, please refer to the backend director console usage) |
18. Modify Role Information
Description
修改助教或嘉宾的信息
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/account/update
Call Constraints
- The API call is subject to frequency limits. Click here for details. For common call exceptions, click here for details.
Unit Testing
@Test
public void testUpdateAccount() throws Exception {
LiveUpdateAccountRequest liveUpdateAccountRequest = new LiveUpdateAccountRequest();
LiveUpdateAccountResponse liveUpdateAccountResponse;
try {
//准备测试数据
String channelId = super.createChannel();
String accountId = createSonChannel(channelId);
liveUpdateAccountRequest.setChannelId(channelId)
.setAccount(accountId)
.setNickName("张三")
.setActor("嘉宾A")
.setPasswd(super.getRandomString(6));
liveUpdateAccountResponse = new LiveChannelOperateServiceImpl().updateAccount(liveUpdateAccountRequest);
Assert.assertNotNull(liveUpdateAccountResponse);
if (liveUpdateAccountResponse != null) {
//to do something ......
log.debug("测试修改角色信息成功 {}", JSON.toJSONString(liveUpdateAccountResponse));
}
} 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
LiveUpdateAccountResponseobject 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 |
| account | true | String | Teaching assistant/guest account |
| actor | false | String | Title, defaults to "Teaching Assistant" for teaching assistants |
| nickName | false | String | Nickname, defaults to a randomly generated nickname |
| avatar | false | String | Avatar, defaults to the initial avatar (JPG, PNG format images, must include http:// or https://) |
| passwd | false | String | Role password |
| purviewList | false | Array | Permissions [see Purview Parameter Description for details] |
| 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) |
Purview Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| code | true | String | Permission chatListEnabled: Online list (only supports teaching assistants) pageTurnEnabled: Page turning (only supports teaching assistants, and only one teaching assistant can be granted page turning permission) monitorEnabled: Monitoring (only supports teaching assistants, and only one teaching assistant can be granted monitoring permission) chatAuditEnabled: Chat audit (only supports teaching assistants) |
| enabled | true | String | Switch Y: Enable N: Disable |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| account | String | Teaching assistant/guest account |
| userId | String | User ID |
| channelId | String | Channel ID |
| passwd | String | Role password |
| nickname | String | Role name |
| stream | String | Role stream name, invalid when used alone |
| status | String | Role status Y: Enabled N: Disabled |
| createdTime | Date | Role creation time, 13-digit millisecond timestamp |
| lastModified | Date | Last modification time of the role, 13-digit millisecond timestamp |
| sort | Integer | Channel role sequence number |
| avatar | String | Role avatar |
| actor | String | Role title |
| role | String | Role Assistant: Teaching assistant Guest: Guest |
| monitorEnabled | String | Monitoring permission Y: Enabled N: Disabled |
| pageTurnEnabled | String | Page turning permission Y: Enabled N: Disabled |
| chatListEnabled | String | Online list permission Y: Enabled N: Disabled |
19. Delete Role
Description
删除角色
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelAccount/%s/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 testDeleteSonChannel() throws Exception, NoSuchAlgorithmException {
LiveDeleteSonChannelRequest liveDeleteSonChannelRequest = new LiveDeleteSonChannelRequest();
Boolean liveDeleteSonChannelResponse;
try {
//准备测试数据
String channelId = super.createChannel();
String sonChannelId = createSonChannel(channelId);
liveDeleteSonChannelRequest.setChannelId(channelId).setAccount(sonChannelId);
liveDeleteSonChannelResponse = new LiveChannelOperateServiceImpl().deleteSonChannel(
liveDeleteSonChannelRequest);
Assert.assertNotNull(liveDeleteSonChannelResponse);
if (liveDeleteSonChannelResponse) {
//to do something ......
log.debug("测试删除角色成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 |
| account | true | String | Assistant/Guest account |
| 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: 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: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates successful deletion, false indicates failed deletion
20. Batch Delete Roles
Description
批量删除角色
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/account/delete-batch
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 testDeleteAccount() throws Exception {
LiveDeleteAccountRequest liveDeleteAccountRequest = new LiveDeleteAccountRequest();
Boolean liveDeleteAccountResponse;
try {
String channelId = super.getAloneNewChannelId();
LiveCreateSonChannelRequest sonChannelRequest = new LiveCreateSonChannelRequest();
sonChannelRequest.setChannelId(channelId);
liveDeleteAccountRequest.setChannelId(channelId);
liveDeleteAccountRequest.setAccounts(createSonChannel(sonChannelRequest));
liveDeleteAccountResponse = new LiveChannelOperateServiceImpl().deleteAccount(liveDeleteAccountRequest);
Assert.assertTrue(liveDeleteAccountResponse);
if (liveDeleteAccountResponse) {
//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 |
| accounts | true | String | Assistant/instructor accounts, separated by commas for multiple entries, maximum 150 |
| appId | false | String | POLYV user APP_ID, 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: 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 invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
Batch Delete Role Return Entity
21. Set Sub-channel Single Sign-On Token
Description
设置子频道单点登录token
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/set-account-token
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 testCreateSonChannelToken() throws Exception, NoSuchAlgorithmException {
LiveCreateSonChannelTokenRequest liveCreateSonChannelTokenRequest = new LiveCreateSonChannelTokenRequest();
Boolean liveCreateSonChannelTokenResponse;
try {
//准备测试数据
String channelId = super.createChannel();
String sonChannelId = createSonChannel(channelId);
liveCreateSonChannelTokenRequest.setAccount(sonChannelId).setToken(LiveSignUtil.generateUUID());
liveCreateSonChannelTokenResponse = new LiveChannelOperateServiceImpl().createSonChannelToken(
liveCreateSonChannelTokenRequest);
Assert.assertNotNull(liveCreateSonChannelTokenResponse);
if (liveCreateSonChannelTokenResponse) {
//to do something ......
log.debug("设置子频道单点登录token成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 |
|---|---|---|---|
| account | true | String | Sub-channel number (must not be submitted as a numeric type, otherwise the leading '00' in the ID may be removed) |
| token | true | String | Unique string |
| appId | false | String | POLYV user APP_ID, required when calling with multiple accounts (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, required when calling with multiple accounts (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
true indicates that the sub-channel token was set successfully, while false indicates failure.
22. Create Remastered Courseware Task
Description
创建重制课件任务
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/pptRecord/addRecordTask
Call Constraints
- The API call is subject to rate limits. See details. For common call exceptions, see details.
Unit Testing
@Test
public void testCreateChannelPPTRecordTask() throws Exception, NoSuchAlgorithmException {
LiveCreateChannelPPTRecordRequest liveCreateChannelPPTRecordRequest = new LiveCreateChannelPPTRecordRequest();
Boolean liveCreateChannelPPTRecordResponse;
try {
String channel = super.createChannel();
List<String> videoIds = listChannelVideoIds(channel);
liveCreateChannelPPTRecordRequest.setChannelId(channel).setVideoId(videoIds.get(1));
liveCreateChannelPPTRecordResponse = new LiveChannelOperateServiceImpl().createChannelPPTRecordTask(
liveCreateChannelPPTRecordRequest);
Assert.assertTrue(liveCreateChannelPPTRecordResponse);
if (liveCreateChannelPPTRecordResponse) {
//to do something ......
log.debug("测试创建重制课件任务成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 | Playback video ID, obtained from the video library list query |
| 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
true indicates successful creation, false indicates failed creation
23. Query Courseware Remake Task List
Description
查询课件重制任务列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/pptRecord/list
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 testListPPTRecord() throws Exception, NoSuchAlgorithmException {
LiveListChannelPPTRecordRequest liveListChannelPPTRecordRequest = new LiveListChannelPPTRecordRequest();
LiveListChannelPPTRecordResponse liveListChannelPPTRecordResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveListChannelPPTRecordRequest.setChannelId(channelId)
.setStartTime(getDate(2020, 1, 1))
.setEndTime(getDate(2020, 11, 11))
.setCurrentPage(1);
liveListChannelPPTRecordResponse = new LiveChannelOperateServiceImpl().listPPTRecord(
liveListChannelPPTRecordRequest);
Assert.assertNotNull(liveListChannelPPTRecordResponse);
if (liveListChannelPPTRecordResponse != null) {
//to do something ......
log.debug("查询课件重制任务列表信息成功{}", JSON.toJSONString(liveListChannelPPTRecordResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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, a
LiveListChannelPPTRecordResponseobject 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 |
| sessionId | false | String | Session ID. Obtain session information via the new LiveChannelPlaybackServiceImpl().listChannelSessionInfo() method. |
| status | false | String | Courseware remake status: waiting - pending processing; process - processing; success - remake successful; fail - remake failed; uploaded - uploaded to VOD successfully; uploadFailed - uploaded to VOD failed. |
| startTime | false | Date | Start range of the live broadcast start time. |
| endTime | false | Date | End range of the live broadcast start time. |
| currentPage | false | Integer | Page number, defaults to 1. Corresponds to the page field in the API documentation. |
| pageSize | false | Integer | Number of data items per page, defaults to 20. |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is invoked). 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 invoked). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| contents | Array | List of courseware remake tasks [See LivePPTRecord 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] |
LivePPTRecord Parameter Description
| Parameter | Type | Description |
|---|---|---|
| channelId | String | Live channel ID |
| title | String | Name of the corresponding replay |
| url | String | Remastered MP4 download URL, with a 24-hour anti-leech timeout |
| sessionId | String | Session ID |
| startTime | Date | Live start time of the corresponding replay, format: yyyy-MM-dd HH:mm:ss |
| status | String | Status value: waiting - pending processing; process - processing; success - remastering succeeded; fail - remastering failed; uploaded - uploaded to VOD successfully; uploadFailed - uploaded to VOD failed |
| remainDay | Integer | Remaining expiration days of the remastered content, after which it cannot be accessed or downloaded, unit: days |
| duration | Integer | Duration of the remastered video, unit: seconds |
| videoId | String | Live system video ID, e.g., 992d36fa40 |
| vid | String | VOD video VID of the remastered courseware uploaded to VOD |
24. Query Channel Remake Courseware Parameter Settings
Description
查询频道重制课件参数设置信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/pptRecord/get-setting
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 testGetRecordSetting() throws Exception {
LiveChannelGetRecordSettingRequest liveChannelGetRecordSettingRequest =
new LiveChannelGetRecordSettingRequest();
LiveChannelGetRecordSettingResponse liveChannelGetRecordSettingResponse;
try {
String channelId = super.createChannel();
liveChannelGetRecordSettingRequest.setChannelId(channelId);
liveChannelGetRecordSettingResponse = new LiveChannelOperateServiceImpl().liveChannelGetRecordSetting(
liveChannelGetRecordSettingRequest);
Assert.assertNotNull(liveChannelGetRecordSettingResponse);
if (liveChannelGetRecordSettingResponse != null) {
//to do something ......
log.debug("测试查询频道重制课件参数设置信息成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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
LiveChannelGetRecordSettingResponseobject, 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, 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 |
| 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
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| userId | String | POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings) |
| type | Integer | Video layout mode: 0: Three-panel layout, 1: Document only, 2: Picture-in-picture |
| globalSettingEnabled | String | Whether to use global settings: Y: Yes, N: No |
| videoRatio | String | Camera aspect ratio: 0: 16:9, 1: 4:3 |
| brandImgFile | String | Display image |
| backgroundImgFile | String | Background image |
| actionPosition | String | Reset courseware camera position: left: Left side, right: Right side |
25. Set Channel Remake Courseware Configuration Information
Description
设置频道重制课件配置信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/pptRecord/setting
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].
Unable to set up the new channel
Unit Test
@Test
public void testSetChannelRecord() throws IOException, NoSuchAlgorithmException {
LiveChannelRecordSettingRequest liveChannelRecordSettingRequest = new LiveChannelRecordSettingRequest();
Boolean liveChannelRecordSettingResponse;
try {
String channelId = super.createChannel();
liveChannelRecordSettingRequest.setChannelId(channelId)
.setGlobalSettingEnabled(LiveConstant.Flag.NO.getFlag())
.setType(LiveConstant.PPTRecordType.PICTURE.getValue())
.setVideoRatio(LiveConstant.PPTRecordRatio.RATIO_16_9.getValue());
liveChannelRecordSettingResponse = new LiveChannelOperateServiceImpl().setChannelRecord(
liveChannelRecordSettingRequest);
Assert.assertTrue(liveChannelRecordSettingResponse);
if (liveChannelRecordSettingResponse) {
//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 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 Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| globalSettingEnabled | true | String | Whether to use global settings: Y for Yes, N for No |
| type | true | Integer | Video layout mode: 0 for three-screen split, 1 for document only, 2 for picture-in-picture |
| videoRatio | false | String | Camera aspect ratio, effective for new version redesign: 0 for 16:9, 1 for 4:3 |
| brandImgFile | false | File | Display image, effective for new version redesign, supports jpg and png formats. Size: 480x810 when camera aspect ratio is 16:9, 480x720 when camera aspect ratio is 4:3 |
| backgroundImgFile | false | File | Background image, effective for old version redesign, size 1280x720, supports jpg and png formats |
| 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
Channel Remake Courseware Configuration Information Return
26. Delete and Reset Courseware Task
Description
删除重制课件任务, 可批量删除
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/pptRecord/batch-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 testDeleteChannelPPTRecord() throws IOException, NoSuchAlgorithmException {
LiveDeleteChannelPPTRecordRequest liveDeleteChannelPPTRecordRequest = new LiveDeleteChannelPPTRecordRequest();
Boolean liveDeleteChannelPPTRecordResponse;
try {
String channelId = super.createChannel();
liveDeleteChannelPPTRecordRequest.setChannelId(channelId);
liveDeleteChannelPPTRecordRequest.setTaskIds("12345,12346");
liveDeleteChannelPPTRecordResponse = new LiveChannelOperateServiceImpl().deleteChannelPPTRecord(
liveDeleteChannelPPTRecordRequest);
Assert.assertNotNull(liveDeleteChannelPPTRecordResponse);
if (liveDeleteChannelPPTRecordResponse != null) {
//to do something ......
log.debug("测试删除重制课件任务成功 {}", JSON.toJSONString(liveDeleteChannelPPTRecordResponse));
}
} 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 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 |
| taskIds | true | String | Task ID list, multiple task IDs separated by "," |
| 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 failed deletion
27. Query Channel Callback Settings API
Description
查询频道回调设置接口
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/callback/get-setting
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 testGetChannelCallbackSetting() throws Exception {
LiveChannelCallbackSettingRequest liveChannelCallbackSettingRequest = new LiveChannelCallbackSettingRequest();
LiveChannelCallbackSettingResponse liveChannelCallbackSettingResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveChannelCallbackSettingRequest.setChannelId(channelId);
liveChannelCallbackSettingResponse = new LiveChannelOperateServiceImpl().getChannelCallbackSetting(
liveChannelCallbackSettingRequest);
Assert.assertNotNull(liveChannelCallbackSettingResponse);
if (liveChannelCallbackSettingResponse != null) {
//to do something ......
log.debug("测试查询频道回调设置接口成功,{}", JSON.toJSONString(liveChannelCallbackSettingResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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
LiveChannelCallbackSettingResponseobject, 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.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 |
| 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
| Parameter Name | Type | Description |
|---|---|---|
| recordCallbackUrl | String | Recording generation callback URL |
| playbackCallbackUrl | String | Recording video transfer success callback URL |
| streamCallbackUrl | String | Stream status callback URL |
| liveScanCallbackUrl | String | Live content moderation callback URL |
| recordCallbackVideoType | String | Video types for recording callback, multiple types separated by commas |
| playbackCacheCallbackUrl | String | Playback cache generation success callback URL |
| pptRecordCallbackUrl | String | Courseware remake success callback URL |
| globalSettingEnabled | String | Whether to apply global settings switch: Y uses user callback settings, N uses channel settings |
28. Setting Channel Callback Configuration
Description
设置频道回调设置
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/callback/update-setting
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].
If the channel needs to follow user settings, you can call the interface to set the channel default item switch.
Unit Test
@Test
public void testUpdateChannelCallbackSetting() throws Exception {
LiveUpdateChannelCallbackSettingRequest liveUpdateChannelCallbackSettingRequest =
new LiveUpdateChannelCallbackSettingRequest();
Boolean liveUpdateChannelCallbackSettingResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveUpdateChannelCallbackSettingRequest.setChannelId(channelId);
liveUpdateChannelCallbackSettingResponse = new LiveChannelOperateServiceImpl().updateChannelCallbackSetting(
liveUpdateChannelCallbackSettingRequest);
Assert.assertTrue(liveUpdateChannelCallbackSettingResponse);
if (liveUpdateChannelCallbackSettingResponse) {
//to do something ......
log.debug("测试设置频道回调设置成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 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 Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| recordCallbackVideoType | false | String | Recording callback file type, optional values: m3u8, mp4, or m3u8,mp4 |
| recordCallbackUrl | false | String | Recording callback HTTP(S) address, requires URL encoding. Pass an empty string to clear the setting. |
| playbackCallbackUrl | false | String | Playback callback HTTP(S) address for successful transfer, requires URL encoding. Pass an empty string to clear the setting. |
| streamCallbackUrl | false | String | Stream status callback HTTP(S) address, requires URL encoding. Pass an empty string to clear the setting. |
| pptRecordCallbackUrl | false | String | Courseware remake success callback HTTP(S) address, requires URL encoding. Pass an empty string to clear the setting. |
| liveScanCallbackUrl | false | String | Live content moderation callback HTTP(S) address, requires URL encoding. Pass an empty string to clear the setting. |
| playbackCacheCallbackUrl | false | String | Playback cache callback HTTP(S) address, requires URL encoding. Pass an empty string to clear the setting. |
| 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: 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: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
null
29. Batch Create Roles
Description
批量创建角色
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/account/batch-create
Call Constraints
The API call is subject to rate limits. Click here for details. For common call exceptions, click here for details.
Batch create roles, supporting guest and assistant roles.
Unit Test
@Test
public void testCreateSonChannelList() throws Exception {
LiveCreateSonChannelListRequest liveCreateSonChannelListRequest = new LiveCreateSonChannelListRequest();
LiveCreateSonChannelListResponse liveCreateSonChannelListResponse;
try {
//准备测试数据
String channelId = super.createChannel();
List<LiveCreateSonChannelListRequest.SonChannel> sonChannels =
new ArrayList<LiveCreateSonChannelListRequest.SonChannel>();
LiveCreateSonChannelListRequest.SonChannel sonChannel1 = new LiveCreateSonChannelListRequest.SonChannel();
sonChannel1.setRole("Guest")
.setNickname("嘉宾甲")
.setPasswd(getRandomString(10))
.setActor("博士")
.setAvatar("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3002379740," +
"3965499425&fm=26&gp=0.jpg");
sonChannels.add(sonChannel1);
sonChannel1 = new LiveCreateSonChannelListRequest.SonChannel();
sonChannel1.setRole(null)
.setNickname("助教甲")
.setPasswd(getRandomString(10))
.setActor("助教")
.setAvatar("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3002379740," +
"3965499425&fm=26&gp=0.jpg");
sonChannels.add(sonChannel1);
liveCreateSonChannelListRequest.setChannelId(channelId).setSonChannels(sonChannels);
liveCreateSonChannelListResponse = new LiveChannelOperateServiceImpl().createSonChannelList(
liveCreateSonChannelListRequest);
Assert.assertNotNull(liveCreateSonChannelListResponse);
if (liveCreateSonChannelListResponse != null) {
//to do something ......
log.debug("测试批量创建角色成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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
LiveCreateSonChannelListResponseobject 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| sonChannels | true | Array | Role information [see SonChannel parameter description] |
| 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) |
SonChannel Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| role | false | String | Default is assistant; pass "Guest" for guest |
| nickname | false | String | Nickname of the created assistant or guest |
| passwd | false | String | Role password |
| actor | false | String | Title of the created assistant or guest |
| avatar | false | String | Avatar of the created assistant or guest |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| sonChannelInfos | Array | Role return information [See SonChannelInfo parameter description] |
SonChannelInfo Parameter Description
| Parameter | Type | Description |
|---|---|---|
| account | String | Assistant ID |
| userId | String | POLYV user ID, consistent with the official Polyv website. Retrieval path: Official website -> Login -> Live (Development Settings) |
| channelId | String | Channel ID |
| passwd | String | Assistant password |
| nickname | String | Assistant name |
| stream | String | Assistant stream name (invalid when used alone) |
| status | String | Assistant status (Y/N) |
| createdTime | Date | Assistant creation time |
| lastModified | Date | Last modification time of the assistant |
| sort | Integer | Sequence number of the assistant among all assistants in the channel |
| avatar | String | Assistant avatar |
| pageTurnEnabled | String | Assistant page turning permission (only one assistant can have it) Y: Enabled N: Disabled |
| notifyEnabled | String | Announcement publishing permission (Y/N) |
| checkinEnabled | String | Check-in enabling permission (Y/N) |
| voteEnabled | String | Vote initiation permission (Y/N) |
| role | String | Role assistant: Assistant guest: Guest |
| loginUrl | String | Sub-account (guest) login URL |
30. Retrieve Account or Channel Rebroadcast List Information
Description
获取账号或频道转播列表信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/transmit/get-associations
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 testGetChannelTransmitList() throws Exception {
LiveChannelTransmitListRequest liveChannelTransmitListRequest = new LiveChannelTransmitListRequest();
LiveChannelTransmitListResponse liveChannelTransmitListResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveChannelTransmitListRequest.setChannelId(channelId);
liveChannelTransmitListResponse = new LiveChannelOperateServiceImpl().getChannelTransmitList(
liveChannelTransmitListRequest);
Assert.assertNotNull(liveChannelTransmitListResponse);
if (liveChannelTransmitListResponse != null) {
//to do something ......
log.debug("测试获取账号或频道转播列表信息成功,{}", JSON.toJSONString(liveChannelTransmitListResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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
LiveChannelTransmitListResponseobject is returned. 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 | false | String | Channel ID. If not provided, all relay channel associations under the account corresponding to the appId will be queried. |
| 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: 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: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| channelTransmits | Array | Account or channel relay information [See ChannelTransmit Parameter Description] |
ChannelTransmit Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | The channel ID of the originating relay. If a receiving relay channel is not associated with a main channel, this value is null. |
| receiveChannelId | String | The channel ID of the receiving relay. |
31. Set Maximum Online Users for a Channel
Description
设置频道最大在线人数
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelRestrict/%s/set-max-viewer
Call Constraints
- API calls are subject to rate limits. Click here for details. For common call exceptions, click here for details.
Unit Testing
@Test
public void testUpdateChannelMaxViewer() throws Exception {
LiveUpdateChannelMaxViewerRequest liveUpdateChannelMaxViewerRequest = new LiveUpdateChannelMaxViewerRequest();
Boolean liveUpdateChannelMaxViewerResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveUpdateChannelMaxViewerRequest.setChannelId(channelId).setMaxViewer(Integer.MAX_VALUE);
liveUpdateChannelMaxViewerResponse = new LiveChannelOperateServiceImpl().updateChannelMaxViewer(
liveUpdateChannelMaxViewerRequest);
Assert.assertTrue(liveUpdateChannelMaxViewerResponse);
if (liveUpdateChannelMaxViewerResponse) {
//to do something ......
log.debug("测试设置频道最大在线人数成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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, 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 |
| 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) |
| maxViewer | true | Integer | Maximum number of concurrent online viewers. A value of 0 disables the viewer limit. Maximum value is 2147483647 |
| 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
true indicates success, false indicates failure
32. Query Channel Ad List
Description
查询频道广告列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/advert/list
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].
Provide a query for the channel carousel advertisement list. When the channel advertisement is empty, retrieve the global advertisement.
Unit Test
@Test
public void testGetChannelAdvertList() throws Exception {
LiveChannelAdvertListRequest liveChannelAdvertListRequest = new LiveChannelAdvertListRequest();
LiveChannelAdvertListResponse liveChannelAdvertListResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveChannelAdvertListRequest.setChannelId(channelId);
liveChannelAdvertListResponse = new LiveChannelOperateServiceImpl().getChannelAdvertList(
liveChannelAdvertListRequest);
Assert.assertNotNull(liveChannelAdvertListResponse);
if (liveChannelAdvertListResponse != null) {
//to do something ......
log.debug("测试查询频道广告列表成功,{}", JSON.toJSONString(liveChannelAdvertListResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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, return a
LiveChannelAdvertListResponseobject, 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, 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 |
| 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
| Parameter Name | Type | Description |
|---|---|---|
| channelAdverts | Array | Channel advertisements [See ChannelAdvert Parameter Description] |
ChannelAdvert Parameter Description
| Parameter | Type | Description |
|---|---|---|
| text | String | Text ad content |
| img | String | Image ad link |
| href | String | Redirect link |
33. Query Channel Live Screenshot
Description
查询频道直播截图
接口地址(仅做说明使用):https://api.polyv.net/live/v2/stream/%s/capture
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].
If the live stream is not started, a "channel is not live." exception will be thrown.
Unit Test
@Test
public void testGetChannelCapture() throws Exception {
LiveChannelCaptureRequest liveChannelCaptureRequest = new LiveChannelCaptureRequest();
String liveChannelCaptureResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveChannelCaptureRequest.setChannelId(channelId);
liveChannelCaptureResponse = new LiveChannelOperateServiceImpl().getChannelCapture(
liveChannelCaptureRequest);
Assert.assertNotNull(liveChannelCaptureResponse);
if (liveChannelCaptureResponse != null) {
//to do something ......
log.debug("测试查询频道直播截图成功,{}", JSON.toJSONString(liveChannelCaptureResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 String 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 encounters an exception and throws 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() 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
Return the image HTTP address,
34. Modify Live Streaming Push Method
Description
修改直播推流方式
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/stream/update
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].
The live streaming method cannot be modified during a live broadcast.
Unit Test
@Test
public void testUpdateChannelStream() throws Exception {
LiveUpdateChannelStreamRequest liveUpdateChannelStreamRequest = new LiveUpdateChannelStreamRequest();
Boolean liveUpdateChannelStreamResponse;
try {
//准备测试数据
String channelId = super.createChannel();
liveUpdateChannelStreamRequest.setStreamType("disk").setChannelId(channelId);
liveUpdateChannelStreamResponse = new LiveChannelOperateServiceImpl().updateChannelStream(
liveUpdateChannelStreamRequest);
Assert.assertTrue(liveUpdateChannelStreamResponse);
if (liveUpdateChannelStreamResponse) {
//to do something ......
log.debug("测试修改直播推流方式成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 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.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 | Live channel ID |
| streamType | true | String | Live streaming method: client for client push, disk for hard disk push, audio for audio live streaming, pull for pull stream live |
| pullUrl | false | String | Pull stream URL |
| appId | false | String | POLYV user APP_ID, 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: 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 invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates that the push stream method was modified successfully, while false indicates that the modification failed.
35. Setting Up Hard Disk Streaming for Live Broadcast
Description
设置硬盘推流直播
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/stream/add-disk-videos
Call Constraints
API calls are subject to frequency limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
After calling the API, if the current channel is not live, the live streaming method will be automatically set to "Hard Disk Push Streaming". If the current channel is live using another push streaming method, you need to call "Modify Live Push Streaming Method" after the live stream ends to change it to hard disk push streaming. Only then will the live stream start at the set start time.
A no-latency channel cannot be modified to hard disk streaming.
Hard disk streaming is supported only in pure video mode.
Does not support setting encrypted videos as hard disk push streaming
Unit Test
@Test
public void testCreateDiskVideosStream() throws Exception {
LiveCreateDiskVideosStreamRequest liveCreateDiskVideosStreamRequest = new LiveCreateDiskVideosStreamRequest();
Boolean liveCreateDiskVideosStreamResponse;
try {
//准备测试数据
String channelId = super.getAloneChannelId();
//保利威云点播视频列表的VID,需导入保利威点播SDK,调用new VodQueryServiceImpl().searchVideoList()获取VideoId
String videoId = "1b448be323d7eaee38dcead42f053911_1";
liveCreateDiskVideosStreamRequest.setVideoIds(videoId)
.setStartTimes(super.getDate(System.currentTimeMillis() + 60 * 1000))
.setChannelId(channelId);
liveCreateDiskVideosStreamResponse = new LiveChannelOperateServiceImpl().createDiskVideosStream(
liveCreateDiskVideosStreamRequest);
Assert.assertTrue(liveCreateDiskVideosStreamResponse);
if (liveCreateDiskVideosStreamResponse) {
//to do something ......
log.debug("测试设置硬盘推流直播成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 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 |
| videoIds | true | String | The VOD video IDs to set for hard disk streaming [corresponds to the vids field in the API documentation] |
| startTimes | true | Date | Hard disk streaming start time |
| appId | false | String | POLYV user APP_ID, 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, 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
true indicates that setting up hard disk live streaming was successful, while false indicates that the modification failed.
36. Delete a Video Streamed from a Hard Drive
Description
删除硬盘推流的视频
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/stream/delete-disk-videos
Call Constraints
There is a frequency limit for API calls. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Delete videos in pseudo-live streaming. Videos currently being used in pseudo-live streaming cannot be deleted.
Unit Test
@Test
public void testDeleteDiskVideosStream() throws Exception {
LiveDeleteDiskVideosStreamRequest liveDeleteDiskVideosStreamRequest = new LiveDeleteDiskVideosStreamRequest();
Boolean liveDeleteDiskVideosStreamResponse;
try {
//准备测试数据
String channelId = super.getAloneChannelId();
liveDeleteDiskVideosStreamRequest.setVideoIds("1b448be323d7eaee38dcead42f053911_1").setChannelId(channelId);
liveDeleteDiskVideosStreamResponse = new LiveChannelOperateServiceImpl().deleteDiskVideosStream(
liveDeleteDiskVideosStreamRequest);
Assert.assertTrue(liveDeleteDiskVideosStreamResponse);
if (liveDeleteDiskVideosStreamResponse) {
//to do something ......
log.debug("测试删除硬盘推流的视频成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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. The B-side handles 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 |
| videoIds | true | String | IDs of hard disk live streaming videos to delete (corresponds to the vids field in the API documentation) |
| 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 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() has been 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 that the hard disk live streaming was successfully deleted, while false indicates that the deletion failed.
37. Batch Modify Channel Danmaku Switch
Description
调用后频道会关闭掉通用设置
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/basic/batchUpdateDanmu
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 testBatchUpdateBarrage() throws Exception {
LiveBatchUpdateBarrageRequest liveBatchUpdateBarrageRequest = new LiveBatchUpdateBarrageRequest();
Boolean liveBatchUpdateBarrageResponse;
try {
//准备测试数据
String channelIds = String.format("%s,%s", super.getAloneChannelId(), super.createChannel());
liveBatchUpdateBarrageRequest.setChannelIds(channelIds).setCloseBarrage("Y").setShowBarrageInfoEnabled("Y");
liveBatchUpdateBarrageResponse = new LiveChannelOperateServiceImpl().batchUpdateBarrage(
liveBatchUpdateBarrageRequest);
Assert.assertTrue(liveBatchUpdateBarrageResponse);
if (liveBatchUpdateBarrageResponse) {
//to do something ......
log.debug("测试批量修改频道弹幕开关成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
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 |
|---|---|---|---|
| closeBarrage | true | String | Whether to disable the barrage feature. Y: Disable, N: Enable [Corresponds to the closeDanmu field in the API documentation] |
| showBarrageInfoEnabled | true | String | Whether to display the barrage info toggle. Y: Show, N: Hide [Corresponds to the showDanmuInfoEnabled field in the API documentation] |
| channelIds | true | String | Channel IDs for which the barrage switch needs to be modified. Multiple channel IDs should be separated by commas (half-width), e.g., , |
| 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. 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 invoked to set up multi-account calls). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates that the batch modification of the channel's danmaku switch was successful, while false indicates that the batch modification failed.
38. Query Registration Viewing Records
Description
查询频道报名观看记录
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/enroll/list
Call Constraints
- The API call is subject to frequency 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 testGetLiveEnrollList() throws IOException, NoSuchAlgorithmException {
LiveGetEnrollListRequest liveGetEnrollListRequest = new LiveGetEnrollListRequest();
LiveGetEnrollListResponse liveGetEnrollListResponse;
try {
String channelId = super.createChannel();
liveGetEnrollListRequest.setChannelId(channelId);
liveGetEnrollListResponse = new LiveChannelOperateServiceImpl().getLiveEnrollList(liveGetEnrollListRequest);
Assert.assertNotNull(liveGetEnrollListResponse);
if (liveGetEnrollListResponse != null) {
//to do something ......
log.debug("测试查询报名观看记录成功{}", JSON.toJSONString(liveGetEnrollListResponse));
}
} 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
LiveGetEnrollListResponseobject, 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, 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
| Parameter Name | Type | Description |
|---|---|---|
| auditEnabled | String | Channel registration review switch: Y: Enabled, N: Disabled |
| list | Array | Registration viewing records [See LiveEnrollList parameter description for details] |
LiveEnrollList Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| viewerId | String | Viewer ID |
| mobile | String | Phone number |
| createTime | Date | Registration time |
| hasWatched | String | Whether watched: Y - Yes, N - No |
| promoteId | String | Promotion channel ID |
| promoteName | String | Promotion channel name |
| auditStatus | String | Audit result: W - Pending, P - Approved, F - Rejected |
| fields | Array | Registration information [See LiveEnrollFields parameter description] |
LiveEnrollFields Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| name | String | Registration information name |
| value | String | Registration information value |
39. Query Channel Page Decoration
Description
查询频道的页面装修设置
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/decorate/get
Call Constraints
- The API call is subject to frequency 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 testGetChannelDecorate() throws IOException, NoSuchAlgorithmException {
LiveGetChannelDecorateRequest liveGetChannelDecorateRequest = new LiveGetChannelDecorateRequest();
LiveGetChannelDecorateResponse liveGetChannelDecorateResponse;
try {
String channelId = super.createChannel();
liveGetChannelDecorateRequest.setChannelId(channelId);
liveGetChannelDecorateResponse = new LiveChannelOperateServiceImpl().getChannelDecorate(
liveGetChannelDecorateRequest);
Assert.assertNotNull(liveGetChannelDecorateResponse);
if (liveGetChannelDecorateResponse != null) {
//to do something ......
log.debug("测试查询频道页面装修成功{}", JSON.toJSONString(liveGetChannelDecorateResponse));
}
} 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
LiveGetChannelDecorateResponseobject, based on which the B-side processes the 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, 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 |
| 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
| Parameter | Type | Description |
|---|---|---|
| skin | String | Skin: black - Fashion Black, red - Festive Red, blue - Tech Blue, white - Classic White, green - Mint Green, golden - Luxury Gold |
| aloneWatchLayout | String | Normal live streaming viewing page layout configuration (normal: normal, portrait: portrait) |
| chat | DecorateChat | Chat object in decoration [See DecorateChat Parameter Description] |
| desc | DecorateDesc | Chinese live streaming introduction page object in decoration [See DecorateDesc Parameter Description] |
| menus | Array | Chinese menu list object [See DecorateMenus Parameter Description] |
| player | DecoratePlayer | Player object in decoration [See DecoratePlayer Parameter Description] |
| pptMobileWatchLayout | String | Three-screen mobile viewing layout: normal - regular live streaming, portrait - live commerce |
| splash | DecorateSplash | Splash page object in decoration [See DecorateSplash Parameter Description] |
| splashEnabled | String | Splash page toggle: Y - enabled, N - disabled |
| englishSettingEnabled | String | Bilingual live room toggle: Y - enabled, N - disabled |
| enMenus | Array | English menu list object [See DecorateMenus Parameter Description] |
| descEn | DecorateDescEn | Template - English live streaming introduction page object in decoration [See DecorateDescEn Parameter Description] |
DecorateChat Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| baseLikes | Integer | Cumulative number of likes (like base) |
| chatOnlineNumberEnable | String | Online user count toggle, Y: enabled, N: disabled |
| emotionEnabled | String | Emotion live room toggle, only one of emotion toggle and like toggle can be enabled at a time, Y: enabled, N: disabled |
| redPackEnabled | String | Red packet toggle, Y: enabled, N: disabled |
| sendFlowersEnabled | String | Like toggle, Y: enabled, N: disabled |
| viewerSendImgEnabled | String | Send image toggle, Y: enabled, N: disabled |
| welcomeEnabled | String | Welcome message toggle, Y: enabled, N: disabled |
| withdrawEnabled | String | Withdrawal toggle, Y: enabled, N: disabled |
DecorateDesc Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| coverImageUrl | String | Warm-up image -> Cover image |
| iconUrl | String | Icon URL |
| publisher | String | Host name, maximum length 50 |
| title | String | Title -> Live stream name, maximum length 100 |
DecorateMenus Parameter Description
| Parameter | Type | Description |
|---|---|---|
| content | String | Menu content |
| menuId | String | Menu ID |
| name | String | Menu name |
| type | String | Menu type: desc (live introduction), chat (interactive chat), quiz (questions), qa (Q&A), invite (invitation poster), text (text menu) |
DecoratePlayer Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| actualPV | Integer | Actual cumulative view count (real count) |
| backgroundUrl | String | PC background image |
| basePV | Integer | Base view count |
| coverJumpUrl | String | Cover (warm-up) jump link |
| iconLink | String | Watermark link |
| iconPosition | String | Icon position (watermark position) |
| iconUrl | String | Watermark image URL |
| logoOpacity | Float | Watermark opacity, 0: fully transparent, 1: fully opaque |
| warmUpEnabled | String | Warm-up switch, Y: enabled, N: disabled |
| warmUpImageUrl | String | Warm-up image URL (live stream cover image) |
| watermarkEnabled | String | Watermark switch, Y: enabled, N: disabled |
DecorateSplash Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| splashImageUrl | String | Splash page image URL |
DecorateMenus Parameter Description
| Parameter | Type | Description |
|---|---|---|
| content | String | Menu content |
| menuId | String | Menu ID |
| name | String | Menu name |
| type | String | Menu type: desc (live introduction), chat (interactive chat), quiz (questions), qa (Q&A), invite (invitation poster), text (text menu) |
DecorateDescEn Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| publisher | String | Host's English name, maximum length 50 |
| title | String | Live stream English title, maximum length 100 |
40. Modify Channel Decoration Settings
Description
修改频道的页面装修设置
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/decorate/update
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 testUpdateChannelDecorate() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelDecorateRequest liveUpdateChannelDecorateRequest = new LiveUpdateChannelDecorateRequest();
Boolean liveUpdateChannelDecorateResponse;
try {
String channelId = super.createChannel();
liveUpdateChannelDecorateRequest.setChannelId(channelId);
LiveUpdateChannelDecorateRequest.DecorateChat chat = new LiveUpdateChannelDecorateRequest.DecorateChat();
chat.setBaseLikes(2000)
.setChatOnlineNumberEnable(LiveConstant.Flag.YES.getFlag())
.setRedPackEnabled(LiveConstant.Flag.YES.getFlag());
List<LiveUpdateChannelDecorateRequest.DecorateMenus> menus = new ArrayList<>();
LiveUpdateChannelDecorateRequest.DecorateMenus menu1 = new LiveUpdateChannelDecorateRequest.DecorateMenus();
LiveUpdateChannelDecorateRequest.DecorateMenus menu2 = new LiveUpdateChannelDecorateRequest.DecorateMenus();
menu1.setType(LiveConstant.MenuType.DESC.getType()).setName("直播介绍");
menu2.setType(LiveConstant.MenuType.TEXT.getType()).setName("图文菜单");
menus.add(menu1);
menus.add(menu2);
liveUpdateChannelDecorateRequest.setChat(chat)
.setEnglishSettingEnabled(LiveConstant.Flag.NO.getFlag())
.setSkin(LiveConstant.Skin.GOLDEN.getValue())
.setSplashEnabled(LiveConstant.Flag.YES.getFlag())
.setMenus(menus);
liveUpdateChannelDecorateResponse = new LiveChannelOperateServiceImpl().updateChannelDecorate(
liveUpdateChannelDecorateRequest);
Assert.assertTrue(liveUpdateChannelDecorateResponse);
if (liveUpdateChannelDecorateResponse) {
//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, 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 |
| skin | false | String | Skin: black (Fashion Black), red (Festive Red), blue (Tech Blue), white (Classic White), green (Mint Green), golden (Luxury Gold) |
| chat | false | DecorateChat | Chat object in decoration See DecorateChat parameter description |
| desc | false | DecorateDesc | Live stream introduction page object in decoration See DecorateDesc parameter description |
| menus | false | Array | Chinese menu list object See DecorateMenus parameter description |
| player | false | DecoratePlayer | Player object in decoration See DecoratePlayer parameter description |
| splash | false | DecorateSplash | Splash page object in decoration See DecorateSplash parameter description |
| splashEnabled | false | String | Splash page toggle: Y (Enabled), N (Disabled) |
| englishSettingEnabled | false | String | Bilingual live room toggle: Y (Enabled), N (Disabled) |
| enMenus | false | Array | English menu list object See DecorateMenus parameter description |
| descEn | false | DecorateDescEn | Template - English live stream introduction page object in decoration See DecorateDescEn parameter description |
| 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) |
DecorateChat Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| baseLikes | false | Integer | Cumulative number of likes (like base) |
| chatOnlineNumberEnable | false | String | Online user count toggle, Y: enabled, N: disabled |
| emotionEnabled | false | String | Emotion live room toggle, only one of emotion toggle and like toggle can be enabled at a time, Y: enabled, N: disabled |
| redPackEnabled | false | String | Red packet toggle, Y: enabled, N: disabled |
| sendFlowersEnabled | false | String | Like toggle, Y: enabled, N: disabled |
| viewerSendImgEnabled | false | String | Image sending toggle, Y: enabled, N: disabled |
| welcomeEnabled | false | String | Welcome message toggle, Y: enabled, N: disabled |
| withdrawEnabled | false | String | Withdrawal toggle, Y: enabled, N: disabled |
DecorateDesc Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| iconUrl | false | String | Icon URL |
| publisher | false | String | Host name, maximum length 50 |
| title | false | String | Title -> Live stream name, maximum length 100 |
DecorateMenus Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| content | false | String | Menu content |
| menuId | false | String | Menu ID |
| name | true | String | Menu name |
| type | true | String | Menu type: desc - Live introduction, chat - Interactive chat, quiz - Quiz, qa - Q&A, invite - Invitation poster, text - Text menu |
DecoratePlayer Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| actualPV | false | Integer | Actual cumulative view count (real count) |
| backgroundUrl | false | String | PC background image |
| basePV | false | Integer | Base view count |
| coverJumpUrl | false | String | Cover (warm-up) jump link |
| iconLink | false | String | Watermark link |
| iconPosition | false | String | Icon position (watermark position) |
| iconUrl | false | String | Watermark image URL |
| logoOpacity | false | Float | Watermark opacity, 0: fully transparent, 1: fully opaque |
| warmUpEnabled | false | String | Warm-up switch, Y: enabled, N: disabled |
| warmUpImageUrl | false | String | Warm-up image URL (live stream cover image) |
| watermarkEnabled | false | String | Watermark switch, Y: enabled, N: disabled |
DecorateSplash Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| splashImageUrl | false | String | Splash page image URL |
DecorateMenus Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| content | false | String | Menu content |
| menuId | false | String | Menu ID |
| name | true | String | Menu name |
| type | true | String | Menu type: desc - live stream introduction, chat - interactive chat, quiz - quiz, qa - Q&A, invite - invitation poster, text - text and image menu |
DecorateDescEn Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| publisher | false | String | Host's English name, maximum length 50 |
| title | false | String | Live stream's English name, maximum length 100 |
Return Object Description
Modify the channel decoration settings to return the entity
41. Copy Channel
Description
通过一个频道复制出一个新的频道
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/basic/copy
Call Constraints
- The API call is subject to rate limits. Click here for details. For common call exceptions, click here.
Unit Testing
@Test
public void testCopyChannel() throws Exception {
LiveChannelCopyRequest liveChannelCopyRequest = new LiveChannelCopyRequest();
LiveChannelCopyResponse liveChannelCopyResponse;
try {
String channelId = super.getAloneNewChannelId();
liveChannelCopyRequest.setChannelId(channelId).setName("sdk测试复制频道");
liveChannelCopyResponse = new LiveChannelOperateServiceImpl().copyChannel(liveChannelCopyRequest);
Assert.assertNotNull(liveChannelCopyResponse);
if (liveChannelCopyResponse != null) {
//to do something ......
log.debug("测试复制频道成功 {}", JSON.toJSONString(liveChannelCopyResponse));
//TODO 此处创建完成后删除了频道,正式使用需删除该语句
super.deleteChannel(liveChannelCopyResponse.getChannelId());
}
} 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
LiveChannelCopyResponseobject is returned. 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 | The channel ID of the channel to be copied |
| name | false | String | The new channel name; defaults to the name of the copied channel |
| categoryId | false | Integer | The category ID for the new channel; defaults to the default category |
| startTime | false | String | The start time of the channel, format: yyyy-MM-DD HH:mm:ss; defaults to the start time of the copied channel |
| appId | false | String | POLYV user APP_ID, 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: 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 invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
42. Batch Modify Channel Skins
Description
批量修改频道装修皮肤
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/decorate/skin/update-batch
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 testUpdateChannelSkin() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelSkinRequest liveUpdateChannelSkinRequest = new LiveUpdateChannelSkinRequest();
Boolean liveUpdateChannelSkinResponse;
try {
String channelIds = String.format("%s,%s", super.getAloneChannelId(), super.createChannel());
liveUpdateChannelSkinRequest.setChannelIds(channelIds).setSkin("red");
liveUpdateChannelSkinResponse = new LiveChannelOperateServiceImpl().updateChannelSkin(
liveUpdateChannelSkinRequest);
Assert.assertTrue(liveUpdateChannelSkinResponse);
if (liveUpdateChannelSkinResponse) {
//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, 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 |
|---|---|---|---|
| channelIds | true | String | Channel IDs separated by English commas, e.g., 10000,100001. Maximum of 10,000 IDs. |
| skin | true | String | Skin: black (Fashion Black), red (Festive Red), blue (Tech Blue), white (Classic White), green (Mint Green), golden (Rich Gold). |
| appId | false | String | POLYV user APP_ID. Required when calling with multiple accounts (i.e., after invoking initMultiAccount() 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 when calling with multiple accounts (i.e., after invoking initMultiAccount() to set up multi-account calls). Obtain by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
Batch Modify Channel Skin Return Entity
43. Get Channel Follow Official Account Settings Information
Description
查询关注公众号设置接口
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/promotion/list-channels-follow
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 testListChannelsFollow() throws IOException, NoSuchAlgorithmException {
LiveListChannelsFollowRequest liveListChannelsFollowRequest = new LiveListChannelsFollowRequest();
LiveListChannelsFollowResponse liveListChannelsFollowResponse;
try {
String channelId = super.createChannel();
liveListChannelsFollowRequest.setChannelIds(channelId);
liveListChannelsFollowResponse = new LiveChannelOperateServiceImpl().listChannelsFollow(
liveListChannelsFollowRequest);
Assert.assertNotNull(liveListChannelsFollowResponse);
if (liveListChannelsFollowResponse != null) {
//to do something ......
log.debug("测试获取频道关注公众号设置信息成功 {}", JSON.toJSONString(liveListChannelsFollowResponse));
}
} 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
LiveListChannelsFollowResponseobject 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 |
|---|---|---|---|
| channelIds | true | String | Channel IDs, multiple channels separated by "," |
| 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 | Type | Description |
|---|---|---|
| list | Array | List of official account follow settings [See ChannelsFollow parameter description for details] |
ChannelsFollow Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| enabled | String | Official account follow feature toggle: Y for enabled, N for disabled |
| autoShowEnabled | String | Auto popup toggle: Y for enabled, N for disabled |
| qrCodeUrl | String | QR code image URL |
| entranceText | String | Entrance text |
| tips | String | Popup prompt text |
44. Modify Channel Follow Official Account Settings
Description
更新关注公众号设置接口
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/promotion/update-channels-follow
Call Constraints
- The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
Unit Testing
@Test
public void testUpdateChannelsFollow() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelsFollowRequest liveUpdateChannelsFollowRequest = new LiveUpdateChannelsFollowRequest();
Boolean liveUpdateChannelsFollowResponse;
try {
String channelId = super.createChannel();
liveUpdateChannelsFollowRequest.setChannelIds(channelId);
liveUpdateChannelsFollowRequest.setEnabled("Y");
liveUpdateChannelsFollowRequest.setAutoShowEnabled("Y");
liveUpdateChannelsFollowRequest.setEntranceText("welcome");
liveUpdateChannelsFollowRequest.setTips("tips");
liveUpdateChannelsFollowRequest.setQrCodeUrl(
"https://wwwimg.polyv.net/assets/dist/images/web3.0/c-footer/ft-wechat-qrcode.png");
liveUpdateChannelsFollowResponse = new LiveChannelOperateServiceImpl().updateChannelsFollow(
liveUpdateChannelsFollowRequest);
Assert.assertNotNull(liveUpdateChannelsFollowResponse);
if (liveUpdateChannelsFollowResponse != null) {
//to do something ......
log.debug("测试修改频道关注公众号设置信息成功 {}", JSON.toJSONString(liveUpdateChannelsFollowResponse));
}
} 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 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, 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 |
|---|---|---|---|
| channelIds | true | String | Channel IDs, multiple channels separated by "," |
| qrCodeUrl | true | String | Image link URL |
| enabled | false | String | WeChat official account follow feature toggle; leave empty to keep unchanged. Y: Enable, N: Disable |
| autoShowEnabled | false | String | Auto popup toggle; leave empty to keep unchanged. Y: Enable, N: Disable |
| entranceText | false | String | Entrance text, maximum 8 characters; leave empty to keep unchanged |
| tips | false | String | Popup prompt text, maximum 30 characters; leave empty to keep unchanged |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is invoked for multi-account setup). Obtain via Polyv official website registration: Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is invoked for multi-account setup). Obtain via Polyv official website registration: Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates success, false indicates failure.
45. Batch Delete Multiple Chat Messages in a Channel
Description
根据聊天的id删除对应聊天记录
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/chat/remove-contents
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 testRemoveChatContents() throws IOException, NoSuchAlgorithmException {
LiveRemoveChatContentsRequest liveRemoveChatContentsRequest = new LiveRemoveChatContentsRequest();
Boolean liveRemoveChatContentsResponse;
try {
String channelId = super.createChannel();
liveRemoveChatContentsRequest.setChannelId(channelId);
liveRemoveChatContentsRequest.setIds("c71c7240-86cd-11eb-a963-e9bab7dc4d86");
liveRemoveChatContentsResponse = new LiveChannelOperateServiceImpl().removeChatContents(
liveRemoveChatContentsRequest);
Assert.assertNotNull(liveRemoveChatContentsResponse);
if (liveRemoveChatContentsResponse != null) {
//to do something ......
log.debug("测试批量删除频道多条聊天记录成功 {}", JSON.toJSONString(liveRemoveChatContentsResponse));
}
} 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 |
| ids | true | String | IDs corresponding to chat records (multiple IDs separated by commas). This parameter is obtained from [Query Channel Chat Records]. |
| 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. 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 calls). Obtained by registering on the Polyv official website. Path: Official website -> Login -> Live Streaming (Development Settings). |
Return Object Description
true indicates successful deletion, false indicates failed deletion.
