Polyv Help Center

Help Center

channelState

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

1. Query Channel Real-Time Streaming Information

Description

查询频道实时推流信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/monitor/get-stream-info

Call Constraints

  1. API calls are subject to rate limits. Click here for details. For common call exceptions, click here.

  2. If the instructor has not entered the live room or has not started the class, a "channel status not live" exception will be thrown.

Unit Test

    @Test
    public void testGetChannelStreamInfo() throws Exception, NoSuchAlgorithmException {
        LiveChannelStreamInfoRequest liveChannelStreamInfoRequest = new LiveChannelStreamInfoRequest();
        LiveChannelStreamInfoResponse liveChannelStreamInfoResponse;
        try {
            liveChannelStreamInfoRequest.setChannelId(createChannel());
            liveChannelStreamInfoResponse = new LiveChannelStateServiceImpl().getChannelStreamInfo(
                    liveChannelStreamInfoRequest);
            Assert.assertNotNull(liveChannelStreamInfoResponse);
            if (liveChannelStreamInfoResponse != null) {
                //to do something ......
                log.debug("批量查询频道直播流状态成功{}", JSON.toJSONString(liveChannelStreamInfoResponse));
            }
        } 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 LiveChannelStreamInfoResponse object is returned. 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 exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data, 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. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from 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). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

Parameter Name Type Description
deployAddress String IP address of the pushed CDN node, may be null
inAddress String Push stream egress IP, may be null
streamName String Stream name
fps String Push stream frame rate
lfr String Push stream frame loss rate, may be null
inBandWidth String Push stream bitrate






2. Batch Query Channel Live Stream Status

Description

批量查询频道直播流状态
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/live-status

Call Constraints

  1. API calls are subject to rate limits. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testListChannelLiveStream() throws Exception, NoSuchAlgorithmException {
        LiveListChannelStreamStatusRequest liveListChannelStreamStatusRequest =
                new LiveListChannelStreamStatusRequest();
        LiveListChannelStreamStatusResponse liveListChannelStreamStatusResponse;
        try {
            //准备测试数据
            String channelId0 = super.createChannel();
            String channelId1 = getAloneChannelId();
            liveListChannelStreamStatusRequest.setChannelIds(String.format("%s,%s", channelId0, channelId1));
            liveListChannelStreamStatusResponse = new LiveChannelStateServiceImpl().listChannelLiveStream(
                    liveListChannelStreamStatusRequest);
            Assert.assertNotNull(liveListChannelStreamStatusResponse);
            if (liveListChannelStreamStatusResponse != null) {
                //to do something ......
                log.debug("批量查询频道直播流状态成功{}", JSON.toJSONString(liveListChannelStreamStatusResponse));
            }
        } 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 LiveListChannelStreamStatusResponse object is returned. 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 exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
channelIds true String Comma-separated channel IDs, e.g., 10000,100001. Maximum 20.
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from 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). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

Parameter Name Type Description
channelInfo Array Channel information [See LiveChannelStreamStatusResponse Parameter Description for details]
LiveChannelStreamStatusResponse Parameter Description
Parameter Name Type Description
channelId String Channel ID
status String Live stream status of the channel, string value includes: live, end






3. Forbid Live Channel Push Stream

Description

禁止直播频道推流
接口地址(仅做说明使用):https://api.polyv.net/live/v2/stream/%s/cutoff

