Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console: API response only 10 streams, should support pagination by console. #3451

Open
saturndeng opened this issue Mar 6, 2023 · 2 comments
Assignees
Labels
API HTTP-API, HTTP-Callback, etc. Bug It might be a bug. EnglishNative This issue is conveyed exclusively in English. Enhancement Improvement or enhancement. Feature It's a new feature.

Comments

@saturndeng
Copy link

saturndeng commented Mar 6, 2023

Note: Please read the FAQ before filing an issue, see #2716

Description

SRS 6.0.26 console only displays up to 10 video streams. If there are more than 10 video streams, they will not be displayed in the video stream list. In the console's virtual host (Vhosts) menu, you can see 13 online streams, but in the console's video stream menu, you can only see 10 video stream lists. The other three video streams are not displayed in the video stream list, but they can indeed be watched normally.

  1. SRS Version: 6.0.26

  2. SRS Console screenshot:

Virtual host menu shows 13 online streams, screenshot (copy the link below and open it in a new window to view):
https://mclz.fjxf-119.cn:7443/uploads/20221113/13.png

Console video stream menu only lists 10 video streams, and the ones exceeding 10 are not displayed (copy the link below and open it in a new window to view):

https://mclz.fjxf-119.cn:7443/uploads/20221113/10.png

In the source code srs_app_http_api.cpp, around line 796, is the count of online streams incorrect, causing the maximum to be 10?

     int count = srs_max(10, atoi(rcount.c_str()));   
       std::string rstart = r->query_get("start");
        std::string rcount = r->query_get("count");
        int start = srs_max(0, atoi(rstart.c_str()));
        int count = srs_max(10, atoi(rcount.c_str()));
        if ((err = stat->dumps_streams(data, start, count)) != srs_success) {
            int code = srs_error_code(err);
            srs_error_reset(err);
            return srs_api_response_code(w, r, code);
        }

Expectation

Hope to display all online video streams

@yangaphero
Copy link

yangaphero commented Mar 10, 2023

Modify objs/nginx/html/console/js/srs.console.js as follows:

streams_get: function(success) {
// var url = $sc_server.jsonp("/api/v1/streams/");
var url = $sc_server.jsonp_query("/api/v1/streams", "count=100");
$http.jsonp(url).success(success);
},

You can also use the start and count parameters for pagination.

@winlinvip
Copy link
Member

winlinvip commented Mar 11, 2023

See https://ossrs.net/lts/zh-cn/docs/v5/doc/http-api#streams

By default, HTTP API streams parameters are start=0 and count=10.

Note that console doesn't support change the parameter.

We plan to rewrite the console by reactjs, and we should fix it in the new version of console.

@winlinvip winlinvip closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2023
@winlinvip winlinvip self-assigned this Mar 11, 2023
@winlinvip winlinvip added Won't fix We won't fix it. API HTTP-API, HTTP-Callback, etc. labels Mar 11, 2023
@winlinvip winlinvip changed the title SRS控制台最多只返回显示10个视频流,超过10个视频流不会显示在视频流列表 API: Response only 10 streams by console. SRS控制台最多只返回显示10个视频流,超过10个视频流不会显示在视频流列表 Mar 11, 2023
@winlinvip winlinvip reopened this Mar 11, 2023
@winlinvip winlinvip changed the title API: Response only 10 streams by console. SRS控制台最多只返回显示10个视频流,超过10个视频流不会显示在视频流列表 Console: API response only 10 streams, should support pagination by console. SRS控制台最多只返回显示10个视频流,超过10个视频流不会显示在视频流列表 Mar 11, 2023
@winlinvip winlinvip changed the title Console: API response only 10 streams, should support pagination by console. SRS控制台最多只返回显示10个视频流,超过10个视频流不会显示在视频流列表 Console: API response only 10 streams, should support pagination by console. Jul 18, 2023
@winlinvip winlinvip added Bug It might be a bug. Enhancement Improvement or enhancement. Feature It's a new feature. and removed Won't fix We won't fix it. labels Jul 18, 2023
@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API HTTP-API, HTTP-Callback, etc. Bug It might be a bug. EnglishNative This issue is conveyed exclusively in English. Enhancement Improvement or enhancement. Feature It's a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants