2
0

osmf.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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: 55px;
  10. }
  11. #main_modal {
  12. width: 700px;
  13. margin-left: -350px;
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <div class="navbar navbar-fixed-top">
  19. <div class="navbar-inner">
  20. <div class="container">
  21. <a id="srs_index" class="brand" href="#">SRS</a>
  22. <div class="nav-collapse collapse">
  23. <ul class="nav">
  24. <li><a id="nav_srs_player" href="srs_player.html">SRS播放器</a></li>
  25. <li><a id="nav_srs_publisher" href="srs_publisher.html">SRS编码器</a></li>
  26. <li><a id="nav_srs_chat" href="srs_chat.html">SRS会议</a></li>
  27. <li><a id="nav_srs_bwt" href="srs_bwt.html">SRS测网速</a></li>
  28. <li><a id="nav_jwplayer6" href="jwplayer6.html">JWPlayer6播放器</a></li>
  29. <li class="active"><a id="nav_osmf" href="osmf.html">AdobeOSMF播放器</a></li>
  30. <li><a id="nav_vlc" href="vlc.html">VLC播放器</a></li>
  31. </ul>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="container">
  37. <div class="alert alert-info fade in">
  38. <button type="button" class="close" data-dismiss="alert">×</button>
  39. <strong><span>Usage:</span></strong> <span>输入地址后点击播放按钮</span>
  40. </div>
  41. <div class="form-inline">
  42. URL:
  43. <input type="text" id="txt_url" class="input-xxlarge" value=""></input>
  44. <button class="btn btn-primary" id="btn_play">播放视频</button>
  45. </div>
  46. <div id="main_modal" class="modal hide fade">
  47. <div class="modal-header">
  48. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  49. <h3>AdobeOSMF</h3>
  50. </div>
  51. <div class="modal-body" id="player">
  52. </div>
  53. <div class="modal-footer">
  54. <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"> 关闭 </button>
  55. </div>
  56. </div>
  57. <hr>
  58. <footer>
  59. <p><a href="https://github.com/ossrs/srs">SRS Team &copy; 2013</a></p>
  60. </footer>
  61. </div>
  62. </body>
  63. <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
  64. <script type="text/javascript" src="js/bootstrap.min.js"></script>
  65. <script type="text/javascript" src="js/swfobject.js"></script>
  66. <script type="text/javascript" src="js/srs.page.js"></script>
  67. <script type="text/javascript" src="js/srs.log.js"></script>
  68. <script type="text/javascript" src="js/srs.player.js"></script>
  69. <script type="text/javascript" src="js/srs.publisher.js"></script>
  70. <script type="text/javascript" src="js/srs.utility.js"></script>
  71. <script type="text/javascript" src="js/winlin.utility.js"></script>
  72. <script type="text/javascript">
  73. function osmf_play(url) {
  74. $("#div_container").remove();
  75. var div_container = $("<div/>");
  76. $(div_container).attr("id", "div_container");
  77. $("#player").append(div_container);
  78. var player = $("<div/>");
  79. $(player).attr("id", "player_id");
  80. $(div_container).append(player);
  81. var flashvars = {};
  82. flashvars.src = url;
  83. flashvars.streamType = "live"; // live or recorded
  84. flashvars.autoPlay = true;
  85. flashvars.controlBarAutoHide = false;
  86. flashvars.scaleMode = "stretch";
  87. flashvars.bufferTime = 0.8;
  88. var params = {};
  89. params.allowFullScreen = true;
  90. var attributes = {};
  91. swfobject.embedSWF(
  92. "js/StrobeMediaPlayback.swf", "player_id",
  93. srs_get_player_width(), srs_get_player_height(),
  94. "11.1", "js/AdobeFlashPlayerInstall.swf",
  95. flashvars, params, attributes
  96. );
  97. }
  98. $(function(){
  99. // get the vhost and port to set the default url.
  100. // for example: http://192.168.1.213/players/jwplayer6.html?port=1935&vhost=demo
  101. // url set to: rtmp://demo:1935/live/livestream
  102. srs_init_rtmp("#txt_url", "#main_modal");
  103. $("#main_modal").on("hide", function(){
  104. osmf_play("http://localhost");
  105. $("#div_container").remove();
  106. });
  107. $("#main_modal").on("show", function(){
  108. var url = $("#txt_url").val();
  109. osmf_play(url);
  110. });
  111. $("#btn_play").click(function(){
  112. $("#main_modal").modal({show:true, keyboard:false});
  113. });
  114. });
  115. </script>
  116. </html>