正在显示
1 个修改的文件
包含
20 行增加
和
1 行删除
| 1 | /** | 1 | /** |
| 2 | -* the SrsBandwidth object. | 2 | +* the SrsBandwidth library for js to do bandwidth test. |
| 3 | * @param container the html container id. | 3 | * @param container the html container id. |
| 4 | * @param width a float value specifies the width of bandwidth. | 4 | * @param width a float value specifies the width of bandwidth. |
| 5 | * @param height a float value specifies the height of bandwidth. | 5 | * @param height a float value specifies the height of bandwidth. |
| 6 | * @param private_object [optional] an object that used as private object, | 6 | * @param private_object [optional] an object that used as private object, |
| 7 | * for example, the logic chat object which owner this bandwidth. | 7 | * for example, the logic chat object which owner this bandwidth. |
| 8 | +* Usage: | ||
| 9 | + var bandwidth = new SrsBandwidth("player_id", 100, 1); | ||
| 10 | + bandwidth.on_bandwidth_ready = function() { | ||
| 11 | + // auto start check bandwidth when tool is ready. | ||
| 12 | + this.check_bandwidth(url); | ||
| 13 | + } | ||
| 14 | + bandwidth.on_update_progress = function(percent) { | ||
| 15 | + // console.log(percent + "%"); | ||
| 16 | + } | ||
| 17 | + bandwidth.on_update_status = function(status) { | ||
| 18 | + // console.log(status); | ||
| 19 | + } | ||
| 20 | + bandwidth.on_srs_info = function(srs_server, srs_primary_authors, srs_id, srs_pid, srs_server_ip) { | ||
| 21 | + // console.log( | ||
| 22 | + // "server:" + srs_server + ", authors:" + srs_primary_authors + | ||
| 23 | + // ", srs_id:" + srs_id + ", srs_pid:" + srs_pid + ", ip:" + srs_server_ip | ||
| 24 | + //); | ||
| 25 | + } | ||
| 26 | + bandwidth.render("rtmp://dev:1935/app?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com"); | ||
| 8 | */ | 27 | */ |
| 9 | function SrsBandwidth(container, width, height, private_object) { | 28 | function SrsBandwidth(container, width, height, private_object) { |
| 10 | if (!SrsBandwidth.__id) { | 29 | if (!SrsBandwidth.__id) { |
-
请 注册 或 登录 后发表评论