正在显示
1 个修改的文件
包含
56 行增加
和
7 行删除
@@ -313,12 +313,38 @@ | @@ -313,12 +313,38 @@ | ||
313 | <li><a id="btn_bt_0_3" href="#">0.3秒(实时)</a></li> | 313 | <li><a id="btn_bt_0_3" href="#">0.3秒(实时)</a></li> |
314 | <li><a id="btn_bt_0_5" href="#">0.5秒(实时)</a></li> | 314 | <li><a id="btn_bt_0_5" href="#">0.5秒(实时)</a></li> |
315 | <li><a id="btn_bt_0_8" href="#">0.8秒(会议)</a></li> | 315 | <li><a id="btn_bt_0_8" href="#">0.8秒(会议)</a></li> |
316 | - <li><a id="btn_bt_1" href="#">1秒(低延迟)</a></li> | ||
317 | - <li><a id="btn_bt_2" href="#">2秒(较低延时)</a></li> | ||
318 | - <li><a id="btn_bt_3" href="#">3秒(流畅播放)</a></li> | ||
319 | - <li><a id="btn_bt_5" href="#">5秒(网速较低)</a></li> | ||
320 | - <li><a id="btn_bt_10" href="#">10秒(无所谓延迟)</a></li> | ||
321 | - <li><a id="btn_bt_30" href="#">30秒(流畅第一)</a></li> | 316 | + <li><a id="btn_bt_1_0" href="#">1秒(低延迟)</a></li> |
317 | + <li><a id="btn_bt_2_0" href="#">2秒(较低延时)</a></li> | ||
318 | + <li><a id="btn_bt_3_0" href="#">3秒(流畅播放)</a></li> | ||
319 | + <li><a id="btn_bt_4_0" href="#">4秒(流畅播放)</a></li> | ||
320 | + <li><a id="btn_bt_5_0" href="#">5秒(网速较低)</a></li> | ||
321 | + <li><a id="btn_bt_6_0" href="#">6秒(网速较低)</a></li> | ||
322 | + <li><a id="btn_bt_8_0" href="#">8秒(网速较低)</a></li> | ||
323 | + <li><a id="btn_bt_10_0" href="#">10秒(无所谓延迟)</a></li> | ||
324 | + <li><a id="btn_bt_15_0" href="#">15秒(无所谓延迟)</a></li> | ||
325 | + <li><a id="btn_bt_20_0" href="#">20秒(无所谓延迟)</a></li> | ||
326 | + <li><a id="btn_bt_30_0" href="#">30秒(流畅第一)</a></li> | ||
327 | + </ul> | ||
328 | + </div> | ||
329 | + <div class="btn-group dropup"> | ||
330 | + <button class="btn dropdown-toggle" data-toggle="dropdown">最大缓冲区<span class="caret"></span></button> | ||
331 | + <ul class="dropdown-menu"> | ||
332 | + <li><a id="btn_mbt_0_6" href="#">0.6秒(实时)</a></li> | ||
333 | + <li><a id="btn_mbt_0_9" href="#">0.9秒(实时)</a></li> | ||
334 | + <li><a id="btn_mbt_1_2" href="#">1.2秒(实时)</a></li> | ||
335 | + <li><a id="btn_mbt_1_5" href="#">1.5秒(实时)</a></li> | ||
336 | + <li><a id="btn_mbt_2_4" href="#">2.4秒(会议)</a></li> | ||
337 | + <li><a id="btn_mbt_3_0" href="#">3秒(低延迟)</a></li> | ||
338 | + <li><a id="btn_mbt_6_0" href="#">6秒(较低延时)</a></li> | ||
339 | + <li><a id="btn_mbt_9_0" href="#">9秒(流畅播放)</a></li> | ||
340 | + <li><a id="btn_mbt_12_0" href="#">12秒(流畅播放)</a></li> | ||
341 | + <li><a id="btn_mbt_15_0" href="#">15秒(网速较低)</a></li> | ||
342 | + <li><a id="btn_mbt_18_0" href="#">18秒(网速较低)</a></li> | ||
343 | + <li><a id="btn_mbt_24_0" href="#">24秒(网速较低)</a></li> | ||
344 | + <li><a id="btn_mbt_30_0" href="#">30秒(无所谓延迟)</a></li> | ||
345 | + <li><a id="btn_mbt_45_0" href="#">45秒(无所谓延迟)</a></li> | ||
346 | + <li><a id="btn_mbt_60_0" href="#">60秒(无所谓延迟)</a></li> | ||
347 | + <li><a id="btn_mbt_90_0" href="#">90秒(流畅第一)</a></li> | ||
322 | </ul> | 348 | </ul> |
323 | </div> | 349 | </div> |
324 | <div class="btn-group dropup"> | 350 | <div class="btn-group dropup"> |
@@ -430,6 +456,13 @@ | @@ -430,6 +456,13 @@ | ||
430 | // url set to: rtmp://demo:1935/live/livestream | 456 | // url set to: rtmp://demo:1935/live/livestream |
431 | srs_init_rtmp("#txt_url", "#main_modal"); | 457 | srs_init_rtmp("#txt_url", "#main_modal"); |
432 | 458 | ||
459 | + // consts for buffer and max buffer. | ||
460 | + var bts = [0.1, 0.2, 0.3, 0.5, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 30]; | ||
461 | + var mbts = [0.6, 0.9, 1.2, 1.5, 2.4, 3, 6, 9, 12, 15, 18, 24, 30, 45, 60, 90]; | ||
462 | + | ||
463 | + // the play startup time. | ||
464 | + var pst = new Date(); | ||
465 | + | ||
433 | $("#main_modal").on("show", function(){ | 466 | $("#main_modal").on("show", function(){ |
434 | if (srs_player) { | 467 | if (srs_player) { |
435 | return; | 468 | return; |
@@ -447,7 +480,23 @@ | @@ -447,7 +480,23 @@ | ||
447 | 480 | ||
448 | srs_player = new SrsPlayer("player_id", srs_get_player_width(), srs_get_player_height()); | 481 | srs_player = new SrsPlayer("player_id", srs_get_player_width(), srs_get_player_height()); |
449 | srs_player.on_player_ready = function() { | 482 | srs_player.on_player_ready = function() { |
450 | - select_buffer_time("#btn_bt_0_1", 0.1); | 483 | + var buffer_time = 0.5; |
484 | + if (url.indexOf('.m3u8') > 0) { | ||
485 | + buffer_time = 2; | ||
486 | + } | ||
487 | + | ||
488 | + if (query.buffer) { | ||
489 | + for (var i = 0; i < bts.length - 1; i++) { | ||
490 | + var cur = bts[i]; | ||
491 | + var next = bts[i+1]; | ||
492 | + if (Number(query.buffer) >= cur && Number(query.buffer) < next) { | ||
493 | + buffer_time = cur; | ||
494 | + break; | ||
495 | + } | ||
496 | + } | ||
497 | + } | ||
498 | + | ||
499 | + select_buffer(buffer_time); | ||
451 | this.play(url); | 500 | this.play(url); |
452 | }; | 501 | }; |
453 | srs_player.on_player_metadata = function(metadata) { | 502 | srs_player.on_player_metadata = function(metadata) { |
-
请 注册 或 登录 后发表评论