正在显示
7 个修改的文件
包含
66 行增加
和
61 行删除
@@ -251,7 +251,7 @@ function srs_initialize_codec_page( | @@ -251,7 +251,7 @@ function srs_initialize_codec_page( | ||
251 | 251 | ||
252 | $(sl_size).empty(); | 252 | $(sl_size).empty(); |
253 | var sizes = ["176x144", "320x240", "352x240", | 253 | var sizes = ["176x144", "320x240", "352x240", |
254 | - "352x288", "460x240", "640x480", "720x480", "720x576", "800x600", | 254 | + "352x288", "480x360", "640x480", "720x480", "720x576", "800x600", |
255 | "1024x768", "1280x720", "1360x768", "1920x1080"]; | 255 | "1024x768", "1280x720", "1360x768", "1920x1080"]; |
256 | for (i = 0; i < sizes.length; i++) { | 256 | for (i = 0; i < sizes.length; i++) { |
257 | $(sl_size).append("<option value='" + sizes[i] + "'>" + sizes[i] + "</option"); | 257 | $(sl_size).append("<option value='" + sizes[i] + "'>" + sizes[i] + "</option"); |
@@ -294,7 +294,7 @@ function srs_publisher_initialize_page( | @@ -294,7 +294,7 @@ function srs_publisher_initialize_page( | ||
294 | $(sl_gop + " option[value='10']").attr("selected", true); | 294 | $(sl_gop + " option[value='10']").attr("selected", true); |
295 | 295 | ||
296 | //var sizes = ["176x144", "320x240", "352x240", | 296 | //var sizes = ["176x144", "320x240", "352x240", |
297 | - // "352x288", "460x240", "640x480", "720x480", "720x576", "800x600", | 297 | + // "352x288", "480x360", "640x480", "720x480", "720x576", "800x600", |
298 | // "1024x768", "1280x720", "1360x768", "1920x1080"]; | 298 | // "1024x768", "1280x720", "1360x768", "1920x1080"]; |
299 | $(sl_size + " option[value='640x480']").attr("selected", true); | 299 | $(sl_size + " option[value='640x480']").attr("selected", true); |
300 | 300 | ||
@@ -322,16 +322,16 @@ function srs_chat_initialize_page( | @@ -322,16 +322,16 @@ function srs_chat_initialize_page( | ||
322 | 322 | ||
323 | //var levels = ["1", "1b", "1.1", "1.2", "1.3", | 323 | //var levels = ["1", "1b", "1.1", "1.2", "1.3", |
324 | // "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1"]; | 324 | // "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1"]; |
325 | - $(sl_level + " option[value='2.1']").attr("selected", true); | 325 | + $(sl_level + " option[value='3.1']").attr("selected", true); |
326 | 326 | ||
327 | //var gops = ["0.3", "0.5", "1", "2", "3", "4", | 327 | //var gops = ["0.3", "0.5", "1", "2", "3", "4", |
328 | // "5", "6", "7", "8", "9", "10", "15", "20"]; | 328 | // "5", "6", "7", "8", "9", "10", "15", "20"]; |
329 | - $(sl_gop + " option[value='1']").attr("selected", true); | 329 | + $(sl_gop + " option[value='2']").attr("selected", true); |
330 | 330 | ||
331 | //var sizes = ["176x144", "320x240", "352x240", | 331 | //var sizes = ["176x144", "320x240", "352x240", |
332 | - // "352x288", "460x240", "640x480", "720x480", "720x576", "800x600", | 332 | + // "352x288", "480x360", "640x480", "720x480", "720x576", "800x600", |
333 | // "1024x768", "1280x720", "1360x768", "1920x1080"]; | 333 | // "1024x768", "1280x720", "1360x768", "1920x1080"]; |
334 | - $(sl_size + " option[value='640x480']").attr("selected", true); | 334 | + $(sl_size + " option[value='480x360']").attr("selected", true); |
335 | 335 | ||
336 | //var fpses = ["5", "10", "15", "20", "24", "25", "29.97", "30"]; | 336 | //var fpses = ["5", "10", "15", "20", "24", "25", "29.97", "30"]; |
337 | $(sl_fps + " option[value='15']").attr("selected", true); | 337 | $(sl_fps + " option[value='15']").attr("selected", true); |
@@ -113,13 +113,13 @@ SrsPlayer.prototype.resume = function() { | @@ -113,13 +113,13 @@ SrsPlayer.prototype.resume = function() { | ||
113 | this.callbackObj.ref.__resume(); | 113 | this.callbackObj.ref.__resume(); |
114 | } | 114 | } |
115 | /** | 115 | /** |
116 | -* to set the DAR, for example, DAR=16:9 | ||
117 | -* @param num, for example, 9. | ||
118 | -* use metadata height if 0. | ||
119 | -* use user specified height if -1. | ||
120 | -* @param den, for example, 16. | 116 | +* to set the DAR, for example, DAR=16:9 where num=16,den=9. |
117 | +* @param num, for example, 16. | ||
121 | * use metadata width if 0. | 118 | * use metadata width if 0. |
122 | * use user specified width if -1. | 119 | * use user specified width if -1. |
120 | +* @param den, for example, 9. | ||
121 | +* use metadata height if 0. | ||
122 | +* use user specified height if -1. | ||
123 | */ | 123 | */ |
124 | SrsPlayer.prototype.set_dar = function(num, den) { | 124 | SrsPlayer.prototype.set_dar = function(num, den) { |
125 | this.callbackObj.ref.__set_dar(num, den); | 125 | this.callbackObj.ref.__set_dar(num, den); |
@@ -17,6 +17,9 @@ | @@ -17,6 +17,9 @@ | ||
17 | body{ | 17 | body{ |
18 | padding-top: 55px; | 18 | padding-top: 55px; |
19 | } | 19 | } |
20 | + .accordion-group { | ||
21 | + width: 310px; | ||
22 | + } | ||
20 | </style> | 23 | </style> |
21 | <script type="text/javascript"> | 24 | <script type="text/javascript"> |
22 | var srs_publisher = null; | 25 | var srs_publisher = null; |
@@ -34,6 +37,19 @@ | @@ -34,6 +37,19 @@ | ||
34 | // url set to: rtmp://demo:1935/live/livestream | 37 | // url set to: rtmp://demo:1935/live/livestream |
35 | srs_init_publish("#txt_url"); | 38 | srs_init_publish("#txt_url"); |
36 | 39 | ||
40 | + // support 5x3+1 users | ||
41 | + for (var i = 0; i < 5; i++) { | ||
42 | + var tr = $("<tr></tr>").hide(); | ||
43 | + $("#lst_chats").append(tr); | ||
44 | + | ||
45 | + for (var j = 0; j < 3; j++) { | ||
46 | + tr.append($("<td></td>").attr("id", "td_" + ((i+1) * 8 + j))); | ||
47 | + } | ||
48 | + } | ||
49 | + // remove border of row. | ||
50 | + $("#lst_chats").find("td").css("border", "none").css("padding", "2px") | ||
51 | + .css("padding-left", "0px").css("width", "327px"); | ||
52 | + | ||
37 | if (query.agent == "true") { | 53 | if (query.agent == "true") { |
38 | document.write(navigator.userAgent); | 54 | document.write(navigator.userAgent); |
39 | return; | 55 | return; |
@@ -60,7 +76,7 @@ | @@ -60,7 +76,7 @@ | ||
60 | $("#txt_url").val($("#txt_url").val() + "." + new Date().getTime()); | 76 | $("#txt_url").val($("#txt_url").val() + "." + new Date().getTime()); |
61 | 77 | ||
62 | // start the publisher. | 78 | // start the publisher. |
63 | - srs_publisher = new SrsPublisher("local_publisher", 430, 185); | 79 | + srs_publisher = new SrsPublisher("local_publisher", 280, 180); |
64 | srs_publisher.on_publisher_ready = function(cameras, microphones) { | 80 | srs_publisher.on_publisher_ready = function(cameras, microphones) { |
65 | srs_chat_initialize_page( | 81 | srs_chat_initialize_page( |
66 | cameras, microphones, | 82 | cameras, microphones, |
@@ -85,7 +101,7 @@ | @@ -85,7 +101,7 @@ | ||
85 | 101 | ||
86 | if (!no_play) { | 102 | if (!no_play) { |
87 | // start the realtime player. | 103 | // start the realtime player. |
88 | - realtime_player = new SrsPlayer("realtime_player", 430, 185); | 104 | + realtime_player = new SrsPlayer("realtime_player", 280, 180); |
89 | realtime_player.on_player_ready = function() { | 105 | realtime_player.on_player_ready = function() { |
90 | this.set_bt(0.5); | 106 | this.set_bt(0.5); |
91 | }; | 107 | }; |
@@ -98,18 +114,6 @@ | @@ -98,18 +114,6 @@ | ||
98 | realtime_player.start(); | 114 | realtime_player.start(); |
99 | } | 115 | } |
100 | 116 | ||
101 | - // 2x8 users | ||
102 | - for (var i = 0; i < 8; i++) { | ||
103 | - var tr = $("<tr></tr>").hide(); | ||
104 | - $("#lst_chats").append(tr); | ||
105 | - | ||
106 | - for (var j = 0; j < 2; j++) { | ||
107 | - tr.append($("<td></td>").attr("id", "td_" + (i * 8 + j))); | ||
108 | - } | ||
109 | - } | ||
110 | - // remove border of row. | ||
111 | - $("#lst_chats").find("td").css("border", "none"); | ||
112 | - | ||
113 | $("#txt_name").focus(); | 117 | $("#txt_name").focus(); |
114 | 118 | ||
115 | api_server = "http://" + query.hostname + ":" + srs_get_api_server_port() + "/api/v1/chats"; | 119 | api_server = "http://" + query.hostname + ":" + srs_get_api_server_port() + "/api/v1/chats"; |
@@ -321,7 +325,7 @@ | @@ -321,7 +325,7 @@ | ||
321 | $(obj).find("#chat_player_raw").attr("id", "rp_raw_" + chat.id); // for specifed player: $("#rp_raw_" + chat_id) | 325 | $(obj).find("#chat_player_raw").attr("id", "rp_raw_" + chat.id); // for specifed player: $("#rp_raw_" + chat_id) |
322 | $(obj).find("#user_name").text(chat.username); | 326 | $(obj).find("#user_name").text(chat.username); |
323 | $(obj).find("#user_player_url").attr("href", chat.url); | 327 | $(obj).find("#user_player_url").attr("href", chat.url); |
324 | - $(obj).find("#join_date").text(chat.join_date_str); | 328 | + $(obj).find("#join_date").text(chat.join_date_str.split(" ")[1]); |
325 | $(obj).find("#collapseM").attr("id", "collapse_" + global_chat_user_id); | 329 | $(obj).find("#collapseM").attr("id", "collapse_" + global_chat_user_id); |
326 | $(obj).find("#headerN").attr("href", "#collapse_" + global_chat_user_id); | 330 | $(obj).find("#headerN").attr("href", "#collapse_" + global_chat_user_id); |
327 | } | 331 | } |
@@ -352,7 +356,7 @@ | @@ -352,7 +356,7 @@ | ||
352 | 356 | ||
353 | if (!no_play) { | 357 | if (!no_play) { |
354 | // start the realtime player. | 358 | // start the realtime player. |
355 | - var _player = new SrsPlayer("rp_raw_" + chat.id, 430, 185, chat); | 359 | + var _player = new SrsPlayer("rp_raw_" + chat.id, 240, 180, chat); |
356 | _player.on_player_ready = function() { | 360 | _player.on_player_ready = function() { |
357 | this.set_bt(0.5); | 361 | this.set_bt(0.5); |
358 | this.play(); | 362 | this.play(); |
@@ -580,7 +584,7 @@ | @@ -580,7 +584,7 @@ | ||
580 | </div> | 584 | </div> |
581 | <table id="lst_chats" class="table"> | 585 | <table id="lst_chats" class="table"> |
582 | <tr> | 586 | <tr> |
583 | - <td> | 587 | + <td id="td_0"> |
584 | <div class="accordion-group"> | 588 | <div class="accordion-group"> |
585 | <div class="accordion-heading"> | 589 | <div class="accordion-heading"> |
586 | <span class="accordion-toggle"> | 590 | <span class="accordion-toggle"> |
@@ -594,7 +598,7 @@ | @@ -594,7 +598,7 @@ | ||
594 | </div> | 598 | </div> |
595 | </div> | 599 | </div> |
596 | </td> | 600 | </td> |
597 | - <td> | 601 | + <td id="td_1"> |
598 | <div class="accordion-group"> | 602 | <div class="accordion-group"> |
599 | <div class="accordion-heading"> | 603 | <div class="accordion-heading"> |
600 | <span class="accordion-toggle"> | 604 | <span class="accordion-toggle"> |
@@ -611,6 +615,7 @@ | @@ -611,6 +615,7 @@ | ||
611 | </div> | 615 | </div> |
612 | </div> | 616 | </div> |
613 | </td> | 617 | </td> |
618 | + <td id="td_2"></td> | ||
614 | </tr> | 619 | </tr> |
615 | </table> | 620 | </table> |
616 | <div class="container hide" id="template"> | 621 | <div class="container hide" id="template"> |
@@ -196,13 +196,13 @@ | @@ -196,13 +196,13 @@ | ||
196 | select_dar("#btn_dar_original", 0, 0); | 196 | select_dar("#btn_dar_original", 0, 0); |
197 | }); | 197 | }); |
198 | $("#btn_dar_21_9").click(function(){ | 198 | $("#btn_dar_21_9").click(function(){ |
199 | - select_dar("#btn_dar_21_9", 9, 21); | 199 | + select_dar("#btn_dar_21_9", 21, 9); |
200 | }); | 200 | }); |
201 | $("#btn_dar_16_9").click(function(){ | 201 | $("#btn_dar_16_9").click(function(){ |
202 | - select_dar("#btn_dar_16_9", 9, 16); | 202 | + select_dar("#btn_dar_16_9", 16, 9); |
203 | }); | 203 | }); |
204 | $("#btn_dar_4_3").click(function(){ | 204 | $("#btn_dar_4_3").click(function(){ |
205 | - select_dar("#btn_dar_4_3", 3, 4); | 205 | + select_dar("#btn_dar_4_3", 4, 3); |
206 | }); | 206 | }); |
207 | $("#btn_dar_fill").click(function(){ | 207 | $("#btn_dar_fill").click(function(){ |
208 | select_dar("#btn_dar_fill", -1, -1); | 208 | select_dar("#btn_dar_fill", -1, -1); |
@@ -37,8 +37,8 @@ package | @@ -37,8 +37,8 @@ package | ||
37 | private var user_w:int = 0; | 37 | private var user_w:int = 0; |
38 | private var user_h:int = 0; | 38 | private var user_h:int = 0; |
39 | // user set dar den:num | 39 | // user set dar den:num |
40 | - private var user_dar_num:int = 0; | ||
41 | private var user_dar_den:int = 0; | 40 | private var user_dar_den:int = 0; |
41 | + private var user_dar_num:int = 0; | ||
42 | // user set fs(fullscreen) refer and percent. | 42 | // user set fs(fullscreen) refer and percent. |
43 | private var user_fs_refer:String = null; | 43 | private var user_fs_refer:String = null; |
44 | private var user_fs_percent:int = 0; | 44 | private var user_fs_percent:int = 0; |
@@ -221,13 +221,13 @@ package | @@ -221,13 +221,13 @@ package | ||
221 | } | 221 | } |
222 | 222 | ||
223 | /** | 223 | /** |
224 | - * to set the DAR, for example, DAR=16:9 | ||
225 | - * @param num, for example, 9. | ||
226 | - * use metadata height if 0. | ||
227 | - * use user specified height if -1. | ||
228 | - * @param den, for example, 16. | ||
229 | - * use metadata width if 0. | ||
230 | - * use user specified width if -1. | 224 | + * to set the DAR, for example, DAR=16:9 where num=16,den=9. |
225 | + * @param num, for example, 16. | ||
226 | + * use metadata width if 0. | ||
227 | + * use user specified width if -1. | ||
228 | + * @param den, for example, 9. | ||
229 | + * use metadata height if 0. | ||
230 | + * use user specified height if -1. | ||
231 | */ | 231 | */ |
232 | private function js_call_set_dar(num:int, den:int):void { | 232 | private function js_call_set_dar(num:int, den:int):void { |
233 | user_dar_num = num; | 233 | user_dar_num = num; |
@@ -402,21 +402,21 @@ package | @@ -402,21 +402,21 @@ package | ||
402 | var obj:Object = __get_video_size_object(); | 402 | var obj:Object = __get_video_size_object(); |
403 | 403 | ||
404 | // get the DAR | 404 | // get the DAR |
405 | - var num:int = user_dar_num; | ||
406 | var den:int = user_dar_den; | 405 | var den:int = user_dar_den; |
406 | + var num:int = user_dar_num; | ||
407 | 407 | ||
408 | - if (num == 0) { | ||
409 | - num = obj.height; | 408 | + if (den == 0) { |
409 | + den = obj.height; | ||
410 | } | 410 | } |
411 | - if (num == -1) { | ||
412 | - num = this.stage.fullScreenHeight; | 411 | + if (den == -1) { |
412 | + den = this.stage.fullScreenHeight; | ||
413 | } | 413 | } |
414 | 414 | ||
415 | - if (den == 0) { | ||
416 | - den = obj.width; | 415 | + if (num == 0) { |
416 | + num = obj.width; | ||
417 | } | 417 | } |
418 | - if (den == -1) { | ||
419 | - den = this.stage.fullScreenWidth; | 418 | + if (num == -1) { |
419 | + num = this.stage.fullScreenWidth; | ||
420 | } | 420 | } |
421 | 421 | ||
422 | // for refer is screen. | 422 | // for refer is screen. |
@@ -436,23 +436,23 @@ package | @@ -436,23 +436,23 @@ package | ||
436 | */ | 436 | */ |
437 | private function __execute_user_set_dar():void { | 437 | private function __execute_user_set_dar():void { |
438 | // get the DAR | 438 | // get the DAR |
439 | - var num:int = user_dar_num; | ||
440 | var den:int = user_dar_den; | 439 | var den:int = user_dar_den; |
440 | + var num:int = user_dar_num; | ||
441 | 441 | ||
442 | var obj:Object = __get_video_size_object(); | 442 | var obj:Object = __get_video_size_object(); |
443 | 443 | ||
444 | - if (num == 0) { | ||
445 | - num = obj.height; | 444 | + if (den == 0) { |
445 | + den = obj.height; | ||
446 | } | 446 | } |
447 | - if (num == -1) { | ||
448 | - num = this.user_h; | 447 | + if (den == -1) { |
448 | + den = this.user_h; | ||
449 | } | 449 | } |
450 | 450 | ||
451 | - if (den == 0) { | ||
452 | - den = obj.width; | 451 | + if (num == 0) { |
452 | + num = obj.width; | ||
453 | } | 453 | } |
454 | - if (den == -1) { | ||
455 | - den = this.user_w; | 454 | + if (num == -1) { |
455 | + num = this.user_w; | ||
456 | } | 456 | } |
457 | 457 | ||
458 | __update_video_size(num, den, this.user_w, this.user_h, this.user_w, this.user_h); | 458 | __update_video_size(num, den, this.user_w, this.user_h, this.user_w, this.user_h); |
@@ -468,19 +468,19 @@ package | @@ -468,19 +468,19 @@ package | ||
468 | * @param _sw/_wh the stage size, >= paper size. used to center the player. | 468 | * @param _sw/_wh the stage size, >= paper size. used to center the player. |
469 | */ | 469 | */ |
470 | private function __update_video_size(_num:int, _den:int, _w:int, _h:int, _sw:int, _sh:int):void { | 470 | private function __update_video_size(_num:int, _den:int, _w:int, _h:int, _sw:int, _sh:int):void { |
471 | - if (!this.media_video || _num <= 0 || _den <= 0) { | 471 | + if (!this.media_video || _den <= 0 || _num <= 0) { |
472 | return; | 472 | return; |
473 | } | 473 | } |
474 | 474 | ||
475 | // set DAR. | 475 | // set DAR. |
476 | // calc the height by DAR | 476 | // calc the height by DAR |
477 | - var _height:int = _w * _num / _den; | 477 | + var _height:int = _w * _den / _num; |
478 | if (_height <= _h) { | 478 | if (_height <= _h) { |
479 | this.media_video.width = _w; | 479 | this.media_video.width = _w; |
480 | this.media_video.height = _height; | 480 | this.media_video.height = _height; |
481 | } else { | 481 | } else { |
482 | // height overflow, calc the width by DAR | 482 | // height overflow, calc the width by DAR |
483 | - var _width:int = _h * _den / _num; | 483 | + var _width:int = _h * _num / _den; |
484 | 484 | ||
485 | this.media_video.width = _width; | 485 | this.media_video.width = _width; |
486 | this.media_video.height = _h; | 486 | this.media_video.height = _h; |
-
请 注册 或 登录 后发表评论