winlin

srs player show current time and url

@@ -358,6 +358,13 @@ @@ -358,6 +358,13 @@
358 <input class="span2" style="width:85px" id="txt_time" type="text" placeholder="天 时:分:秒"> 358 <input class="span2" style="width:85px" id="txt_time" type="text" placeholder="天 时:分:秒">
359 </div> 359 </div>
360 </div> 360 </div>
  361 + <div style="margin-top:-12px;">
  362 + URL: <a href="#" id="player_url"></a>
  363 + <div class="input-prepend div_play_time" title="当前时间:年-月-日 时:分:秒">
  364 + <span class="add-on">@N</span>
  365 + <input class="span2" style="width:135px" id="player_clock" type="text" placeholder="年-月-日 时:分:秒">
  366 + </div>
  367 + </div>
361 </div> 368 </div>
362 </div> 369 </div>
363 <footer> 370 <footer>
@@ -475,6 +482,9 @@ @@ -475,6 +482,9 @@
475 time_str += padding(parseInt(time), 2, '0'); 482 time_str += padding(parseInt(time), 2, '0');
476 // show 483 // show
477 $("#txt_time").val(time_str); 484 $("#txt_time").val(time_str);
  485 +
  486 + var clock = new Date().getTime() / 1000;
  487 + $("#player_clock").val(absolute_seconds_to_YYYYmmdd(clock) + " " + absolute_seconds_to_HHMMSS(clock));
478 }; 488 };
479 srs_player.start(); 489 srs_player.start();
480 }); 490 });
@@ -486,12 +496,14 @@ @@ -486,12 +496,14 @@
486 } 496 }
487 }); 497 });
488 498
489 - $("#btn_generate_link").click(function(){ 499 + var apply_url_change = function() {
490 var rtmp = parse_rtmp_url($("#txt_url").val()); 500 var rtmp = parse_rtmp_url($("#txt_url").val());
491 var url = "http://" + query.host + query.pathname + "?" 501 var url = "http://" + query.host + query.pathname + "?"
492 + "vhost=" + rtmp.vhost + "&app=" + rtmp.app + "&stream=" + rtmp.stream 502 + "vhost=" + rtmp.vhost + "&app=" + rtmp.app + "&stream=" + rtmp.stream
493 + "&server=" + rtmp.server + "&port=" + rtmp.port 503 + "&server=" + rtmp.server + "&port=" + rtmp.port
494 + "&autostart=true"; 504 + "&autostart=true";
  505 + $("#player_url").text($("#txt_url").val()).attr("href", url);
  506 +
495 $("#link_server").text(rtmp.server); 507 $("#link_server").text(rtmp.server);
496 $("#link_port").text(rtmp.port); 508 $("#link_port").text(rtmp.port);
497 $("#link_vhost").text(rtmp.vhost); 509 $("#link_vhost").text(rtmp.vhost);
@@ -499,6 +511,13 @@ @@ -499,6 +511,13 @@
499 $("#link_stream").text(rtmp.stream); 511 $("#link_stream").text(rtmp.stream);
500 $("#link_rtmp").text($("#txt_url").val()); 512 $("#link_rtmp").text($("#txt_url").val());
501 $("#link_url").attr("href", url); 513 $("#link_url").attr("href", url);
  514 + };
  515 +
  516 + $("#txt_url").change(function(){
  517 + apply_url_change();
  518 + });
  519 +
  520 + $("#btn_generate_link").click(function(){
502 $("#link_modal").modal({show:true, keyboard:true}); 521 $("#link_modal").modal({show:true, keyboard:true});
503 }); 522 });
504 523
@@ -640,6 +659,8 @@ @@ -640,6 +659,8 @@
640 url = $("#txt_url").val(); 659 url = $("#txt_url").val();
641 $("#main_modal").modal({show:true, keyboard:false}); 660 $("#main_modal").modal({show:true, keyboard:false});
642 } 661 }
  662 +
  663 + apply_url_change();
643 }); 664 });
644 </script> 665 </script>
645 </html> 666 </html>