Polyv Help Center

Help Center

channelAdvanced

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

1. Query Channel Subtitle Configuration

Description

查询频道字幕配置信息
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/subtitle/config/get

Call Constraints

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

Unit Test

    @Test
    public void testGetLiveChannelRealtimeSubtitle() throws IOException, NoSuchAlgorithmException {
        LiveChannelRealtimeSubtitleRequest liveChannelRealtimeSubtitleRequest =
                new LiveChannelRealtimeSubtitleRequest();
        LiveChannelRealtimeSubtitleResponse liveChannelRealtimeSubtitleResponse;
        try {
            liveChannelRealtimeSubtitleRequest.setChannelId(super.getAloneChannelId());
            liveChannelRealtimeSubtitleResponse = new LiveChannelAdvancedServiceImpl().getConfig(
                    liveChannelRealtimeSubtitleRequest);
            Assert.assertNotNull(liveChannelRealtimeSubtitleResponse);
            if (liveChannelRealtimeSubtitleResponse != null) {
                //to do something ......
                log.debug("测试查询频道字幕配置信息成功 {}", JSON.toJSONString(liveChannelRealtimeSubtitleResponse));
            }
        } 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. On a successful request, a LiveChannelRealtimeSubtitleResponse object is returned. The B-end processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. Error details are available via PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].

  3. If the server encounters an error, a PloyvSdkException is thrown. Error details are available via PloyvSdkException.getMessage(), e.g., [Error in data returned by Polyv request. Request流水号: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the official Polyv website: Official Site -> Login -> Live (Development Settings).
appSecret false String POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the official Polyv website: Official Site -> Login -> Live (Development Settings).

Response Object Description

Parameter Type Description
realTimeSubtitleEnabled String Real-time subtitle toggle: Y = Enabled, N = Disabled
sourceLanguage String Source subtitle language: Chinese or English
subtitleTranslationEnabled String Subtitle translation toggle: Y = Enabled, N = Disabled
translationLanguage String Subtitle translation language: Chinese, English, etc. Refer to new LiveChannelAdvancedServiceImpl().getLanguage() for mapping.
realTimeSubtitleDisplayNumberLimitEnabled String Real-time subtitle display count limit toggle: Y = Enabled, N = Disabled
realTimeSubtitleDisplayNumber Integer Maximum number of real-time subtitles displayed






2. Modify Channel Subtitle Configuration

Description

修改频道字幕配置信息
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/subtitle/config/update

Call Constraints

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

Unit Test

    @Test
    public void testLiveUpdateChannelRealtimeSubtitle() throws IOException, NoSuchAlgorithmException {
        LiveUpdateChannelRealtimeSubtitleRequest liveUpdateChannelRealtimeSubtitleRequest =
                new LiveUpdateChannelRealtimeSubtitleRequest();
        Boolean liveUpdateChannelRealtimeSubtitleResponse;
        try {
            liveUpdateChannelRealtimeSubtitleRequest.setChannelId(super.getAloneChannelId())
                    .setRealTimeSubtitleEnabled("Y")
                    .setSubtitleTranslationEnabled("Y")
                    .setSourceLanguage("Chinese")
                    .setTranslationLanguage("English")
                    .setRealTimeSubtitleDisplayNumber(20);
            liveUpdateChannelRealtimeSubtitleResponse = new LiveChannelAdvancedServiceImpl().updateConfig(
                    liveUpdateChannelRealtimeSubtitleRequest);
            Assert.assertNotNull(liveUpdateChannelRealtimeSubtitleResponse);
            if (liveUpdateChannelRealtimeSubtitleResponse != null) {
                //to do something ......
                log.debug("测试修改频道字幕配置信息成功 {}", liveUpdateChannelRealtimeSubtitleResponse);
            }
        } 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. On a successful request, a Boolean object is returned. The B-end processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. Error details are available via PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].

  3. If the server encounters an error, a PloyvSdkException is thrown. Error details are available via PloyvSdkException.getMessage(), e.g., [Error in data returned by Polyv request. Request流水号: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
realTimeSubtitleEnabled false String Real-time subtitle toggle: Y = Enabled, N = Disabled
sourceLanguage false String Source subtitle language: Chinese or English
subtitleTranslationEnabled false String Subtitle translation toggle: Y = Enabled, N = Disabled
translationLanguage false String Subtitle translation language: Chinese, English, etc. Refer to new LiveChannelAdvancedServiceImpl().getLanguage() for mapping.
realTimeSubtitleDisplayNumberLimitEnabled false String Real-time subtitle display count limit toggle: Y = Enabled, N = Disabled
realTimeSubtitleDisplayNumber false Integer Maximum number of real-time subtitles displayed. Must be between 5 and 20. Recommended values: 5, 10, or 20.
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the official Polyv website: Official Site -> Login -> Live (Development Settings).
appSecret false String POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the official Polyv website: Official Site -> Login -> Live (Development Settings).

Response Object Description

Entity returned after modifying channel subtitle configuration.




3. Query Real-Time Subtitle Language Type Enumeration

Description

查询实时字幕语言类型枚举
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/subtitle/language/list-all

Call Constraints

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

Unit Test

    @Test
    public void testGetLiveChannelRealtimeSubtitleLanguage() throws IOException, NoSuchAlgorithmException {
        LiveChannelRealtimeSubtitleLanguageRequest liveChannelRealtimeSubtitleRequest =
                new LiveChannelRealtimeSubtitleLanguageRequest();
        List<LiveChannelRealtimeSubtitleLanguageResponse> liveChannelRealtimeSubtitleLanguageResponse;
        try {
            liveChannelRealtimeSubtitleLanguageResponse = new LiveChannelAdvancedServiceImpl().getLanguage(
                    liveChannelRealtimeSubtitleRequest);
            Assert.assertNotNull(liveChannelRealtimeSubtitleLanguageResponse);
            if (liveChannelRealtimeSubtitleLanguageResponse != null) {
                //to do something ......
                log.debug("查询实时字幕语言类型枚举 {}", JSON.toJSONString(liveChannelRealtimeSubtitleLanguageResponse));
            }
        } 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. On a successful request, a LiveChannelRealtimeSubtitleLanguageResponse object is returned. The B-end processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. Error details are available via PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].

  3. If the server encounters an error, a PloyvSdkException is thrown. Error details are available via PloyvSdkException.getMessage(), e.g., [Error in data returned by Polyv request. Request流水号: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]

Request Parameter Description

Parameter Required Type Description
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the official Polyv website: Official Site -> Login -> Live (Development Settings).
appSecret false String POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the official Polyv website: Official Site -> Login -> Live (Development Settings).

Response Object Description

The response object is a List<LiveChannelRealtimeSubtitleLanguageResponse>. The specific elements of LiveChannelRealtimeSubtitleLanguageResponse are as follows:

Parameter Type Description
code String Language code, e.g., Chinese
text String Chinese description of the language code, e.g., 中文

联系客服,在线咨询