add linux version of band check app; add web version of band check app
正在显示
4 个修改的文件
包含
250 行增加
和
95 行删除
| @@ -82,7 +82,7 @@ function error(code, desc) { | @@ -82,7 +82,7 @@ function error(code, desc) { | ||
| 82 | */ | 82 | */ |
| 83 | function parse_query_string(){ | 83 | function parse_query_string(){ |
| 84 | var obj = {}; | 84 | var obj = {}; |
| 85 | - | 85 | + |
| 86 | // parse the host(hostname:http_port), pathname(dir/filename) | 86 | // parse the host(hostname:http_port), pathname(dir/filename) |
| 87 | obj.host = window.location.host; | 87 | obj.host = window.location.host; |
| 88 | obj.hostname = window.location.hostname; | 88 | obj.hostname = window.location.hostname; |
| @@ -95,19 +95,19 @@ function parse_query_string(){ | @@ -95,19 +95,19 @@ function parse_query_string(){ | ||
| 95 | obj.dir = obj.pathname.substr(0, obj.pathname.lastIndexOf("/")); | 95 | obj.dir = obj.pathname.substr(0, obj.pathname.lastIndexOf("/")); |
| 96 | obj.filename = obj.pathname.substr(obj.pathname.lastIndexOf("/")); | 96 | obj.filename = obj.pathname.substr(obj.pathname.lastIndexOf("/")); |
| 97 | } | 97 | } |
| 98 | - | 98 | + |
| 99 | // parse the query string. | 99 | // parse the query string. |
| 100 | var query_string = String(window.location.search).replace(" ", "").split("?")[1]; | 100 | var query_string = String(window.location.search).replace(" ", "").split("?")[1]; |
| 101 | if(query_string == undefined){ | 101 | if(query_string == undefined){ |
| 102 | return obj; | 102 | return obj; |
| 103 | } | 103 | } |
| 104 | - | 104 | + |
| 105 | var queries = query_string.split("&"); | 105 | var queries = query_string.split("&"); |
| 106 | $(queries).each(function(){ | 106 | $(queries).each(function(){ |
| 107 | var query = this.split("="); | 107 | var query = this.split("="); |
| 108 | obj[query[0]] = query[1]; | 108 | obj[query[0]] = query[1]; |
| 109 | }); | 109 | }); |
| 110 | - | 110 | + |
| 111 | return obj; | 111 | return obj; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| @@ -169,7 +169,7 @@ function build_default_hls_url() { | @@ -169,7 +169,7 @@ function build_default_hls_url() { | ||
| 169 | } else if (query.hls_vhost != undefined) { | 169 | } else if (query.hls_vhost != undefined) { |
| 170 | server = query.hls_vhost; | 170 | server = query.hls_vhost; |
| 171 | } | 171 | } |
| 172 | - | 172 | + |
| 173 | var port = (query.hls_port == undefined)? window.location.port:query.hls_port; | 173 | var port = (query.hls_port == undefined)? window.location.port:query.hls_port; |
| 174 | var app = (query.app == undefined)? "live":query.app; | 174 | var app = (query.app == undefined)? "live":query.app; |
| 175 | var stream = (query.stream == undefined)? "livestream":query.stream; | 175 | var stream = (query.stream == undefined)? "livestream":query.stream; |
| @@ -177,7 +177,7 @@ function build_default_hls_url() { | @@ -177,7 +177,7 @@ function build_default_hls_url() { | ||
| 177 | if (port == "" || port == null || port == undefined) { | 177 | if (port == "" || port == null || port == undefined) { |
| 178 | port = 80; | 178 | port = 80; |
| 179 | } | 179 | } |
| 180 | - | 180 | + |
| 181 | return "http://" + server + ":" + port + "/" + app + "/" + stream + ".m3u8"; | 181 | return "http://" + server + ":" + port + "/" + app + "/" + stream + ".m3u8"; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| @@ -190,7 +190,7 @@ function srs_parse_rtmp_url(rtmp_url) { | @@ -190,7 +190,7 @@ function srs_parse_rtmp_url(rtmp_url) { | ||
| 190 | // @see: http://stackoverflow.com/questions/10469575/how-to-use-location-object-to-parse-url-without-redirecting-the-page-in-javascri | 190 | // @see: http://stackoverflow.com/questions/10469575/how-to-use-location-object-to-parse-url-without-redirecting-the-page-in-javascri |
| 191 | var a = document.createElement("a"); | 191 | var a = document.createElement("a"); |
| 192 | a.href = rtmp_url.replace("rtmp://", "http://"); | 192 | a.href = rtmp_url.replace("rtmp://", "http://"); |
| 193 | - | 193 | + |
| 194 | var vhost = a.hostname; | 194 | var vhost = a.hostname; |
| 195 | var port = (a.port == "")? "1935":a.port; | 195 | var port = (a.port == "")? "1935":a.port; |
| 196 | var app = a.pathname.substr(1, a.pathname.lastIndexOf("/") - 1); | 196 | var app = a.pathname.substr(1, a.pathname.lastIndexOf("/") - 1); |
| @@ -201,7 +201,7 @@ function srs_parse_rtmp_url(rtmp_url) { | @@ -201,7 +201,7 @@ function srs_parse_rtmp_url(rtmp_url) { | ||
| 201 | if (app.indexOf("?") >= 0) { | 201 | if (app.indexOf("?") >= 0) { |
| 202 | var params = app.substr(app.indexOf("?")); | 202 | var params = app.substr(app.indexOf("?")); |
| 203 | app = app.substr(0, app.indexOf("?")); | 203 | app = app.substr(0, app.indexOf("?")); |
| 204 | - | 204 | + |
| 205 | if (params.indexOf("vhost=") > 0) { | 205 | if (params.indexOf("vhost=") > 0) { |
| 206 | vhost = params.substr(params.indexOf("vhost=") + "vhost=".length); | 206 | vhost = params.substr(params.indexOf("vhost=") + "vhost=".length); |
| 207 | if (vhost.indexOf("&") > 0) { | 207 | if (vhost.indexOf("&") > 0) { |
| @@ -209,12 +209,12 @@ function srs_parse_rtmp_url(rtmp_url) { | @@ -209,12 +209,12 @@ function srs_parse_rtmp_url(rtmp_url) { | ||
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | } | 211 | } |
| 212 | - | 212 | + |
| 213 | var ret = { | 213 | var ret = { |
| 214 | - server: a.hostname, port: port, | 214 | + server: a.hostname, port: port, |
| 215 | vhost: vhost, app: app, stream: stream | 215 | vhost: vhost, app: app, stream: stream |
| 216 | }; | 216 | }; |
| 217 | - | 217 | + |
| 218 | return ret; | 218 | return ret; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| @@ -226,7 +226,7 @@ function srs_parse_rtmp_url(rtmp_url) { | @@ -226,7 +226,7 @@ function srs_parse_rtmp_url(rtmp_url) { | ||
| 226 | */ | 226 | */ |
| 227 | function srs_init(rtmp_url, hls_url, modal_player) { | 227 | function srs_init(rtmp_url, hls_url, modal_player) { |
| 228 | update_nav(); | 228 | update_nav(); |
| 229 | - | 229 | + |
| 230 | if (rtmp_url) { | 230 | if (rtmp_url) { |
| 231 | $(rtmp_url).val(build_default_rtmp_url()); | 231 | $(rtmp_url).val(build_default_rtmp_url()); |
| 232 | } | 232 | } |
| @@ -238,15 +238,44 @@ function srs_init(rtmp_url, hls_url, modal_player) { | @@ -238,15 +238,44 @@ function srs_init(rtmp_url, hls_url, modal_player) { | ||
| 238 | $(modal_player).css("margin-left", "-" + srs_get_player_modal() / 2 +"px"); | 238 | $(modal_player).css("margin-left", "-" + srs_get_player_modal() / 2 +"px"); |
| 239 | } | 239 | } |
| 240 | } | 240 | } |
| 241 | + | ||
| 241 | // for the chat to init the publish url. | 242 | // for the chat to init the publish url. |
| 242 | function srs_init_publish(rtmp_url) { | 243 | function srs_init_publish(rtmp_url) { |
| 243 | update_nav(); | 244 | update_nav(); |
| 244 | - | 245 | + |
| 245 | if (rtmp_url) { | 246 | if (rtmp_url) { |
| 246 | $(rtmp_url).val(build_default_publish_rtmp_url()); | 247 | $(rtmp_url).val(build_default_publish_rtmp_url()); |
| 247 | } | 248 | } |
| 248 | } | 249 | } |
| 249 | 250 | ||
| 251 | +// for bw to init url | ||
| 252 | +// url: scheme://host:port/path?query#fragment | ||
| 253 | +function srs_init_bwt(rtmp_url, hls_url) { | ||
| 254 | + update_nav(); | ||
| 255 | + | ||
| 256 | + if (rtmp_url) { | ||
| 257 | + //var query = parse_query_string(); | ||
| 258 | + var search_filed = String(window.location.search).replace(" ", "").split("?")[1]; | ||
| 259 | + $(rtmp_url).val("rtmp://" + window.location.host + ":" + 1935 + "/app?" + search_filed); | ||
| 260 | + } | ||
| 261 | + if (hls_url) { | ||
| 262 | + $(hls_url).val(build_default_hls_url()); | ||
| 263 | + } | ||
| 264 | +} | ||
| 265 | + | ||
| 266 | +function srs_bwt_check_url(url) { | ||
| 267 | + if (url.indexOf("key") != -1 && url.indexOf("vhost") != -1) { | ||
| 268 | + return true; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + return false; | ||
| 272 | +} | ||
| 273 | + | ||
| 274 | +function srs_bwt_build_default_url() { | ||
| 275 | + var url_default = "rtmp://" + window.location.host + ":" + 1935 + "/app?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com"; | ||
| 276 | + return url_default; | ||
| 277 | +} | ||
| 278 | + | ||
| 250 | /** | 279 | /** |
| 251 | * when publisher ready, init the page elements. | 280 | * when publisher ready, init the page elements. |
| 252 | */ | 281 | */ |
| @@ -265,59 +294,59 @@ function srs_publisher_initialize_page( | @@ -265,59 +294,59 @@ function srs_publisher_initialize_page( | ||
| 265 | break; | 294 | break; |
| 266 | } | 295 | } |
| 267 | } | 296 | } |
| 268 | - | 297 | + |
| 269 | $(sl_microphones).empty(); | 298 | $(sl_microphones).empty(); |
| 270 | for (var i = 0; i < microphones.length; i++) { | 299 | for (var i = 0; i < microphones.length; i++) { |
| 271 | $(sl_microphones).append("<option value='" + i + "'>" + microphones[i] + "</option"); | 300 | $(sl_microphones).append("<option value='" + i + "'>" + microphones[i] + "</option"); |
| 272 | } | 301 | } |
| 273 | - | 302 | + |
| 274 | $(sl_vcodec).empty(); | 303 | $(sl_vcodec).empty(); |
| 275 | var vcodecs = ["h264", "vp6"]; | 304 | var vcodecs = ["h264", "vp6"]; |
| 276 | for (var i = 0; i < vcodecs.length; i++) { | 305 | for (var i = 0; i < vcodecs.length; i++) { |
| 277 | $(sl_vcodec).append("<option value='" + vcodecs[i] + "'>" + vcodecs[i] + "</option"); | 306 | $(sl_vcodec).append("<option value='" + vcodecs[i] + "'>" + vcodecs[i] + "</option"); |
| 278 | } | 307 | } |
| 279 | - | 308 | + |
| 280 | $(sl_profile).empty(); | 309 | $(sl_profile).empty(); |
| 281 | var profiles = ["baseline", "main"]; | 310 | var profiles = ["baseline", "main"]; |
| 282 | for (var i = 0; i < profiles.length; i++) { | 311 | for (var i = 0; i < profiles.length; i++) { |
| 283 | $(sl_profile).append("<option value='" + profiles[i] + "'>" + profiles[i] + "</option"); | 312 | $(sl_profile).append("<option value='" + profiles[i] + "'>" + profiles[i] + "</option"); |
| 284 | } | 313 | } |
| 285 | $(sl_profile + " option[value='main']").attr("selected", true); | 314 | $(sl_profile + " option[value='main']").attr("selected", true); |
| 286 | - | 315 | + |
| 287 | $(sl_level).empty(); | 316 | $(sl_level).empty(); |
| 288 | - var levels = ["1", "1b", "1.1", "1.2", "1.3", | 317 | + var levels = ["1", "1b", "1.1", "1.2", "1.3", |
| 289 | "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1"]; | 318 | "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1"]; |
| 290 | for (var i = 0; i < levels.length; i++) { | 319 | for (var i = 0; i < levels.length; i++) { |
| 291 | $(sl_level).append("<option value='" + levels[i] + "'>" + levels[i] + "</option"); | 320 | $(sl_level).append("<option value='" + levels[i] + "'>" + levels[i] + "</option"); |
| 292 | } | 321 | } |
| 293 | $(sl_level + " option[value='4.1']").attr("selected", true); | 322 | $(sl_level + " option[value='4.1']").attr("selected", true); |
| 294 | - | 323 | + |
| 295 | $(sl_gop).empty(); | 324 | $(sl_gop).empty(); |
| 296 | - var gops = ["0.3", "0.5", "1", "2", "3", "4", | 325 | + var gops = ["0.3", "0.5", "1", "2", "3", "4", |
| 297 | "5", "6", "7", "8", "9", "10", "15", "20"]; | 326 | "5", "6", "7", "8", "9", "10", "15", "20"]; |
| 298 | for (var i = 0; i < gops.length; i++) { | 327 | for (var i = 0; i < gops.length; i++) { |
| 299 | $(sl_gop).append("<option value='" + gops[i] + "'>" + gops[i] + "秒</option"); | 328 | $(sl_gop).append("<option value='" + gops[i] + "'>" + gops[i] + "秒</option"); |
| 300 | } | 329 | } |
| 301 | $(sl_gop + " option[value='10']").attr("selected", true); | 330 | $(sl_gop + " option[value='10']").attr("selected", true); |
| 302 | - | 331 | + |
| 303 | $(sl_size).empty(); | 332 | $(sl_size).empty(); |
| 304 | - var sizes = ["176x144", "320x240", "352x240", | ||
| 305 | - "352x288", "460x240", "640x480", "720x480", "720x576", "800x600", | 333 | + var sizes = ["176x144", "320x240", "352x240", |
| 334 | + "352x288", "460x240", "640x480", "720x480", "720x576", "800x600", | ||
| 306 | "1024x768", "1280x720", "1360x768", "1920x1080"]; | 335 | "1024x768", "1280x720", "1360x768", "1920x1080"]; |
| 307 | for (i = 0; i < sizes.length; i++) { | 336 | for (i = 0; i < sizes.length; i++) { |
| 308 | $(sl_size).append("<option value='" + sizes[i] + "'>" + sizes[i] + "</option"); | 337 | $(sl_size).append("<option value='" + sizes[i] + "'>" + sizes[i] + "</option"); |
| 309 | } | 338 | } |
| 310 | $(sl_size + " option[value='640x480']").attr("selected", true); | 339 | $(sl_size + " option[value='640x480']").attr("selected", true); |
| 311 | - | 340 | + |
| 312 | $(sl_fps).empty(); | 341 | $(sl_fps).empty(); |
| 313 | var fpses = ["5", "10", "15", "20", "24", "25", "29.97", "30"]; | 342 | var fpses = ["5", "10", "15", "20", "24", "25", "29.97", "30"]; |
| 314 | for (i = 0; i < fpses.length; i++) { | 343 | for (i = 0; i < fpses.length; i++) { |
| 315 | $(sl_fps).append("<option value='" + fpses[i] + "'>" + Number(fpses[i]).toFixed(2) + " 帧/秒</option"); | 344 | $(sl_fps).append("<option value='" + fpses[i] + "'>" + Number(fpses[i]).toFixed(2) + " 帧/秒</option"); |
| 316 | } | 345 | } |
| 317 | $(sl_fps + " option[value='20']").attr("selected", true); | 346 | $(sl_fps + " option[value='20']").attr("selected", true); |
| 318 | - | 347 | + |
| 319 | $(sl_bitrate).empty(); | 348 | $(sl_bitrate).empty(); |
| 320 | - var bitrates = ["50", "200", "350", "500", "650", "800", | 349 | + var bitrates = ["50", "200", "350", "500", "650", "800", |
| 321 | "950", "1000", "1200", "1500", "1800", "2000", "3000", "5000"]; | 350 | "950", "1000", "1200", "1500", "1800", "2000", "3000", "5000"]; |
| 322 | for (i = 0; i < bitrates.length; i++) { | 351 | for (i = 0; i < bitrates.length; i++) { |
| 323 | $(sl_bitrate).append("<option value='" + bitrates[i] + "'>" + bitrates[i] + " kbps</option"); | 352 | $(sl_bitrate).append("<option value='" + bitrates[i] + "'>" + bitrates[i] + " kbps</option"); |
| @@ -342,59 +371,59 @@ function srs_chat_initialize_page( | @@ -342,59 +371,59 @@ function srs_chat_initialize_page( | ||
| 342 | break; | 371 | break; |
| 343 | } | 372 | } |
| 344 | } | 373 | } |
| 345 | - | 374 | + |
| 346 | $(sl_microphones).empty(); | 375 | $(sl_microphones).empty(); |
| 347 | for (var i = 0; i < microphones.length; i++) { | 376 | for (var i = 0; i < microphones.length; i++) { |
| 348 | $(sl_microphones).append("<option value='" + i + "'>" + microphones[i] + "</option"); | 377 | $(sl_microphones).append("<option value='" + i + "'>" + microphones[i] + "</option"); |
| 349 | } | 378 | } |
| 350 | - | 379 | + |
| 351 | $(sl_vcodec).empty(); | 380 | $(sl_vcodec).empty(); |
| 352 | var vcodecs = ["h264", "vp6"]; | 381 | var vcodecs = ["h264", "vp6"]; |
| 353 | for (var i = 0; i < vcodecs.length; i++) { | 382 | for (var i = 0; i < vcodecs.length; i++) { |
| 354 | $(sl_vcodec).append("<option value='" + vcodecs[i] + "'>" + vcodecs[i] + "</option"); | 383 | $(sl_vcodec).append("<option value='" + vcodecs[i] + "'>" + vcodecs[i] + "</option"); |
| 355 | } | 384 | } |
| 356 | - | 385 | + |
| 357 | $(sl_profile).empty(); | 386 | $(sl_profile).empty(); |
| 358 | var profiles = ["baseline", "main"]; | 387 | var profiles = ["baseline", "main"]; |
| 359 | for (var i = 0; i < profiles.length; i++) { | 388 | for (var i = 0; i < profiles.length; i++) { |
| 360 | $(sl_profile).append("<option value='" + profiles[i] + "'>" + profiles[i] + "</option"); | 389 | $(sl_profile).append("<option value='" + profiles[i] + "'>" + profiles[i] + "</option"); |
| 361 | } | 390 | } |
| 362 | $(sl_profile + " option[value='baseline']").attr("selected", true); | 391 | $(sl_profile + " option[value='baseline']").attr("selected", true); |
| 363 | - | 392 | + |
| 364 | $(sl_level).empty(); | 393 | $(sl_level).empty(); |
| 365 | - var levels = ["1", "1b", "1.1", "1.2", "1.3", | 394 | + var levels = ["1", "1b", "1.1", "1.2", "1.3", |
| 366 | "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1"]; | 395 | "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1"]; |
| 367 | for (var i = 0; i < levels.length; i++) { | 396 | for (var i = 0; i < levels.length; i++) { |
| 368 | $(sl_level).append("<option value='" + levels[i] + "'>" + levels[i] + "</option"); | 397 | $(sl_level).append("<option value='" + levels[i] + "'>" + levels[i] + "</option"); |
| 369 | } | 398 | } |
| 370 | $(sl_level + " option[value='3.1']").attr("selected", true); | 399 | $(sl_level + " option[value='3.1']").attr("selected", true); |
| 371 | - | 400 | + |
| 372 | $(sl_gop).empty(); | 401 | $(sl_gop).empty(); |
| 373 | - var gops = ["0.3", "0.5", "1", "2", "3", "4", | 402 | + var gops = ["0.3", "0.5", "1", "2", "3", "4", |
| 374 | "5", "6", "7", "8", "9", "10", "15", "20"]; | 403 | "5", "6", "7", "8", "9", "10", "15", "20"]; |
| 375 | for (var i = 0; i < gops.length; i++) { | 404 | for (var i = 0; i < gops.length; i++) { |
| 376 | $(sl_gop).append("<option value='" + gops[i] + "'>" + gops[i] + "秒</option"); | 405 | $(sl_gop).append("<option value='" + gops[i] + "'>" + gops[i] + "秒</option"); |
| 377 | } | 406 | } |
| 378 | $(sl_gop + " option[value='0.5']").attr("selected", true); | 407 | $(sl_gop + " option[value='0.5']").attr("selected", true); |
| 379 | - | 408 | + |
| 380 | $(sl_size).empty(); | 409 | $(sl_size).empty(); |
| 381 | - var sizes = ["176x144", "320x240", "352x240", | ||
| 382 | - "352x288", "460x240", "640x480", "720x480", "720x576", "800x600", | 410 | + var sizes = ["176x144", "320x240", "352x240", |
| 411 | + "352x288", "460x240", "640x480", "720x480", "720x576", "800x600", | ||
| 383 | "1024x768", "1280x720", "1360x768", "1920x1080"]; | 412 | "1024x768", "1280x720", "1360x768", "1920x1080"]; |
| 384 | for (i = 0; i < sizes.length; i++) { | 413 | for (i = 0; i < sizes.length; i++) { |
| 385 | $(sl_size).append("<option value='" + sizes[i] + "'>" + sizes[i] + "</option"); | 414 | $(sl_size).append("<option value='" + sizes[i] + "'>" + sizes[i] + "</option"); |
| 386 | } | 415 | } |
| 387 | $(sl_size + " option[value='460x240']").attr("selected", true); | 416 | $(sl_size + " option[value='460x240']").attr("selected", true); |
| 388 | - | 417 | + |
| 389 | $(sl_fps).empty(); | 418 | $(sl_fps).empty(); |
| 390 | var fpses = ["5", "10", "15", "20", "24", "25", "29.97", "30"]; | 419 | var fpses = ["5", "10", "15", "20", "24", "25", "29.97", "30"]; |
| 391 | for (i = 0; i < fpses.length; i++) { | 420 | for (i = 0; i < fpses.length; i++) { |
| 392 | $(sl_fps).append("<option value='" + fpses[i] + "'>" + Number(fpses[i]).toFixed(2) + " 帧/秒</option"); | 421 | $(sl_fps).append("<option value='" + fpses[i] + "'>" + Number(fpses[i]).toFixed(2) + " 帧/秒</option"); |
| 393 | } | 422 | } |
| 394 | $(sl_fps + " option[value='15']").attr("selected", true); | 423 | $(sl_fps + " option[value='15']").attr("selected", true); |
| 395 | - | 424 | + |
| 396 | $(sl_bitrate).empty(); | 425 | $(sl_bitrate).empty(); |
| 397 | - var bitrates = ["50", "200", "350", "500", "650", "800", | 426 | + var bitrates = ["50", "200", "350", "500", "650", "800", |
| 398 | "950", "1000", "1200", "1500", "1800", "2000", "3000", "5000"]; | 427 | "950", "1000", "1200", "1500", "1800", "2000", "3000", "5000"]; |
| 399 | for (i = 0; i < bitrates.length; i++) { | 428 | for (i = 0; i < bitrates.length; i++) { |
| 400 | $(sl_bitrate).append("<option value='" + bitrates[i] + "'>" + bitrates[i] + " kbps</option"); | 429 | $(sl_bitrate).append("<option value='" + bitrates[i] + "'>" + bitrates[i] + " kbps</option"); |
| @@ -410,10 +439,10 @@ function srs_publiser_get_codec( | @@ -410,10 +439,10 @@ function srs_publiser_get_codec( | ||
| 410 | ) { | 439 | ) { |
| 411 | acodec.device_code = $(sl_microphones).val(); | 440 | acodec.device_code = $(sl_microphones).val(); |
| 412 | acodec.device_name = $(sl_microphones).text(); | 441 | acodec.device_name = $(sl_microphones).text(); |
| 413 | - | 442 | + |
| 414 | vcodec.device_code = $(sl_cameras).find("option:selected").val(); | 443 | vcodec.device_code = $(sl_cameras).find("option:selected").val(); |
| 415 | vcodec.device_name = $(sl_cameras).find("option:selected").text(); | 444 | vcodec.device_name = $(sl_cameras).find("option:selected").text(); |
| 416 | - | 445 | + |
| 417 | vcodec.codec = $(sl_vcodec).find("option:selected").val(); | 446 | vcodec.codec = $(sl_vcodec).find("option:selected").val(); |
| 418 | vcodec.profile = $(sl_profile).find("option:selected").val(); | 447 | vcodec.profile = $(sl_profile).find("option:selected").val(); |
| 419 | vcodec.level = $(sl_level).find("option:selected").val(); | 448 | vcodec.level = $(sl_level).find("option:selected").val(); |
| @@ -431,7 +460,7 @@ function srs_publiser_get_codec( | @@ -431,7 +460,7 @@ function srs_publiser_get_codec( | ||
| 431 | * @param container the html container id. | 460 | * @param container the html container id. |
| 432 | * @param width a float value specifies the width of player. | 461 | * @param width a float value specifies the width of player. |
| 433 | * @param height a float value specifies the height of player. | 462 | * @param height a float value specifies the height of player. |
| 434 | -* @param private_object [optional] an object that used as private object, | 463 | +* @param private_object [optional] an object that used as private object, |
| 435 | * for example, the logic chat object which owner this player. | 464 | * for example, the logic chat object which owner this player. |
| 436 | */ | 465 | */ |
| 437 | function SrsPlayer(container, width, height, private_object) { | 466 | function SrsPlayer(container, width, height, private_object) { |
| @@ -441,9 +470,9 @@ function SrsPlayer(container, width, height, private_object) { | @@ -441,9 +470,9 @@ function SrsPlayer(container, width, height, private_object) { | ||
| 441 | if (!SrsPlayer.__players) { | 470 | if (!SrsPlayer.__players) { |
| 442 | SrsPlayer.__players = []; | 471 | SrsPlayer.__players = []; |
| 443 | } | 472 | } |
| 444 | - | 473 | + |
| 445 | SrsPlayer.__players.push(this); | 474 | SrsPlayer.__players.push(this); |
| 446 | - | 475 | + |
| 447 | this.private_object = private_object; | 476 | this.private_object = private_object; |
| 448 | this.container = container; | 477 | this.container = container; |
| 449 | this.width = width; | 478 | this.width = width; |
| @@ -452,7 +481,7 @@ function SrsPlayer(container, width, height, private_object) { | @@ -452,7 +481,7 @@ function SrsPlayer(container, width, height, private_object) { | ||
| 452 | this.stream_url = null; | 481 | this.stream_url = null; |
| 453 | this.buffer_time = 0.8; // default to 0.8 | 482 | this.buffer_time = 0.8; // default to 0.8 |
| 454 | this.callbackObj = null; | 483 | this.callbackObj = null; |
| 455 | - | 484 | + |
| 456 | // callback set the following values. | 485 | // callback set the following values. |
| 457 | this.meatadata = {}; // for on_player_metadata | 486 | this.meatadata = {}; // for on_player_metadata |
| 458 | this.time = 0; // current stream time. | 487 | this.time = 0; // current stream time. |
| @@ -469,25 +498,25 @@ SrsPlayer.prototype.start = function(url) { | @@ -469,25 +498,25 @@ SrsPlayer.prototype.start = function(url) { | ||
| 469 | if (url) { | 498 | if (url) { |
| 470 | this.stream_url = url; | 499 | this.stream_url = url; |
| 471 | } | 500 | } |
| 472 | - | 501 | + |
| 473 | // embed the flash. | 502 | // embed the flash. |
| 474 | var flashvars = {}; | 503 | var flashvars = {}; |
| 475 | flashvars.id = this.id; | 504 | flashvars.id = this.id; |
| 476 | flashvars.on_player_ready = "__srs_on_player_ready"; | 505 | flashvars.on_player_ready = "__srs_on_player_ready"; |
| 477 | flashvars.on_player_metadata = "__srs_on_player_metadata"; | 506 | flashvars.on_player_metadata = "__srs_on_player_metadata"; |
| 478 | flashvars.on_player_timer = "__srs_on_player_timer"; | 507 | flashvars.on_player_timer = "__srs_on_player_timer"; |
| 479 | - | 508 | + |
| 480 | var params = {}; | 509 | var params = {}; |
| 481 | params.wmode = "opaque"; | 510 | params.wmode = "opaque"; |
| 482 | params.allowFullScreen = "true"; | 511 | params.allowFullScreen = "true"; |
| 483 | params.allowScriptAccess = "always"; | 512 | params.allowScriptAccess = "always"; |
| 484 | - | 513 | + |
| 485 | var attributes = {}; | 514 | var attributes = {}; |
| 486 | - | 515 | + |
| 487 | var self = this; | 516 | var self = this; |
| 488 | - | 517 | + |
| 489 | swfobject.embedSWF( | 518 | swfobject.embedSWF( |
| 490 | - "srs_player/release/srs_player.swf?_version="+srs_get_version_code(), | 519 | + "srs_player/release/srs_player.swf?_version="+srs_get_version_code(), |
| 491 | this.container, | 520 | this.container, |
| 492 | this.width, this.height, | 521 | this.width, this.height, |
| 493 | "11.1", "js/AdobeFlashPlayerInstall.swf", | 522 | "11.1", "js/AdobeFlashPlayerInstall.swf", |
| @@ -496,7 +525,7 @@ SrsPlayer.prototype.start = function(url) { | @@ -496,7 +525,7 @@ SrsPlayer.prototype.start = function(url) { | ||
| 496 | self.callbackObj = callbackObj; | 525 | self.callbackObj = callbackObj; |
| 497 | } | 526 | } |
| 498 | ); | 527 | ); |
| 499 | - | 528 | + |
| 500 | return this; | 529 | return this; |
| 501 | } | 530 | } |
| 502 | /** | 531 | /** |
| @@ -512,15 +541,15 @@ SrsPlayer.prototype.play = function(url) { | @@ -512,15 +541,15 @@ SrsPlayer.prototype.play = function(url) { | ||
| 512 | SrsPlayer.prototype.stop = function() { | 541 | SrsPlayer.prototype.stop = function() { |
| 513 | for (var i = 0; i < SrsPlayer.__players.length; i++) { | 542 | for (var i = 0; i < SrsPlayer.__players.length; i++) { |
| 514 | var player = SrsPlayer.__players[i]; | 543 | var player = SrsPlayer.__players[i]; |
| 515 | - | 544 | + |
| 516 | if (player.id != this.id) { | 545 | if (player.id != this.id) { |
| 517 | continue; | 546 | continue; |
| 518 | } | 547 | } |
| 519 | - | 548 | + |
| 520 | SrsPlayer.__players.splice(i, 1); | 549 | SrsPlayer.__players.splice(i, 1); |
| 521 | break; | 550 | break; |
| 522 | } | 551 | } |
| 523 | - | 552 | + |
| 524 | this.callbackObj.ref.__stop(); | 553 | this.callbackObj.ref.__stop(); |
| 525 | } | 554 | } |
| 526 | SrsPlayer.prototype.pause = function() { | 555 | SrsPlayer.prototype.pause = function() { |
| @@ -531,10 +560,10 @@ SrsPlayer.prototype.resume = function() { | @@ -531,10 +560,10 @@ SrsPlayer.prototype.resume = function() { | ||
| 531 | } | 560 | } |
| 532 | /** | 561 | /** |
| 533 | * to set the DAR, for example, DAR=16:9 | 562 | * to set the DAR, for example, DAR=16:9 |
| 534 | -* @param num, for example, 9. | 563 | +* @param num, for example, 9. |
| 535 | * use metadata height if 0. | 564 | * use metadata height if 0. |
| 536 | * use user specified height if -1. | 565 | * use user specified height if -1. |
| 537 | -* @param den, for example, 16. | 566 | +* @param den, for example, 16. |
| 538 | * use metadata width if 0. | 567 | * use metadata width if 0. |
| 539 | * use user specified width if -1. | 568 | * use user specified width if -1. |
| 540 | */ | 569 | */ |
| @@ -571,14 +600,14 @@ SrsPlayer.prototype.on_player_timer = function(time, buffer_length) { | @@ -571,14 +600,14 @@ SrsPlayer.prototype.on_player_timer = function(time, buffer_length) { | ||
| 571 | function __srs_find_player(id) { | 600 | function __srs_find_player(id) { |
| 572 | for (var i = 0; i < SrsPlayer.__players.length; i++) { | 601 | for (var i = 0; i < SrsPlayer.__players.length; i++) { |
| 573 | var player = SrsPlayer.__players[i]; | 602 | var player = SrsPlayer.__players[i]; |
| 574 | - | 603 | + |
| 575 | if (player.id != id) { | 604 | if (player.id != id) { |
| 576 | continue; | 605 | continue; |
| 577 | } | 606 | } |
| 578 | - | 607 | + |
| 579 | return player; | 608 | return player; |
| 580 | } | 609 | } |
| 581 | - | 610 | + |
| 582 | throw new Error("player not found. id=" + id); | 611 | throw new Error("player not found. id=" + id); |
| 583 | } | 612 | } |
| 584 | function __srs_on_player_ready(id) { | 613 | function __srs_on_player_ready(id) { |
| @@ -587,26 +616,26 @@ function __srs_on_player_ready(id) { | @@ -587,26 +616,26 @@ function __srs_on_player_ready(id) { | ||
| 587 | } | 616 | } |
| 588 | function __srs_on_player_metadata(id, metadata) { | 617 | function __srs_on_player_metadata(id, metadata) { |
| 589 | var player = __srs_find_player(id); | 618 | var player = __srs_find_player(id); |
| 590 | - | ||
| 591 | - // user may override the on_player_metadata, | 619 | + |
| 620 | + // user may override the on_player_metadata, | ||
| 592 | // so set the data before invoke it. | 621 | // so set the data before invoke it. |
| 593 | player.metadata = metadata; | 622 | player.metadata = metadata; |
| 594 | - | 623 | + |
| 595 | player.on_player_metadata(metadata); | 624 | player.on_player_metadata(metadata); |
| 596 | } | 625 | } |
| 597 | function __srs_on_player_timer(id, time, buffer_length) { | 626 | function __srs_on_player_timer(id, time, buffer_length) { |
| 598 | var player = __srs_find_player(id); | 627 | var player = __srs_find_player(id); |
| 599 | - | 628 | + |
| 600 | buffer_length = Math.max(0, buffer_length); | 629 | buffer_length = Math.max(0, buffer_length); |
| 601 | buffer_length = Math.min(player.buffer_time, buffer_length); | 630 | buffer_length = Math.min(player.buffer_time, buffer_length); |
| 602 | - | 631 | + |
| 603 | time = Math.max(0, time); | 632 | time = Math.max(0, time); |
| 604 | - | ||
| 605 | - // user may override the on_player_timer, | 633 | + |
| 634 | + // user may override the on_player_timer, | ||
| 606 | // so set the data before invoke it. | 635 | // so set the data before invoke it. |
| 607 | player.time = time; | 636 | player.time = time; |
| 608 | player.buffer_length = buffer_length; | 637 | player.buffer_length = buffer_length; |
| 609 | - | 638 | + |
| 610 | player.on_player_timer(time, buffer_length); | 639 | player.on_player_timer(time, buffer_length); |
| 611 | } | 640 | } |
| 612 | 641 | ||
| @@ -618,7 +647,7 @@ function __srs_on_player_timer(id, time, buffer_length) { | @@ -618,7 +647,7 @@ function __srs_on_player_timer(id, time, buffer_length) { | ||
| 618 | * @param container the html container id. | 647 | * @param container the html container id. |
| 619 | * @param width a float value specifies the width of publisher. | 648 | * @param width a float value specifies the width of publisher. |
| 620 | * @param height a float value specifies the height of publisher. | 649 | * @param height a float value specifies the height of publisher. |
| 621 | -* @param private_object [optional] an object that used as private object, | 650 | +* @param private_object [optional] an object that used as private object, |
| 622 | * for example, the logic chat object which owner this publisher. | 651 | * for example, the logic chat object which owner this publisher. |
| 623 | */ | 652 | */ |
| 624 | function SrsPublisher(container, width, height, private_object) { | 653 | function SrsPublisher(container, width, height, private_object) { |
| @@ -628,31 +657,31 @@ function SrsPublisher(container, width, height, private_object) { | @@ -628,31 +657,31 @@ function SrsPublisher(container, width, height, private_object) { | ||
| 628 | if (!SrsPublisher.__publishers) { | 657 | if (!SrsPublisher.__publishers) { |
| 629 | SrsPublisher.__publishers = []; | 658 | SrsPublisher.__publishers = []; |
| 630 | } | 659 | } |
| 631 | - | 660 | + |
| 632 | SrsPublisher.__publishers.push(this); | 661 | SrsPublisher.__publishers.push(this); |
| 633 | - | 662 | + |
| 634 | this.private_object = private_object; | 663 | this.private_object = private_object; |
| 635 | this.container = container; | 664 | this.container = container; |
| 636 | this.width = width; | 665 | this.width = width; |
| 637 | this.height = height; | 666 | this.height = height; |
| 638 | this.id = SrsPublisher.__id++; | 667 | this.id = SrsPublisher.__id++; |
| 639 | this.callbackObj = null; | 668 | this.callbackObj = null; |
| 640 | - | 669 | + |
| 641 | // set the values when publish. | 670 | // set the values when publish. |
| 642 | this.url = null; | 671 | this.url = null; |
| 643 | this.vcodec = {}; | 672 | this.vcodec = {}; |
| 644 | this.acodec = {}; | 673 | this.acodec = {}; |
| 645 | - | 674 | + |
| 646 | // callback set the following values. | 675 | // callback set the following values. |
| 647 | this.cameras = []; | 676 | this.cameras = []; |
| 648 | this.microphones = []; | 677 | this.microphones = []; |
| 649 | this.code = 0; | 678 | this.code = 0; |
| 650 | - | 679 | + |
| 651 | // error code defines. | 680 | // error code defines. |
| 652 | this.errors = { | 681 | this.errors = { |
| 653 | - "100": "无法获取指定的摄像头", //error_camera_get | ||
| 654 | - "101": "无法获取指定的麦克风", //error_microphone_get | ||
| 655 | - "102": "摄像头为禁用状态,推流时请允许flash访问摄像头", //error_camera_muted | 682 | + "100": "无法获取指定的摄像头", //error_camera_get |
| 683 | + "101": "无法获取指定的麦克风", //error_microphone_get | ||
| 684 | + "102": "摄像头为禁用状态,推流时请允许flash访问摄像头", //error_camera_muted | ||
| 656 | }; | 685 | }; |
| 657 | } | 686 | } |
| 658 | /** | 687 | /** |
| @@ -669,18 +698,18 @@ SrsPublisher.prototype.start = function() { | @@ -669,18 +698,18 @@ SrsPublisher.prototype.start = function() { | ||
| 669 | flashvars.on_publisher_ready = "__srs_on_publisher_ready"; | 698 | flashvars.on_publisher_ready = "__srs_on_publisher_ready"; |
| 670 | flashvars.on_publisher_error = "__srs_on_publisher_error"; | 699 | flashvars.on_publisher_error = "__srs_on_publisher_error"; |
| 671 | flashvars.on_publisher_warn = "__srs_on_publisher_warn"; | 700 | flashvars.on_publisher_warn = "__srs_on_publisher_warn"; |
| 672 | - | 701 | + |
| 673 | var params = {}; | 702 | var params = {}; |
| 674 | params.wmode = "opaque"; | 703 | params.wmode = "opaque"; |
| 675 | params.allowFullScreen = "true"; | 704 | params.allowFullScreen = "true"; |
| 676 | params.allowScriptAccess = "always"; | 705 | params.allowScriptAccess = "always"; |
| 677 | - | 706 | + |
| 678 | var attributes = {}; | 707 | var attributes = {}; |
| 679 | - | 708 | + |
| 680 | var self = this; | 709 | var self = this; |
| 681 | - | 710 | + |
| 682 | swfobject.embedSWF( | 711 | swfobject.embedSWF( |
| 683 | - "srs_publisher/release/srs_publisher.swf?_version="+srs_get_version_code(), | 712 | + "srs_publisher/release/srs_publisher.swf?_version="+srs_get_version_code(), |
| 684 | this.container, | 713 | this.container, |
| 685 | this.width, this.height, | 714 | this.width, this.height, |
| 686 | "11.1", "js/AdobeFlashPlayerInstall.swf", | 715 | "11.1", "js/AdobeFlashPlayerInstall.swf", |
| @@ -689,7 +718,7 @@ SrsPublisher.prototype.start = function() { | @@ -689,7 +718,7 @@ SrsPublisher.prototype.start = function() { | ||
| 689 | self.callbackObj = callbackObj; | 718 | self.callbackObj = callbackObj; |
| 690 | } | 719 | } |
| 691 | ); | 720 | ); |
| 692 | - | 721 | + |
| 693 | return this; | 722 | return this; |
| 694 | } | 723 | } |
| 695 | /** | 724 | /** |
| @@ -702,7 +731,7 @@ SrsPublisher.prototype.publish = function(url, vcodec, acodec) { | @@ -702,7 +731,7 @@ SrsPublisher.prototype.publish = function(url, vcodec, acodec) { | ||
| 702 | this.url = url; | 731 | this.url = url; |
| 703 | this.vcodec = vcodec; | 732 | this.vcodec = vcodec; |
| 704 | this.acodec = acodec; | 733 | this.acodec = acodec; |
| 705 | - | 734 | + |
| 706 | this.callbackObj.ref.__publish(url, this.width, this.height, vcodec, acodec); | 735 | this.callbackObj.ref.__publish(url, this.width, this.height, vcodec, acodec); |
| 707 | } | 736 | } |
| 708 | SrsPublisher.prototype.stop = function() { | 737 | SrsPublisher.prototype.stop = function() { |
| @@ -729,36 +758,36 @@ SrsPublisher.prototype.on_publisher_warn = function(code, desc) { | @@ -729,36 +758,36 @@ SrsPublisher.prototype.on_publisher_warn = function(code, desc) { | ||
| 729 | function __srs_find_publisher(id) { | 758 | function __srs_find_publisher(id) { |
| 730 | for (var i = 0; i < SrsPublisher.__publishers.length; i++) { | 759 | for (var i = 0; i < SrsPublisher.__publishers.length; i++) { |
| 731 | var publisher = SrsPublisher.__publishers[i]; | 760 | var publisher = SrsPublisher.__publishers[i]; |
| 732 | - | 761 | + |
| 733 | if (publisher.id != id) { | 762 | if (publisher.id != id) { |
| 734 | continue; | 763 | continue; |
| 735 | } | 764 | } |
| 736 | - | 765 | + |
| 737 | return publisher; | 766 | return publisher; |
| 738 | } | 767 | } |
| 739 | - | 768 | + |
| 740 | throw new Error("publisher not found. id=" + id); | 769 | throw new Error("publisher not found. id=" + id); |
| 741 | } | 770 | } |
| 742 | function __srs_on_publisher_ready(id, cameras, microphones) { | 771 | function __srs_on_publisher_ready(id, cameras, microphones) { |
| 743 | var publisher = __srs_find_publisher(id); | 772 | var publisher = __srs_find_publisher(id); |
| 744 | - | 773 | + |
| 745 | publisher.cameras = cameras; | 774 | publisher.cameras = cameras; |
| 746 | publisher.microphones = microphones; | 775 | publisher.microphones = microphones; |
| 747 | - | 776 | + |
| 748 | publisher.on_publisher_ready(cameras, microphones); | 777 | publisher.on_publisher_ready(cameras, microphones); |
| 749 | } | 778 | } |
| 750 | function __srs_on_publisher_error(id, code) { | 779 | function __srs_on_publisher_error(id, code) { |
| 751 | var publisher = __srs_find_publisher(id); | 780 | var publisher = __srs_find_publisher(id); |
| 752 | - | 781 | + |
| 753 | publisher.code = code; | 782 | publisher.code = code; |
| 754 | - | 783 | + |
| 755 | publisher.on_publisher_error(code, publisher.errors[""+code]); | 784 | publisher.on_publisher_error(code, publisher.errors[""+code]); |
| 756 | } | 785 | } |
| 757 | function __srs_on_publisher_warn(id, code) { | 786 | function __srs_on_publisher_warn(id, code) { |
| 758 | var publisher = __srs_find_publisher(id); | 787 | var publisher = __srs_find_publisher(id); |
| 759 | - | 788 | + |
| 760 | publisher.code = code; | 789 | publisher.code = code; |
| 761 | - | 790 | + |
| 762 | publisher.on_publisher_warn(code, publisher.errors[""+code]); | 791 | publisher.on_publisher_warn(code, publisher.errors[""+code]); |
| 763 | } | 792 | } |
| 764 | 793 |
| @@ -53,7 +53,7 @@ | @@ -53,7 +53,7 @@ | ||
| 53 | // get the vhost and port to set the default url. | 53 | // get the vhost and port to set the default url. |
| 54 | // for example: http://192.168.1.213/players/jwplayer6.html?port=1935&vhost=demo | 54 | // for example: http://192.168.1.213/players/jwplayer6.html?port=1935&vhost=demo |
| 55 | // url set to: rtmp://demo:1935/live/livestream | 55 | // url set to: rtmp://demo:1935/live/livestream |
| 56 | - srs_init("#txt_url", null, "#main_modal"); | 56 | + //srs_init("#txt_url", null, "#main_modal"); |
| 57 | 57 | ||
| 58 | $("#main_modal").on("hide", function(){ | 58 | $("#main_modal").on("hide", function(){ |
| 59 | osmf_play("http://localhost"); | 59 | osmf_play("http://localhost"); |
| @@ -12,11 +12,107 @@ | @@ -12,11 +12,107 @@ | ||
| 12 | body{ | 12 | body{ |
| 13 | padding-top: 55px; | 13 | padding-top: 55px; |
| 14 | } | 14 | } |
| 15 | + #main_modal { | ||
| 16 | + width: 600px; | ||
| 17 | + margin-left: -300px; | ||
| 18 | + } | ||
| 19 | + #check_status { | ||
| 20 | + margin-left: 20px; | ||
| 21 | + margin-top: -55px; | ||
| 22 | + } | ||
| 23 | + #pb_buffer_bg { | ||
| 24 | + margin-top: 40px; | ||
| 25 | + margin-bottom: 10px; | ||
| 26 | + } | ||
| 15 | </style> | 27 | </style> |
| 16 | <script type="text/javascript"> | 28 | <script type="text/javascript"> |
| 29 | + | ||
| 30 | + function update_progress(percent) { | ||
| 31 | + $("#progress_bar").width(percent); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + function progress_reset() { | ||
| 35 | + $("#progress_bar").width("0%"); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + function update_status(text) { | ||
| 39 | + $("#check_status").text(text); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + function get_swf_width() { | ||
| 43 | + return 1; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + function get_swf_height() { | ||
| 47 | + return 1; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + function show_modal() { | ||
| 51 | + $("#main_modal").modal({show:true, keyboard:false}); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + function band_check(url) { | ||
| 55 | + | ||
| 56 | + // remove flash contet | ||
| 57 | + var bw_div = $("<div/>"); | ||
| 58 | + $(bw_div).attr("id", "bw_div"); | ||
| 59 | + $("#bw_center").append(bw_div); | ||
| 60 | + | ||
| 61 | + var flashvars = {}; | ||
| 62 | + flashvars.url = url; | ||
| 63 | + flashvars.update_progress = "update_progress"; | ||
| 64 | + flashvars.progress_reset = "progress_reset"; | ||
| 65 | + flashvars.update_status = "update_status"; | ||
| 66 | + | ||
| 67 | + var params = {}; | ||
| 68 | + params.allowFullScreen = true; | ||
| 69 | + | ||
| 70 | + var attributes = {}; | ||
| 71 | + | ||
| 72 | + swfobject.embedSWF( | ||
| 73 | + "srs_bwt/release/srs_bwt.swf", "bw_div", | ||
| 74 | + get_swf_width(), get_swf_height(), | ||
| 75 | + "11.1.0", "js/AdobeFlashPlayerInstall.swf", | ||
| 76 | + flashvars, params, attributes | ||
| 77 | + ); | ||
| 78 | + } | ||
| 79 | + | ||
| 17 | $(function(){ | 80 | $(function(){ |
| 18 | update_nav(); | 81 | update_nav(); |
| 19 | - }); | 82 | + srs_init_bwt("#txt_url"); |
| 83 | + | ||
| 84 | + var txt_input = $("#txt_url").val(); | ||
| 85 | + // if valid ? | ||
| 86 | + if (!srs_bwt_check_url(txt_input)) { | ||
| 87 | + $("#txt_url").val(srs_bwt_build_default_url()); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + $("#main_modal").on( | ||
| 91 | + "show", | ||
| 92 | + function() | ||
| 93 | + { | ||
| 94 | + progress_reset(); | ||
| 95 | + update_status(""); | ||
| 96 | + var url = $("#txt_url").val(); | ||
| 97 | + /*! | ||
| 98 | + url encode | ||
| 99 | + */ | ||
| 100 | + url = escape(url); | ||
| 101 | + band_check(url); | ||
| 102 | + } | ||
| 103 | + ); | ||
| 104 | + | ||
| 105 | + $("#main_modal").on("hide", function(){ | ||
| 106 | + $("#bw_div").remove(); | ||
| 107 | + }); | ||
| 108 | + | ||
| 109 | + $("#btn_play").click( | ||
| 110 | + function() | ||
| 111 | + { | ||
| 112 | + $("#main_modal").modal({show:true, keyboard:false}); | ||
| 113 | + } | ||
| 114 | + ); | ||
| 115 | + }); | ||
| 20 | </script> | 116 | </script> |
| 21 | </head> | 117 | </head> |
| 22 | <body> | 118 | <body> |
| @@ -39,6 +135,34 @@ | @@ -39,6 +135,34 @@ | ||
| 39 | </div> | 135 | </div> |
| 40 | </div> | 136 | </div> |
| 41 | <div class="container"> | 137 | <div class="container"> |
| 138 | + | ||
| 139 | + <div class="form-inline"> | ||
| 140 | + URL: | ||
| 141 | + <input type="text" id="txt_url" class="input-xxlarge" value="" placeholder="例如:rtmp://host:port/app?key=xx&vhost=yy"></input> | ||
| 142 | + <button class="btn btn-primary" id="btn_play">开始测速</button> | ||
| 143 | + </div> | ||
| 144 | + | ||
| 145 | + <div id="main_modal" class="modal hide fade"> | ||
| 146 | + <div class="modal-header"> | ||
| 147 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
| 148 | + <h3>SRS Band Check</h3> | ||
| 149 | + </div> | ||
| 150 | + <div class="modal-body"> | ||
| 151 | + <div id="player"></div> | ||
| 152 | + <div class="progress progress-striped active" id="pb_buffer_bg"> | ||
| 153 | + <div class="bar" style="width: 50%;" id="progress_bar"></div> | ||
| 154 | + </div> | ||
| 155 | + </div> | ||
| 156 | + | ||
| 157 | + <div class="modal-body" id="bw_center"> | ||
| 158 | + </div> | ||
| 159 | + <span id="check_status1"><font ><strong id="check_status">status</strong></font> </span> | ||
| 160 | + | ||
| 161 | + <div class="modal-footer"> | ||
| 162 | + <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"> 关闭 </button> | ||
| 163 | + </div> | ||
| 164 | + </div> | ||
| 165 | + | ||
| 42 | <hr> | 166 | <hr> |
| 43 | <footer> | 167 | <footer> |
| 44 | <p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team © 2013</a></p> | 168 | <p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team © 2013</a></p> |
| @@ -40,6 +40,8 @@ cat<<END | @@ -40,6 +40,8 @@ cat<<END | ||
| 40 | http://$ip/players/srs_publisher.html?vhost=players | 40 | http://$ip/players/srs_publisher.html?vhost=players |
| 41 | 视频会议(聊天室)应用演示: | 41 | 视频会议(聊天室)应用演示: |
| 42 | http://$ip/players/srs_chat.html?vhost=players | 42 | http://$ip/players/srs_chat.html?vhost=players |
| 43 | +默认的测速应用演示: | ||
| 44 | + http://$ip/players/srs_bwt.html?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com | ||
| 43 | END | 45 | END |
| 44 | echo -e "${GREEN}演示地址:${BLACK}" | 46 | echo -e "${GREEN}演示地址:${BLACK}" |
| 45 | echo -e "${RED} http://$ip${BLACK}" | 47 | echo -e "${RED} http://$ip${BLACK}" |
-
请 注册 或 登录 后发表评论