Call Constraints

  1. API calls are subject to rate limits. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testCutoffChannelStream() throws Exception, NoSuchAlgorithmException {
        LiveCutoffChannelStreamRequest liveCutoffChannelStreamRequest = new LiveCutoffChannelStreamRequest();
        Boolean liveCutoffChannelStreamResponse;
        try {
            //准备测试数据
            String channelId = super.createChannel();
            liveCutoffChannelStreamRequest.setChannelId(channelId);
            liveCutoffChannelStreamResponse = new LiveChannelStateServiceImpl().cutoffChannelStream(
                    liveCutoffChannelStreamRequest);
            Assert.assertNotNull(liveCutoffChannelStreamResponse);
            if (liveCutoffChannelStreamResponse) {
                //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. 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 exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
userId false String POLYV user ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).
channelId true String Channel ID
forbidTime false Date Forbidden end date. Maximum forbidden period is 90 days. Default is 24 hours if not provided.
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from 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). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

true indicates successful forbidding of push stream, false indicates failure.




4. Resume Live Channel Push Stream

Description

恢复直播频道推流
接口地址(仅做说明使用):https://api.polyv.net/live/v2/stream/%s/resume

Call Constraints

  1. API calls are subject to rate limits. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testResumeChannelStream() throws Exception, NoSuchAlgorithmException {
        LiveResumeChannelStreamRequest liveResumeChannelStreamRequest = new LiveResumeChannelStreamRequest();
        Boolean liveResumeChannelStreamResponse;
        try {
            //准备测试数据
            String channelId = super.createChannel();
            liveResumeChannelStreamRequest.setChannelId(channelId);
            liveResumeChannelStreamResponse = new LiveChannelStateServiceImpl().resumeChannelStream(
                    liveResumeChannelStreamRequest);
            Assert.assertNotNull(liveResumeChannelStreamResponse);
            if (liveResumeChannelStreamResponse) {
                //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. 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 exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
userId false String POLYV user ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).
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 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). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

true indicates successful resumption, false indicates failure.




5. Set Channel Stream Status to Live

Description

设置频道流状态为直播中
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/live

Call Constraints

  1. API calls are subject to rate limits. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testSetChannelStreamLive() throws Exception, NoSuchAlgorithmException {
        LiveChannelStreamLiveRequest liveChannelStreamLiveRequest = new LiveChannelStreamLiveRequest();
        Boolean liveChannelStreamLiveResponse;
        try {
            //准备测试数据
            String channelId = super.createChannel();
            liveChannelStreamLiveRequest.setChannelId(channelId);
            liveChannelStreamLiveResponse = new LiveChannelStateServiceImpl().setChannelStreamLive(
                    liveChannelStreamLiveRequest);
            Assert.assertNotNull(liveChannelStreamLiveResponse);
            if (liveChannelStreamLiveResponse) {
                //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. 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 exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
userId false String POLYV user ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).
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 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). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

true indicates successful setting, false indicates failure.




6. Set Channel to No Live Stream Status

Description

设置频道为无直播状态
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channels/%s/end

Call Constraints

  1. API calls are subject to rate limits. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testSetChannelStreamEnd() throws Exception, NoSuchAlgorithmException {
        LiveChannelStreamEndRequest liveChannelStreamEndRequest = new LiveChannelStreamEndRequest();
        Boolean liveChannelStreamEndResponse;
        try {
            //准备测试数据
            String channelId = super.createChannel();
            liveChannelStreamEndRequest.setChannelId(channelId);
            liveChannelStreamEndResponse = new LiveChannelStateServiceImpl().setChannelStreamEnd(
                    liveChannelStreamEndRequest);
            Assert.assertNotNull(liveChannelStreamEndResponse);
            if (liveChannelStreamEndResponse) {
                //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. 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 exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
userId false String POLYV user ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).
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 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). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

true indicates successful setting, false indicates failure.




7. Batch Query Channel Live Status

Description

批量查询频道直播状态
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/live-status/list

Call Constraints

  1. API calls are subject to rate limits. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testGetLiveStatus() throws Exception, NoSuchAlgorithmException {
        LiveListChannelStreamStatusV2Request liveListChannelStreamStatusV2Request = new LiveListChannelStreamStatusV2Request();
        List<LiveListChannelStreamStatusV2Response> liveListChannelStreamStatusV2Respons;
        try {
            //准备测试数据
            String channelIds = String.format("%s,%s", super.getAloneChannelId(), super.createChannel());
            liveListChannelStreamStatusV2Request.setChannelIds(channelIds);
            liveListChannelStreamStatusV2Respons = new LiveChannelStateServiceImpl().listChannelLiveStreamV2(
                    liveListChannelStreamStatusV2Request);
            Assert.assertNotNull(liveListChannelStreamStatusV2Respons);
            if (liveListChannelStreamStatusV2Respons != null) {
                //to do something ......
                log.debug("测试批量查询频道直播状态成功:{}", JSON.toJSONString(liveListChannelStreamStatusV2Respons));
            }
        } 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 LiveListChannelStreamStatusV2Response object is returned. 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 exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
channelIds true String Comma-separated channel IDs, e.g., 10000,100001. Maximum 20.
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from 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). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

The return object is a List<LiveListChannelStreamStatusV2Response>. The specific elements of LiveListChannelStreamStatusV2Response are as follows:

Parameter Name Type Description
channelId String Channel ID
liveStatus String Live status: unStart (not started), live (live), end (ended), waiting (waiting), playback (playback)






8. Batch Query Channel Live Stream Information

Description

批量获取频道直播的实时推流信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/monitor/get-streams

Call Constraints

  1. API calls are subject to rate limits. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testGetStreams() throws IOException, NoSuchAlgorithmException {
        LiveGetStreamsRequest liveGetStreamsRequest = new LiveGetStreamsRequest();
        List<LiveGetStreamsResponse> liveGetStreamsResponse;
        try {
            String channelId = super.createChannel();
            liveGetStreamsRequest.setChannelIds(channelId);
            liveGetStreamsResponse = new LiveChannelStateServiceImpl().getStreams(liveGetStreamsRequest);
            Assert.assertNotNull(liveGetStreamsResponse);
            if (liveGetStreamsResponse != null) {
                //to do something ......
                log.debug("测试批量查询频道直播流信息成功 {}", JSON.toJSONString(liveGetStreamsResponse));
            }
        } 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 LiveGetStreamsResponse object is returned. 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 exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned by Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
channelIds true String Channel IDs currently live, separated by commas. Maximum 100.
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtain from the Polyv official website: Official Website -> Login -> Live (Development Settings).
appSecret false String POLYV user APP_SECRET. Required for multi-account
联系客服,在线咨询