Polyv Help Center

Help Center

webSetting

Updated: 2025-09-11 15:18:09

1. Set Channel Default Item Switch

Description

设置频道默认项开关
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/common/update-global-enabled

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testSetChannelGlobalSwitch() throws Exception, NoSuchAlgorithmException {
        LiveChannelGlobalSwitchRequest liveChannelGlobalSwitchRequest = new LiveChannelGlobalSwitchRequest();
        Boolean liveChannelGlobalSwitchResponse;
        try {
            liveChannelGlobalSwitchRequest.setChannelId(createChannel())
                    .setGlobalEnabledType(LiveConstant.GlobalEnabledType.CALLBACK.getDesc())
                    .setEnabled("N");
            liveChannelGlobalSwitchResponse = new LiveWebSettingServiceImpl().setChannelGlobalSwitch(
                    liveChannelGlobalSwitchRequest);
            Assert.assertNotNull(liveChannelGlobalSwitchResponse);
            if (liveChannelGlobalSwitchResponse) {
                //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

  1. If the request is correct, a Boolean object is returned, and the B-end processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].

  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
globalEnabledType true String Function type
auth: Viewing condition settings; Viewing page management - Viewing conditions
switch: Feature switch settings; Live room management - Feature switches
marquee: Marquee settings; Player management - Anti-screen recording marquee
restrict: Playback restriction settings; Player management - Playback restrictions
donate: Donation settings; Viewing page management - Donation settings
advert: Ad settings; Viewing page management - Marketing settings - Ads
callback: Callback settings;
player: Player settings
enabled true String Feature switch
Y: Enable
N: Disable
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 successful setting, false indicates failure.




2. Upload Image Resource

Description

接口用于上传接口所需图片,同时获取图片地址。图片地址可用于 设置道具打赏 goodImg字段等。
接口地址(仅做说明使用):https://api.polyv.net/live/v3/common/upload-image

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testUploadImage() throws Exception, NoSuchAlgorithmException {
        LiveUploadImageRequest liveUploadImageRequest = new LiveUploadImageRequest();
        LiveUploadImageResponse liveUploadImageResponse;
        try {
            String path = getClass().getResource("/img/elephant.png").getPath();
            List<File> fileList = new ArrayList<File>();
            fileList.add(new File(path));
            liveUploadImageRequest.setType("coverImage")
                    .setFile(fileList);
            liveUploadImageResponse = new LiveWebSettingServiceImpl().uploadImage(
                    liveUploadImageRequest);
            Assert.assertNotNull(liveUploadImageResponse);
            if (liveUploadImageResponse != null) {
                //to do something ......
                log.debug("测试上传图片资源成功,{}",liveUploadImageResponse);
            }
        } 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

  1. If the request is correct, a LiveUploadImageResponse object is returned, and the B-end processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].

  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
type true String Upload image type
coverImage: Channel icon, recommended size 140 x 140, file size not exceeding 2M.
splashImage: Live stream guide image, recommended size 750 x 1334, file size not exceeding 2M.
logoImage: Player logo, recommended size not exceeding 140 x 50, file size not exceeding 2M.
adminAvatar: Chat room admin avatar, recommended size 140 x 140, file size not exceeding 2M.
assistantAvatar: Assistant avatar, recommended size 140 x 140, file size not exceeding 2M.
authCodeImage: Authorized viewing QR code image, maximum size not exceeding 200K.
warmImage: Warm-up image, recommended size 1280 x 720, file size not exceeding 2M.
adImage: Ad banner image, recommended size 750 x 120, maximum size not exceeding 2M.
startAdImage: Pre-roll ad image, recommended size 1280 x 720, file size not exceeding 4M.
stopAdImage: Pause ad image, recommended size 1280 x 720, file size not exceeding 4M.
goodImage: Donation icon, recommended size 180 x 180, file size not exceeding 300K.
invitationImage: Invitation card image, recommended size 750 x 1334, file size not exceeding 4M.
menuImage: Channel menu image, maximum size not exceeding 2M.
file true Array List of image files, supports uploading up to 6 files simultaneously
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

Parameter Name Type Description
imgUrls Array List of image URL links

联系客服,在线咨询