playerService
1. Setting the Channel's Warm-up Setting Switch
Description
用于设置频道的暖场开关
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/set-warmup-enabled
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 testSetPlayerWarmupEnable() throws Exception, NoSuchAlgorithmException, URISyntaxException {
LiveSetWarmupEnableRequest liveSetWarmupEnableRequest = new LiveSetWarmupEnableRequest();
Boolean liveSetWarmupEnableResponse = null;
try {
String channelId = super.createChannel();
liveSetWarmupEnableRequest.setChannelId(channelId).setWarmUpEnabled(LiveConstant.Flag.YES.getFlag());
liveSetWarmupEnableResponse = new LivePlayerServiceImpl().setPlayerWarmupEnable(liveSetWarmupEnableRequest);
Assert.assertNotNull(liveSetWarmupEnableResponse);
if (liveSetWarmupEnableResponse != null) {
//to do something ......
log.debug("测试设置频道的暖场设置开关成功{}", JSON.toJSONString(liveSetWarmupEnableResponse));
}
} 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| warmUpEnabled | true | String | Switch value, Y or N. Y indicates enabled, N indicates disabled. |
| 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 success, false indicates failure
2. Setting the Player Warm-up Image
Description
1、修改播放器的暖场图片
2、暖场视频和暖场图片是处于非直播状态时,播放器显示的画面,两者在同一时间只能显示一种,以最晚设置者为准,若想删除暖场画面,则将coverImage或warmUpFlv的值设为"http://"。
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/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 testSetPlayerImg() throws Exception, NoSuchAlgorithmException, URISyntaxException {
LiveSetPlayerImgRequest liveSetChatAdminDataRequest = new LiveSetPlayerImgRequest();
Boolean liveSetChatAdminDataResponse = null;
try {
String channelId = super.createChannel();
liveSetChatAdminDataRequest.setChannelId(channelId)
.setCoverImage("https://car3.autoimg.cn/cardfs/product/g25/M08/C7/57" +
"/1024x0_1_q95_autohomecar__ChsEmF8EOK-AB5uaAAfsj_iwPdE906.jpg")
.setCoverHref("http://www.baidu.com");
liveSetChatAdminDataResponse = new LivePlayerServiceImpl().setPlayerImg(liveSetChatAdminDataRequest);
Assert.assertNotNull(liveSetChatAdminDataResponse);
if (liveSetChatAdminDataResponse) {
//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 |
| coverImage | true | String | URL of the warm-up image. Recommended image size: 800x450. Supports PNG, JPEG, and GIF formats. |
| coverHref | false | String | Browser redirect URL when the warm-up image is clicked. |
| 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 success, false indicates failure
3. Setting the Player's Warm-up Video
Description
1、修改播放器的暖场视频
2、暖场视频和暖场图片是处于非直播状态时,播放器显示的画面,两者在同一时间只能显示一种,以最晚设置者为准,若想删除暖场画面,则将coverImage或warmUpFlv的值设为"http://"。
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/update
Call Constraints
- The API call is subject to rate limits. See details. For common call exceptions, see details.
Unit Testing
@Test
public void testSetPlayerWarmUpVedio() throws Exception, NoSuchAlgorithmException, URISyntaxException {
LiveSetWarmupVedioRequest liveSetWarmupVedioRequest = new LiveSetWarmupVedioRequest();
Boolean liveSetWarmupVedioResponse = null;
try {
String channelId = super.createChannel();
liveSetWarmupVedioRequest.setChannelId(channelId)
.setWarmUpFlv("http://www.w3school.com.cn/example/html5/mov_bbb.mp4");
// .setWarmUpFlv("http://")//删除视频
liveSetWarmupVedioResponse = new LivePlayerServiceImpl().setPlayerWarmUpVedio(liveSetWarmupVedioRequest);
Assert.assertNotNull(liveSetWarmupVedioResponse);
if (liveSetWarmupVedioResponse != null) {
//to do something ......
log.debug("测试设置播放器暖场视频成功{}", JSON.toJSONString(liveSetWarmupVedioResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| warmUpFlv | true | String | Warm-up video URL (HTTP address). Mobile devices do not support FLV video files; MP4 video files are recommended. |
| 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: 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: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
true indicates success, false indicates failure
4. Setting the Player Logo
Description
设置播放器Logo
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/update
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 testSetPlayerLogo() throws Exception, NoSuchAlgorithmException, URISyntaxException {
LiveSetPlayerLogoRequest liveSetPlayerLogoRequest = new LiveSetPlayerLogoRequest();
Boolean liveSetPlayerLogoResponse = null;
try {
String channelId = super.createChannel();
liveSetPlayerLogoRequest.setChannelId(channelId)
.setLogoHref("http://www.baidu.com")
.setLogoPosition(LiveConstant.LogoPosition.BL.getPosition())
.setLogoImage(
"https://c-ssl.duitang.com/uploads/blog/202009/01/20200901155255_e8037.thumb.1000_0.jpg")
.setLogoOpacity(0.32f);
liveSetPlayerLogoResponse = new LivePlayerServiceImpl().setPlayerLogo(liveSetPlayerLogoRequest);
Assert.assertNotNull(liveSetPlayerLogoResponse);
if (liveSetPlayerLogoResponse != null) {
//to do something ......
log.debug("测试设置播放器Logo成功{}", JSON.toJSONString(liveSetPlayerLogoResponse));
}
} 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| logoImage | true | String | Logo image URL. Recommended size: rectangle 140x50 or square 50x50 |
| logoOpacity | true | Float | Logo opacity, value range (0,1], i.e., greater than 0 and less than or equal to 1 |
| logoPosition | true | String | Logo position. Values: top-left (tl), top-right (tr), bottom-left (bl), bottom-right (br) |
| logoHref | false | String | Click-through link for the logo image |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is invoked 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 invoked to set up multi-account calls). Obtain by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates success, false indicates failure.
5. Setting Pre-Roll Ads for the Player
Description
设置某频道播放器的片头广告
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelAdvert/%s/updateHead
Call Constraints
The API call is subject to rate limits. Click here for details. For common call exceptions, click here for details.
Setting a pre-roll ad does not guarantee it will be displayed. You need to call the Set Channel Default Item Switch to turn off the general ad settings switch.
Unit Test
@Test
public void testSetPlayerHeaderAdvert() throws Exception, NoSuchAlgorithmException, URISyntaxException {
LiveSetPlayerHeaderAdvertRequest liveSetPlayerHeaderAdvertRequest = new LiveSetPlayerHeaderAdvertRequest();
Boolean liveSetPlayerHeaderAdvertResponse = null;
try {
String channelId = super.createChannel();
liveSetPlayerHeaderAdvertRequest.setChannelId(channelId)
.setEnabled(LiveConstant.Flag.YES.getFlag())
.setHeadAdvertDuration(5)
.setHeadAdvertHeight(100)
.setHeadAdvertType(LiveConstant.HeadAdvertType.IMAGE.getDesc())
.setHeadAdvertWidth(100)
.setHeadAdvertHref("http://www.baidu.com")
.setHeadAdvertMediaUrl("https://car3.autoimg.cn/cardfs/product/g25/M08/C7/57" +
"/1024x0_1_q95_autohomecar__ChsEmF8EOK-AB5uaAAfsj_iwPdE906.jpg");
liveSetPlayerHeaderAdvertResponse = new LivePlayerServiceImpl().setPlayerHeaderAdvert(
liveSetPlayerHeaderAdvertRequest);
Assert.assertNotNull(liveSetPlayerHeaderAdvertResponse);
if (liveSetPlayerHeaderAdvertResponse != null) {
//to do something ......
log.debug("测试设设置播放器片头广告成功{}", JSON.toJSONString(liveSetPlayerHeaderAdvertResponse));
}
} 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. 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 Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| enabled | false | String | Set the player pre-roll ad switch: Y-Enable, N-Disable |
| headAdvertType | false | String | Ad type, NONE-No ad, IMAGE-Image ad, FLV-Video ad |
| headAdvertMediaUrl | false | String | Ad media URL |
| headAdvertHref | false | String | Ad click-through URL |
| headAdvertDuration | false | Integer | Ad duration, in seconds |
| headAdvertWidth | false | Integer | Ad width |
| headAdvertHeight | false | Integer | Ad height |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates success, false indicates failure
6. Setting Player Pause Ads
Description
用于设置某频道播放器的暂停广告
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelAdvert/%s/updateStop
Call Constraints
API calls are subject to rate limits. See details. For common call exceptions, see details.
Setting a pause ad does not guarantee it will be displayed. You need to call the "Set Channel Default Item Switch" to turn off the general ad setting switch.
Unit Test
@Test
public void testSetPlayerPauseAdvert() throws Exception, NoSuchAlgorithmException, URISyntaxException {
LiveSetPlayerPauseAdvertRequest liveSetPlayerPauseAdvertRequest = new LiveSetPlayerPauseAdvertRequest();
Boolean liveSetPlayerPauseAdvertResponse = null;
try {
String channelId = super.createChannel();
liveSetPlayerPauseAdvertRequest.setChannelId(channelId)
.setEnabled(LiveConstant.Flag.YES.getFlag())
.setStopAdvertHref("http://www.baidu.com")
.setStopAdvertImage("https://car3.autoimg.cn/cardfs/product/g25/M08/C7/57" +
"/1024x0_1_q95_autohomecar__ChsEmF8EOK-AB5uaAAfsj_iwPdE906.jpg");
liveSetPlayerPauseAdvertResponse = new LivePlayerServiceImpl().setPlayerPauseAdvert(
liveSetPlayerPauseAdvertRequest);
Assert.assertNotNull(liveSetPlayerPauseAdvertResponse);
if (liveSetPlayerPauseAdvertResponse != null) {
//to do something ......
log.debug("测试设置播放器暂停广告成功{}", JSON.toJSONString(liveSetPlayerPauseAdvertResponse));
}
} 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 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 |
| enabled | false | String | Set the player pause ad switch: Y - enable, N - disable |
| stopAdvertImage | false | String | Image URL; leave blank to delete |
| stopAdvertHref | false | String | URL to redirect when the image is clicked |
| 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 success, false indicates failure
7. Setting Custom URL Marquee for Player
Description
可以设置播放器防录屏自定义url跑马灯开关,在开启时需提交url参数。
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelRestrict/%s/set-diyurl-marquee
Call Constraints
- API calls are subject to frequency limits. See details. For common call exceptions, see details.
Unit Testing
@Test
public void testSetPlayerUrlMarquee() throws Exception, NoSuchAlgorithmException, URISyntaxException {
LiveSetPlayerUrlMarqueeRequest liveSetPlayerUrlMarqueeRequest = new LiveSetPlayerUrlMarqueeRequest();
Boolean liveSetPlayerUrlMarqueeResponse;
try {
String channelId = super.createChannel();
liveSetPlayerUrlMarqueeRequest.setChannelId(channelId).setMarqueeRestrict("Y").setUrl("https://polyv.net");
liveSetPlayerUrlMarqueeResponse = new LivePlayerServiceImpl().setPlayerUrlMarquee(
liveSetPlayerUrlMarqueeRequest);
Assert.assertTrue(liveSetPlayerUrlMarqueeResponse);
if (liveSetPlayerUrlMarqueeResponse) {
//to do something ......
log.debug("测试设置播放器自定义url跑马灯成功");
}
} 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 |
|---|---|---|---|
| channelId | true | String | Channel ID |
| marqueeRestrict | true | String | Custom URL anti-screen-recording marquee switch, Y or N |
| url | false | String | Custom URL, can be empty when the switch is off, required when the switch is on |
| 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. Path: 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. Path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates success, false indicates failure
8. Setting Channel Screen Recording Protection Information
Description
通过频道号,设置频道防录屏信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/anti/record/setting
Call Constraints
- The API call is subject to rate limits. See details. For common call exceptions, see details.
Unit Testing
@Test
public void testSetLiveAntiRecode() throws Exception, NoSuchAlgorithmException {
LiveSetAntiRecordRequest liveSetAntiRecordRequest = new LiveSetAntiRecordRequest();
Boolean liveSetAntiRecordResponse;
try {
String channelId = super.createChannel();
liveSetAntiRecordRequest.setChannelId(channelId)
.setEnable(LiveConstant.Flag.YES.getFlag())
.setAntiRecordType(LiveConstant.AntiRecordType.MARQUEE.getValue())
.setModelType(LiveConstant.ModelType.Fixed.getValue())
.setContent("测试固定跑马灯")
.setFontSize("30")
.setOpacity(70)
.setFontColor("#FFF")
.setAutoZoomEnabled(LiveConstant.Flag.YES.getFlag())
.setDoubleEnabled(LiveConstant.Flag.NO.getFlag())
.setShowMode(LiveConstant.ShowMode.FLICKER.getValue());
liveSetAntiRecordResponse = new LivePlayerServiceImpl().setLiveAntiRecord(liveSetAntiRecordRequest);
Assert.assertTrue(liveSetAntiRecordResponse);
if (liveSetAntiRecordResponse) {
//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, 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 |
| antiRecordType | true | String | Anti-recording method: marquee (scrolling text) or watermark |
| modelType | true | String | Anti-recording type. Setting a custom URL is invalid when using the watermark method. fixed: fixed value, nickname: login username, diyurl: custom URL marquee |
| content | false | String | For fixed value: the content to set. For custom URL: the URL, must include http:// or https://. [Reference documentation for custom marquee]. Can be omitted when the anti-recording type is login username. |
| fontSize | true | String | Font size. For marquee: set a numeric value, range 1-256. For watermark: small, middle, or large |
| opacity | false | Integer | Opacity, default is 80 if not provided. Range 0-100, where 0 is opaque |
| fontColor | false | String | Marquee font color, e.g., #FFFFFF |
| autoZoomEnabled | false | String | Enable custom marquee zoom. Default is off. Y: enable, N: disable |
| doubleEnabled | false | String | Enable dual marquee. Default is off. Y: enable, N: disable |
| showMode | false | String | Marquee display mode. Default is scrolling. roll: scrolling, flicker: flickering |
| enable | false | String | Anti-recording toggle. Default is on. Y: enable, N: disable |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain by registering on the POLYV official website: Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain by registering on the POLYV official website: Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates success, false indicates failure
9. Query Channel Screen Recording Protection Information
Description
通过频道号,查询频道防录屏信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/anti/record/get
Call Constraints
- The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testGetLiveAntiRecode() throws Exception, NoSuchAlgorithmException {
LiveGetAntiRecordRequest liveGetAntiRecordRequest = new LiveGetAntiRecordRequest();
LiveGetAntiRecordResponse liveGetAntiRecordResponse;
try {
String channelId = super.createChannel();
liveGetAntiRecordRequest.setChannelId(channelId);
liveGetAntiRecordResponse = new LivePlayerServiceImpl().getLiveAntiRecord(liveGetAntiRecordRequest);
Assert.assertNotNull(liveGetAntiRecordResponse);
if (liveGetAntiRecordResponse != null) {
//to do something ......
log.debug("测试查询频道防录屏信息成功{}", JSON.toJSONString(liveGetAntiRecordResponse));
}
} 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
LiveGetAntiRecordResponseobject is returned. Party B 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 | false | String | Channel ID. If provided, queries the anti-screen recording information for the channel. If not provided, queries the default anti-screen recording template for the 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 |
|---|---|---|
| antiRecordType | String | Anti-recording method: marquee (scrolling text), watermark |
| modelType | String | Anti-recording type: fixed (fixed value), nickname (login username), diyurl (custom URL) |
| content | String | For fixed type: the set content; for custom URL type: the URL |
| opacity | Integer | Opacity, value range 0-100, 0 is opaque |
| fontSize | String | Font size. For marquee anti-recording: set a value, range 1-256. For watermark anti-recording: small, middle, large |
| fontColor | String | Marquee font color (color value). Not returned for watermark mode |
| autoZoomEnabled | String | Marquee custom zoom. Not returned for watermark mode. Y: Enabled, N: Disabled |
| doubleEnabled | String | Double marquee. Not returned for watermark mode. Y: Enabled, N: Disabled |
| showMode | String | Marquee display mode. Not returned for watermark mode. roll: Scrolling, flicker: Flashing |
10. Query Complaint Feedback
Description
查询投诉反馈
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/feedback/list
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 testGetWatchFeedbackList() throws IOException, NoSuchAlgorithmException {
LiveGetWatchFeedbackListRequest liveGetWatchFeedbackListRequest = new LiveGetWatchFeedbackListRequest();
LiveGetWatchFeedbackListResponse liveGetWatchFeedbackListResponse;
try {
String channelId = super.createChannel();
liveGetWatchFeedbackListRequest.setChannelId(channelId);
liveGetWatchFeedbackListResponse = new LivePlayerServiceImpl().getWatchFeedbackList(
liveGetWatchFeedbackListRequest);
Assert.assertNotNull(liveGetWatchFeedbackListResponse);
if (liveGetWatchFeedbackListResponse != null) {
//to do something ......
log.debug("测试查询投诉反馈成功 {}", JSON.toJSONString(liveGetWatchFeedbackListResponse));
}
} 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
LiveGetWatchFeedbackListResponseobject, 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 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, queries data under the user. |
| pageNumber | false | Integer | Page number for pagination, default is 1. |
| pageSize | false | Integer | Page size for pagination, default is 10, maximum is 1000. |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). 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 for multi-account setup). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| contents | Array | Content of the current page [See FeedbackInfo Parameter Description] |
| pageSize | Integer | Number of data items displayed per page, default is 20 |
| 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] |
FeedbackInfo Parameter Description
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Complaint/Feedback ID |
| channelId | String | Channel ID |
| type | String | Complaint/Feedback type: suggestion (feedback), complaint |
| label | String | Category: stuck (page lag), black-screen (black screen), slow-access (slow access), poor-experience (poor experience), play-suggestion (gameplay suggestion), other-feedback (other feedback), porn (pornographic/vulgar), politics (political), drug (drug-related), bloody (bloody/horror), scam (fraud), other-violations (other violations) |
| content | String | Content |
| imageUrls | Array | List of image URLs |
| createTime | Date | Creation time |
| updateTime | Date | Update time |
