保利威文档中心

帮助中心

playerService

更新时间:2025-09-11 15:18:09

1、设置频道的暖场设置开关

描述

用于设置频道的暖场开关
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/set-warmup-enabled

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
warmUpEnabled true String 开关值,Y或N,Y表示开启,N表示关闭
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

true 设置成功 , false 设置失败




2、设置播放器暖场图片

描述

1、修改播放器的暖场图片
2、暖场视频和暖场图片是处于非直播状态时,播放器显示的画面,两者在同一时间只能显示一种,以最晚设置者为准,若想删除暖场画面,则将coverImage或warmUpFlv的值设为"http://"。
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/update

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
coverImage true String 暖场图片地址,图片大小建议:800x450,支持PNG、JPEG、GIF格式
coverHref false String 点击暖场图片后浏览器跳转地址
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

true 设置成功 , false 设置失败




3、设置播放器暖场视频

描述

1、修改播放器的暖场视频
2、暖场视频和暖场图片是处于非直播状态时,播放器显示的画面,两者在同一时间只能显示一种,以最晚设置者为准,若想删除暖场画面,则将coverImage或warmUpFlv的值设为"http://"。
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/update

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
warmUpFlv true String 暖场视频地址(http地址),移动端不支持FLV视频文件,建议使用MP4视频文件
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

true 设置成功,false 设置失败




描述

设置播放器Logo
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/update

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
logoImage true String logo图片地址,建议大小为:长方形140x50或正方形50x50
logoOpacity true Float logo透明度,取值范围为(0,1],即大于0,并且小于等于1
logoPosition true String logo位置,取值为为左上角(tl)、右上角(tr)、左下角(bl)、右下角(br)
logoHref false String logo图片点击跳转链接
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

true 设置成功, fales 设置失败




5、设置播放器片头广告

描述

设置某频道播放器的片头广告
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelAdvert/%s/updateHead

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

2、设置片头广告并不一定会展示,需要调用 设置频道默认项开关 把广告通用设置开关关闭

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
enabled false String 设置播放器片头广告开关: Y-开启,N-关闭
headAdvertType false String 广告类型,NONE-无广告,IMAGE-图片广告,FLV-视频广告
headAdvertMediaUrl false String 广告地址
headAdvertHref false String 广告跳转地址
headAdvertDuration false Integer 广告时长,单位:秒
headAdvertWidth false Integer 广告宽度
headAdvertHeight false Integer 广告高度
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

true 设置成功,false 设置失败




6、设置播放器暂停广告

描述

用于设置某频道播放器的暂停广告
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelAdvert/%s/updateStop

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

2、设置暂停广告并不一定会展示,需要调用 设置频道默认项开关 把广告通用设置开关关闭

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
enabled false String 设置播放器暂停广告开关:Y-打开,N-关闭
stopAdvertImage false String 图片地址,不填代表删除
stopAdvertHref false String 点击图片跳转Url
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

true 设置成功,false 设置失败




7、设置播放器自定义url跑马灯

描述

可以设置播放器防录屏自定义url跑马灯开关,在开启时需提交url参数。
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelRestrict/%s/set-diyurl-marquee

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
marqueeRestrict true String 自定义url防录屏跑马灯开关,Y或N
url false String 自定义url, 在开关为关时可为空,开启开关时为必填
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

true 设置成功,false 设置失败




8、设置频道防录屏信息

描述

通过频道号,设置频道防录屏信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/anti/record/setting

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId true String 频道号
antiRecordType true String 防录屏方式 marquee:跑马灯 watermark:水印
modelType true String 防录屏类型,水印方式时设置自定义URL无效 fixed:固定值 nickname:登录用户名 diyurl:URL自定义跑马灯
content false String 固定值时为设置内容 URL自定义设置时为网址,需要携带 http:// 或 https:// 【自定义跑马灯参考文档】 防录屏类型为登录用户名时可不传
fontSize true String 字体大小 防录屏方式为跑马灯时:设置数值,范围1-256 防录屏方式为水印时: small:小 middle:中 large:大
opacity false Integer 透明度,不传默认为80,范围0-100,0为不透明
fontColor false String 跑马灯字体颜色,色值,例如:#FFFFFF
autoZoomEnabled false String 跑马灯自定义缩放,默认为关闭 Y:开启 N:关闭
doubleEnabled false String 双跑马灯,默认为关闭 Y:开启 N:关闭
showMode false String 跑马灯显示方式,默认为滚动 roll:滚动 flicker:闪烁
enable false String 防录屏开关,默认为开启 Y:开启 N:关闭
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

true 设置成功,false 设置失败




9、查询频道防录屏信息

描述

通过频道号,查询频道防录屏信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/anti/record/get

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回LiveGetAntiRecordResponse对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId false String 频道号 传入频道号,查询频道防录屏信息 不传频道号,查询账号防录屏默认模板
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
antiRecordType String 防录屏方式 marquee:跑马灯 watermark:水印
modelType String 防录屏类型 fixed:固定值 nickname:登录用户名 diyurl:URL自定义设置
content String 固定值时为设置内容 URL自定义设置时为网址
opacity Integer 透明度,取值0-100,0为不透明
fontSize String 字体大小 防录屏方式为跑马灯时,设置数值,范围1-256 防录屏方式为水印时 small:小 middle:中 large:大
fontColor String 跑马灯字体颜色,色值,水印时不返回此参数
autoZoomEnabled String 跑马灯自定义缩放,水印时不返回此参数 Y:开启 N:关闭
doubleEnabled String 双跑马灯,水印时不返回此参数 Y:开启 N:关闭
showMode String 跑马灯显示方式,水印时不返回此参数 roll:滚动 flicker:闪烁






10、查询投诉反馈

描述

查询投诉反馈
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/feedback/list

调用约束

1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看

单元测试

    @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;
        }
    }

单元测试说明

1、请求正确,返回LiveGetWatchFeedbackListResponse对象,B端依据此对象处理业务逻辑;

2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]

3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]

请求入参描述

参数名 必选 类型 说明
channelId false String 频道号,不传则查询用户下的数据
pageNumber false Integer 分页页码,默认1
pageSize false Integer 分页大小,默认10,最大不超过1000
appId false String POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)
appSecret false String POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置)

返回对象描述

参数名 类型 说明
contents Array 当前页内容【详见FeedbackInfo参数描述
pageSize Integer 每页显示的数据条数,默认每页显示20条数据
currentPage Integer 当前页【对应api文档的pageNumber字段】
totalItems Integer 记录总条数
totalPage Integer 总页数【对应api文档的totalPages字段】
FeedbackInfo参数描述
参数名 类型 说明
id Integer 投诉反馈ID
channelId String 频道号
type String 投诉反馈类型 suggestion:反馈意见 complaint:投诉
label String 所属分类 stuck:页面卡顿 black-screen:画面黑屏 slow-access:访问缓慢 poor-experience:体验不好 play-suggestion:玩法建议 other-feedback:其他反馈 porn:色情低俗 politics:涉政 drug:涉毒 bloody:恐怖血腥 scam:诈骗 other-violations:其他违规
content String 内容
imageUrls Array 图片URL列表
createTime Date 创建时间
updateTime Date 更新时间

联系客服,在线咨询