2
0

srs_publisher_flash.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>SRS</title>
  5. <meta charset="utf-8">
  6. <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
  7. <style>
  8. body{
  9. padding-top: 30px;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <img src='https://ossrs.net/gif/v1/sls.gif?site=ossrs.net&path=/player/srspublisher'/>
  15. <div class="navbar navbar-fixed-top">
  16. <div class="navbar-inner">
  17. <div class="container">
  18. <a id="srs_index" class="brand" href="#">SRS</a>
  19. <div class="nav-collapse collapse">
  20. <ul class="nav">
  21. <li><a id="nav_srs_player" href="srs_player.html">SRS播放器</a></li>
  22. </ul>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="container">
  28. <div name="detect_flash">
  29. <div id="main_flash_alert" class="alert alert-danger fade in hide">
  30. <button type="button" class="close" data-dismiss="alert">×</button>
  31. <strong><p>Usage:</p></strong>
  32. <p>
  33. 请点击下面的图标,启用Flash
  34. </p>
  35. <p>
  36. 若没有见到这个图标,Chrome浏览器请打开
  37. <span class="text-info">chrome://settings/content/flash</span> 并修改为"Ask first"。
  38. </p>
  39. </div>
  40. <div id="main_flash_hdr" class="hide">
  41. </div>
  42. </div>
  43. <div id="main_content" class="hide">
  44. <div class="alert alert-danger fade in">
  45. <button type="button" class="close" data-dismiss="alert">×</button>
  46. <strong><span>Remark:</span></strong>
  47. <span>Flash推流只支持H.264+Speex,音频不支持AAC,所以无法输出HLS</span>
  48. </div>
  49. <div class="alert alert-info fade in" id="txt_log">
  50. <button type="button" class="close" data-dismiss="alert">×</button>
  51. <strong><span id="txt_log_title">Usage:</span></strong>
  52. <span id="txt_log_msg">设置编码参数,点“发布视频”,允许Flash访问摄像头即可推流</span>
  53. </div>
  54. <div class="control-group">
  55. <div class="form-inline">
  56. <button class="btn" id="btn_video_settings">视频编码配置</button>
  57. <button class="btn" id="btn_audio_settings">音频编码配置</button>
  58. </div>
  59. </div>
  60. <div class="control-group">
  61. <div class="form-inline">
  62. 发布地址:
  63. <input type="text" id="txt_url" class="input-xxlarge" value=""></input>
  64. <button class="btn btn-primary" id="btn_publish">发布视频</button>
  65. <label class="checkbox">
  66. <input type="checkbox" id="cb_preview" checked>预览
  67. </label>
  68. <a id="txt_play_realtime" class="input-xxlarge" href="#">RTMP播放地址(请发布视频)</a>
  69. </div>
  70. </div>
  71. <div id="video_modal" class="modal hide fade">
  72. <div class="modal-header">
  73. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  74. <h3>视频编码</h3>
  75. </div>
  76. <div class="modal-body">
  77. <div class="form-horizontal">
  78. <div class="control-group">
  79. <label class="control-label" for="sl_cameras">
  80. 摄像头
  81. <a id="sl_cameras_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  82. <img src="img/tooltip.png"/>
  83. </a>
  84. </label>
  85. <div class="controls">
  86. <select class="span4" id="sl_cameras"></select>
  87. </div>
  88. </div>
  89. <div class="control-group">
  90. <label class="control-label" for="sl_vcodec">
  91. Codec
  92. <a id="sl_cameras_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  93. <img src="img/tooltip.png"/>
  94. </a>
  95. </label>
  96. <div class="controls">
  97. <select class="span2" id="sl_vcodec"></select>
  98. </div>
  99. </div>
  100. <div class="control-group">
  101. <label class="control-label" for="sl_profile">
  102. Profile
  103. <a id="sl_profile_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  104. <img src="img/tooltip.png"/>
  105. </a>
  106. </label>
  107. <div class="controls">
  108. <select class="span2" id="sl_profile"></select>
  109. </div>
  110. </div>
  111. <div class="control-group">
  112. <label class="control-label" for="sl_level">
  113. Level
  114. <a id="sl_level_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  115. <img src="img/tooltip.png"/>
  116. </a>
  117. </label>
  118. <div class="controls">
  119. <select class="span2" id="sl_level"></select>
  120. </div>
  121. </div>
  122. <div class="control-group">
  123. <label class="control-label" for="sl_gop">
  124. GOP
  125. <a id="sl_gop_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  126. <img src="img/tooltip.png"/>
  127. </a>
  128. </label>
  129. <div class="controls">
  130. <select class="span2" id="sl_gop"></select>
  131. </div>
  132. </div>
  133. <div class="control-group">
  134. <label class="control-label" for="sl_size">
  135. 尺寸
  136. <a id="sl_size_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  137. <img src="img/tooltip.png"/>
  138. </a>
  139. </label>
  140. <div class="controls">
  141. <select class="span2" id="sl_size"></select>
  142. </div>
  143. </div>
  144. <div class="control-group">
  145. <label class="control-label" for="sl_fps">
  146. 帧率
  147. <a id="sl_fps_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  148. <img src="img/tooltip.png"/>
  149. </a>
  150. </label>
  151. <div class="controls">
  152. <select class="span2" id="sl_fps"></select>
  153. </div>
  154. </div>
  155. <div class="control-group">
  156. <label class="control-label" for="sl_bitrate">
  157. 码率
  158. <a id="sl_bitrate_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  159. <img src="img/tooltip.png"/>
  160. </a>
  161. </label>
  162. <div class="controls">
  163. <select class="span2" id="sl_bitrate"></select>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="modal-footer">
  169. <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">设置</button>
  170. </div>
  171. </div>
  172. <div id="audio_modal" class="modal hide fade">
  173. <div class="modal-header">
  174. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  175. <h3>音频编码</h3>
  176. </div>
  177. <div class="modal-body">
  178. <div class="form-horizontal">
  179. <div class="control-group">
  180. <label class="control-label" for="sl_microphones">
  181. 麦克风
  182. <a id="worker_id_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  183. <img src="img/tooltip.png"/>
  184. </a>
  185. </label>
  186. <div class="controls">
  187. <select class="span4" id="sl_microphones"></select>
  188. </div>
  189. </div>
  190. <div class="control-group">
  191. <label class="control-label" for="sl_acodec">
  192. 编码
  193. <a id="sl_acodec_tips" href="#" data-toggle="tooltip" data-placement="right" title="">
  194. <img src="img/tooltip.png"/>
  195. </a>
  196. </label>
  197. <div class="controls">
  198. <select class="span2" id="sl_acodec"></select>
  199. </div>
  200. </div>
  201. </div>
  202. </div>
  203. <div class="modal-footer">
  204. <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">设置</button>
  205. </div>
  206. </div>
  207. <div class="container">
  208. <div class="row-fluid">
  209. <div class="span6">
  210. <div class="accordion-group">
  211. <div class="accordion-heading">
  212. <span class="accordion-toggle">
  213. <strong>本地摄像头</strong>
  214. </span>
  215. </div>
  216. <div class="accordion-body collapse in">
  217. <div class="accordion-inner">
  218. <div id="local_publisher"></div>
  219. </div>
  220. </div>
  221. </div>
  222. </div>
  223. <div class="span6">
  224. <div class="accordion-group">
  225. <div class="accordion-heading">
  226. <span class="accordion-toggle">
  227. <strong>远程服务器</strong>
  228. <a id="low_latecy_tips" href="#" data-toggle="tooltip" data-placement="top" title="">
  229. 低延时<img src="img/tooltip.png"/>
  230. </a>
  231. <a id="realtime_player_url" href="#" data-toggle="tooltip" data-placement="top" title="">
  232. 播放地址<img src="img/tooltip.png"/>
  233. </a>
  234. </span>
  235. </div>
  236. <div class="accordion-body collapse in">
  237. <div class="accordion-inner">
  238. <div id="realtime_player"></div>
  239. </div>
  240. </div>
  241. </div>
  242. </div>
  243. </div>
  244. </div>
  245. </div>
  246. <footer>
  247. <p></p>
  248. <p><a href="https://github.com/ossrs/srs">SRS Team &copy; 2013</a></p>
  249. </footer>
  250. </div>
  251. </body>
  252. <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
  253. <script type="text/javascript" src="js/bootstrap.min.js"></script>
  254. <script type="text/javascript" src="js/swfobject.js"></script>
  255. <script type="text/javascript" src="js/json2.js"></script>
  256. <script type="text/javascript" src="js/srs.page.js"></script>
  257. <script type="text/javascript" src="js/srs.log.js"></script>
  258. <script type="text/javascript" src="js/srs.player.js"></script>
  259. <script type="text/javascript" src="js/srs.publisher.js"></script>
  260. <script type="text/javascript" src="js/srs.utility.js"></script>
  261. <script type="text/javascript" src="js/winlin.utility.js"></script>
  262. <script type="text/javascript">
  263. var __on_flash_ready = null;
  264. $(function(){
  265. // 探测Flash是否正常启用。
  266. $('#main_flash_hdr').html(
  267. '\
  268. <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="100%"> \
  269. <param name="movie" value="srs_player/release/srs_player.swf"> \
  270. <param name="quality" value="autohigh"> \
  271. <param name="swliveconnect" value="true"> \
  272. <param name="allowScriptAccess" value="always"> \
  273. <param name="bgcolor" value="#0"> \
  274. <param name="allowFullScreen" value="true"> \
  275. <param name="wmode" value="opaque"> \
  276. <param name="FlashVars" value="log=1"> \
  277. <param name="flashvars" value="id=1&on_player_ready=__on_flash_ready"> \
  278. <embed src="srs_player/release/srs_player.swf" width="100%" height="100%" \
  279. quality="autohigh" bgcolor="#0" align="middle" allowfullscreen="true" allowscriptaccess="always" \
  280. type="application/x-shockwave-flash" swliveconnect="true" wmode="opaque" \
  281. flashvars="id=1&on_player_ready=__on_flash_ready" \
  282. pluginspage="http://www.macromedia.com/go/getflashplayer"> \
  283. </object> \
  284. '
  285. );
  286. $('#main_flash_hdr').show();
  287. var showFlashHdr = setTimeout(function(){
  288. $('#main_flash_alert').show();
  289. }, 300);
  290. __on_flash_ready = function (id) {
  291. clearTimeout(showFlashHdr);
  292. $('#main_flash_alert').hide();
  293. $('#main_flash_hdr').hide();
  294. $('#main_content').show();
  295. autoLoadPage();
  296. };
  297. });
  298. </script>
  299. <script type="text/javascript">
  300. var srs_publisher = null;
  301. var realtime_player = null;
  302. var query = parse_query_string();
  303. var autoLoadPage = function() {
  304. // get the vhost and port to set the default url.
  305. // url set to: http://localhost:8080/live/livestream.flv
  306. srs_init_flv("#txt_url", null);
  307. if (query.agent == "true") {
  308. document.write(navigator.userAgent);
  309. return;
  310. }
  311. $("#btn_video_settings").click(function(){
  312. $("#video_modal").modal({show:true});
  313. });
  314. $("#btn_audio_settings").click(function(){
  315. $("#audio_modal").modal({show:true});
  316. });
  317. $("#low_latecy_tips").tooltip({
  318. title: "服务器不转码直接转发FLASH编码器的流,所以延迟比支持HLS的流要低很多"
  319. });
  320. $("#realtime_player_url").tooltip({
  321. title: "右键复制RTMP地址"
  322. });
  323. $("#btn_publish").click(on_user_publish);
  324. // for publish, we use randome stream name.
  325. $("#txt_url").val($("#txt_url").val() + "." + Number(parseInt(new Date().getTime()*Math.random()*100)).toString(16).substr(0, 7));
  326. // start the publisher.
  327. srs_publisher = new SrsPublisher("local_publisher", 430, 185);
  328. srs_publisher.on_publisher_ready = function(cameras, microphones) {
  329. srs_publisher_initialize_page(
  330. cameras, microphones,
  331. "#sl_cameras", "#sl_microphones",
  332. "#sl_vcodec", "#sl_profile", "#sl_level", "#sl_gop", "#sl_size",
  333. "#sl_fps", "#sl_bitrate",
  334. "#sl_acodec"
  335. );
  336. };
  337. srs_publisher.on_publisher_error = function(code, desc) {
  338. if (!on_publish_stop()) {
  339. return;
  340. }
  341. error(code, desc + "请重试。");
  342. };
  343. srs_publisher.on_publisher_warn = function(code, desc) {
  344. warn(code, desc);
  345. };
  346. srs_publisher.start();
  347. // if no play specified, donot show the player, for debug the publisher.
  348. if (query.no_play != "true") {
  349. // start the realtime player.
  350. realtime_player = new SrsPlayer("realtime_player", 430, 185);
  351. realtime_player.on_player_ready = function() {
  352. this.set_bt(0.8);
  353. };
  354. realtime_player.on_player_metadata = function(metadata) {
  355. this.set_dar(0, 0);
  356. this.set_fs("screen", 100);
  357. }
  358. realtime_player.start();
  359. }
  360. };
  361. function on_publish_stop() {
  362. if (!srs_can_republish()) {
  363. $("#btn_join").attr("disabled", true);
  364. error(0, "您使用的浏览器很弱,请关闭页面后重新打开页面(刷新也不管用)。<br/>推荐使用Chrome浏览器,支持重试");
  365. srs_log_disabled = true;
  366. return false;
  367. }
  368. return true;
  369. }
  370. function update_play_url() {
  371. var url = $("#txt_url").val();
  372. var ret = srs_parse_rtmp_url(url);
  373. var remote_url = "rtmp://" + ret.server + ":" + ret.port + "/" + ret.app + "/" + ret.stream + '?vhost=' + ret.vhost;
  374. $("#realtime_player_url").attr("href", url).attr("target", "_blank");
  375. var srs_player_rt_url = "http://" + query.host + query.dir + "/srs_player.html?";
  376. srs_player_rt_url += "vhost=" + ret.vhost + "&port=" + ret.port + "&app=" + ret.app + "&stream=" + ret.stream;
  377. srs_player_rt_url += "&autostart=true";
  378. $("#txt_play_realtime").text("RTMP播放地址").attr("href", srs_player_rt_url).attr("target", "_blank");
  379. }
  380. function on_user_publish() {
  381. if ($("#btn_publish").text() == "停止发布") {
  382. srs_publisher.stop();
  383. $("#btn_publish").text("发布视频");
  384. if (!on_publish_stop()) {
  385. return;
  386. }
  387. return;
  388. }
  389. $("#btn_publish").text("停止发布");
  390. update_play_url();
  391. var url = $("#txt_url").val();
  392. var vcodec = {};
  393. var acodec = {};
  394. srs_publiser_get_codec(
  395. vcodec, acodec,
  396. "#sl_cameras", "#sl_microphones",
  397. "#sl_vcodec", "#sl_profile", "#sl_level", "#sl_gop", "#sl_size",
  398. "#sl_fps", "#sl_bitrate",
  399. "#sl_acodec"
  400. );
  401. info("开始推流到服务器");
  402. srs_publisher.publish(url, vcodec, acodec);
  403. if (!$("#cb_preview").is(":checked")) {
  404. return;
  405. }
  406. if (realtime_player) {
  407. // directly play the url for the realtime player.
  408. realtime_player.stop();
  409. realtime_player.play(url);
  410. }
  411. }
  412. /**
  413. * get the vcodec and acodec.
  414. */
  415. function srs_publiser_get_codec(
  416. vcodec, acodec,
  417. sl_cameras, sl_microphones, sl_vcodec, sl_profile, sl_level, sl_gop, sl_size, sl_fps, sl_bitrate,
  418. sl_acodec
  419. ) {
  420. acodec.codec = $(sl_acodec).val();
  421. acodec.device_code = $(sl_microphones).val();
  422. acodec.device_name = $(sl_microphones).text();
  423. vcodec.device_code = $(sl_cameras).find("option:selected").val();
  424. vcodec.device_name = $(sl_cameras).find("option:selected").text();
  425. vcodec.codec = $(sl_vcodec).find("option:selected").val();
  426. vcodec.profile = $(sl_profile).find("option:selected").val();
  427. vcodec.level = $(sl_level).find("option:selected").val();
  428. vcodec.fps = $(sl_fps).find("option:selected").val();
  429. vcodec.gop = $(sl_gop).find("option:selected").val();
  430. vcodec.size = $(sl_size).find("option:selected").val();
  431. vcodec.bitrate = $(sl_bitrate).find("option:selected").val();
  432. }
  433. /**
  434. * when publisher ready, init the page elements.
  435. */
  436. function srs_publisher_initialize_page(
  437. cameras, microphones,
  438. sl_cameras, sl_microphones, sl_vcodec, sl_profile, sl_level, sl_gop, sl_size, sl_fps, sl_bitrate,
  439. sl_acodec
  440. ) {
  441. srs_initialize_codec_page(
  442. cameras, microphones,
  443. sl_cameras, sl_microphones, sl_vcodec, sl_profile, sl_level, sl_gop, sl_size, sl_fps, sl_bitrate,
  444. sl_acodec
  445. );
  446. //var profiles = ["baseline", "main"];
  447. $(sl_profile + " option[value='main']").attr("selected", true);
  448. //var levels = ["1", "1b", "1.1", "1.2", "1.3",
  449. // "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1"];
  450. $(sl_level + " option[value='4.1']").attr("selected", true);
  451. //var gops = ["0.3", "0.5", "1", "2", "3", "4",
  452. // "5", "6", "7", "8", "9", "10", "15", "20"];
  453. $(sl_gop + " option[value='10']").attr("selected", true);
  454. //var sizes = ["176x144", "320x240", "352x240",
  455. // "352x288", "480x360", "640x480", "720x480", "720x576", "800x600",
  456. // "1024x768", "1280x720", "1360x768", "1920x1080"];
  457. $(sl_size + " option[value='640x480']").attr("selected", true);
  458. //var fpses = ["5", "10", "15", "20", "24", "25", "29.97", "30"];
  459. $(sl_fps + " option[value='20']").attr("selected", true);
  460. //var bitrates = ["50", "200", "350", "500", "650", "800",
  461. // "950", "1000", "1200", "1500", "1800", "2000", "3000", "5000"];
  462. $(sl_bitrate + " option[value='500']").attr("selected", true);
  463. // speex
  464. $(sl_acodec + " option[value='speex']").attr("selected", true);
  465. }
  466. // without default values set.
  467. function srs_initialize_codec_page(
  468. cameras, microphones,
  469. sl_cameras, sl_microphones, sl_vcodec, sl_profile, sl_level, sl_gop, sl_size, sl_fps, sl_bitrate,
  470. sl_acodec
  471. ) {
  472. $(sl_cameras).empty();
  473. for (var i = 0; i < cameras.length; i++) {
  474. $(sl_cameras).append("<option value='" + i + "'>" + cameras[i] + "</option");
  475. }
  476. // optional: select the except matches
  477. matchs = ["virtual"];
  478. for (var i = 0; i < cameras.length; i++) {
  479. for (var j = 0; j < matchs.length; j++) {
  480. if (cameras[i].toLowerCase().indexOf(matchs[j]) == -1) {
  481. $(sl_cameras + " option[value='" + i + "']").attr("selected", true);
  482. break;
  483. }
  484. }
  485. if (j < matchs.length) {
  486. break;
  487. }
  488. }
  489. // optional: select the first matched.
  490. matchs = ["truevision", "integrated"];
  491. for (var i = 0; i < cameras.length; i++) {
  492. for (var j = 0; j < matchs.length; j++) {
  493. if (cameras[i].toLowerCase().indexOf(matchs[j]) >= 0) {
  494. $(sl_cameras + " option[value='" + i + "']").attr("selected", true);
  495. break;
  496. }
  497. }
  498. if (j < matchs.length) {
  499. break;
  500. }
  501. }
  502. $(sl_microphones).empty();
  503. for (var i = 0; i < microphones.length; i++) {
  504. $(sl_microphones).append("<option value='" + i + "'>" + microphones[i] + "</option");
  505. }
  506. // optional: select the except matches
  507. matchs = ["default"];
  508. for (var i = 0; i < microphones.length; i++) {
  509. for (var j = 0; j < matchs.length; j++) {
  510. if (microphones[i].toLowerCase().indexOf(matchs[j]) == -1) {
  511. $(sl_microphones + " option[value='" + i + "']").attr("selected", true);
  512. break;
  513. }
  514. }
  515. if (j < matchs.length) {
  516. break;
  517. }
  518. }
  519. // optional: select the first matched.
  520. matchs = ["realtek", "内置式麦克风"];
  521. for (var i = 0; i < microphones.length; i++) {
  522. for (var j = 0; j < matchs.length; j++) {
  523. if (microphones[i].toLowerCase().indexOf(matchs[j]) >= 0) {
  524. $(sl_microphones + " option[value='" + i + "']").attr("selected", true);
  525. break;
  526. }
  527. }
  528. if (j < matchs.length) {
  529. break;
  530. }
  531. }
  532. $(sl_vcodec).empty();
  533. var vcodecs = ["h264", "vp6"];
  534. vcodecs = ["h264"]; // h264 only.
  535. for (var i = 0; i < vcodecs.length; i++) {
  536. $(sl_vcodec).append("<option value='" + vcodecs[i] + "'>" + vcodecs[i] + "</option");
  537. }
  538. $(sl_profile).empty();
  539. var profiles = ["baseline", "main"];
  540. for (var i = 0; i < profiles.length; i++) {
  541. $(sl_profile).append("<option value='" + profiles[i] + "'>" + profiles[i] + "</option");
  542. }
  543. $(sl_level).empty();
  544. var levels = ["1", "1b", "1.1", "1.2", "1.3",
  545. "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1"];
  546. for (var i = 0; i < levels.length; i++) {
  547. $(sl_level).append("<option value='" + levels[i] + "'>" + levels[i] + "</option");
  548. }
  549. $(sl_gop).empty();
  550. var gops = ["0.3", "0.5", "1", "2", "3", "4",
  551. "5", "6", "7", "8", "9", "10", "15", "20"];
  552. for (var i = 0; i < gops.length; i++) {
  553. $(sl_gop).append("<option value='" + gops[i] + "'>" + gops[i] + "秒</option");
  554. }
  555. $(sl_size).empty();
  556. var sizes = ["176x144", "320x240", "352x240",
  557. "352x288", "480x360", "640x480", "720x480", "720x576", "800x600",
  558. "1024x768", "1280x720", "1360x768", "1920x1080"];
  559. for (i = 0; i < sizes.length; i++) {
  560. $(sl_size).append("<option value='" + sizes[i] + "'>" + sizes[i] + "</option");
  561. }
  562. $(sl_fps).empty();
  563. var fpses = ["5", "10", "15", "20", "24", "25", "29.97", "30"];
  564. for (i = 0; i < fpses.length; i++) {
  565. $(sl_fps).append("<option value='" + fpses[i] + "'>" + Number(fpses[i]).toFixed(2) + " 帧/秒</option");
  566. }
  567. $(sl_bitrate).empty();
  568. var bitrates = ["50", "200", "350", "500", "650", "800",
  569. "950", "1000", "1200", "1500", "1800", "2000", "3000", "5000"];
  570. for (i = 0; i < bitrates.length; i++) {
  571. $(sl_bitrate).append("<option value='" + bitrates[i] + "'>" + bitrates[i] + " kbps</option");
  572. }
  573. $(sl_acodec).empty();
  574. var bitrates = ["speex", "nellymoser", "pcma", "pcmu"];
  575. for (i = 0; i < bitrates.length; i++) {
  576. $(sl_acodec).append("<option value='" + bitrates[i] + "'>" + bitrates[i] + "</option");
  577. }
  578. }
  579. // check whether can republish
  580. function srs_can_republish() {
  581. var browser = get_browser_agents();
  582. if (browser.Chrome || browser.Firefox) {
  583. return true;
  584. }
  585. if (browser.MSIE || browser.QQBrowser) {
  586. return false;
  587. }
  588. return false;
  589. }
  590. </script>
  591. </html>