video.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  5. <meta charset="utf-8">
  6. <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  7. <meta content="yes" name="apple-mobile-web-app-capable">
  8. <meta content="black" name="apple-mobile-web-app-status-bar-style">
  9. <meta content="telephone=no" name="format-detection">
  10. <!--<meta name="viewport" content="width=device-width, initial-scale=1">-->
  11. <link href="__PUBLIC__/wxapp/css/video-js.css" rel="stylesheet">
  12. <link href="__PUBLIC__/wxapp/css/jquery.mobile.min.css" rel="stylesheet">
  13. <script src="__PUBLIC__/wxapp/js/video.js"></script>
  14. <script src="__PUBLIC__/wxapp/js/jquery/jquery-1.8.3.min.js"></script>
  15. <script src="__PUBLIC__/wxapp/js/jquery.mobile.min.js"></script>
  16. <title>博华广场</title>
  17. </head>
  18. <body onload="show_cam('C59360333');">
  19. <div data-role="page" id="pageone" style="text-align: center;">
  20. <div data-role="header">
  21. <h1>博华广场</h1>
  22. </div>
  23. <h2 id="title">B1水泵房#1</h2>
  24. <div data-role="main" class="ui-content">
  25. <video id="my-video" style="color:black;width:320px;height:240px;margin: 5px auto 5px auto" class="video-js" controls autoplay="autoplay" preload="auto" x5-playsinline="" playsinline="" webkit-playsinline="" width="750" height="350" data-setup='{}'>
  26. <source src="http://47.103.74.123/hls/C59360333.m3u8" type="application/x-mpegURL">
  27. </video>
  28. <div style="height: 30px;"></div>
  29. <button style="margin:5px; width: 85%; height: 40px;" onclick="show_cam('C59360333');">B1水泵房#1</button>
  30. <button style="margin:5px; width: 85%; height: 40px;" onclick="show_cam('C59360332');">B1水泵房#2</button>
  31. <button style="margin:5px; width: 85%; height: 40px;" onclick="show_cam('C59360334');">28层水泵房#1</button>
  32. <button style="margin:5px; width: 85%; height: 40px;" onclick="show_cam('C60389215');">28层水泵房#2</button>
  33. </div>
  34. <div data-role="footer">
  35. </div>
  36. </div>
  37. <!--<table border="0" style=“border:0px solid #000; margin: 50px auto 10px auto; text-align: center; font-size:32pt;” width="100%">
  38. <tr style="height: 50px;">
  39. <td style="border: 0px solid #000;" width="50%">
  40. <button onclick="show_cam('C59360333');">B1水泵房#1</button>
  41. </td><td style="border: 0px solid #000">
  42. <button onclick="show_cam('C59360332');">B1水泵房#2</button>
  43. </td>
  44. </tr><tr style="height: 50px;">
  45. <td style="border: 0px solid #000;" width="50%">
  46. <button onclick="show_cam('C59360334');">28层水泵房#1</button>
  47. </td><td style="border: 0px solid #000">
  48. <button onclick="show_cam('C60389215');">28层水泵房#2</button>
  49. </td>
  50. </tr>
  51. </table>
  52. -->
  53. <script type="text/javascript" language="JavaScript">
  54. var options = {};
  55. var player = videojs('my-video',{
  56. bigPlayButton:true,
  57. textTrackDisplay:false,
  58. posterImage:false,
  59. errorDisplay:false
  60. });
  61. var close_dev = function(){
  62. var qry = {
  63. CMD:3,BODY:{
  64. DEVICE:$("#cam_sel").val(),
  65. ACTION:0
  66. }
  67. }
  68. var json_str = "queryJson:"+JSON.stringify(qry);
  69. $.ajax({
  70. url:"/demo.cgi",
  71. data:json_str,
  72. type:"POST",
  73. success:function(result){
  74. }
  75. });
  76. }
  77. var show_cam = function(id){
  78. player.pause();
  79. if(id=='C59360333')
  80. document.getElementById('title').innerHTML='B1水泵房#1';
  81. else if (id=='C59360332')
  82. document.getElementById('title').innerHTML='B1水泵房#2';
  83. else if (id=='C59360334')
  84. document.getElementById('title').innerHTML='28层水泵房#1';
  85. else if (id=='C60389215')
  86. document.getElementById('title').innerHTML='28层水泵房#2';
  87. open_dev();
  88. videojs('my-video',{
  89. bigPlayButton:true,
  90. textTrackDisplay:false,
  91. posterImage:false,
  92. errorDisplay:false
  93. },function(){
  94. this.src({
  95. src:"http://47.103.74.123/hls/"+id+".m3u8",
  96. type:"application/x-mpegURL"
  97. });
  98. this.play();
  99. });
  100. }
  101. var open_dev = function(){
  102. get_cam_video();
  103. }
  104. var get_cam_video = function(){
  105. var qry = {
  106. CMD:3,BODY:{
  107. DEVICE:$("#cam_sel").val(),ACTION:1
  108. }
  109. }
  110. var json_str = "queryJson:"+JSON.stringify(qry);
  111. $.ajax({
  112. url:"/demo.cgi",
  113. data:json_str,
  114. type:"POST",
  115. success:function(result){
  116. }
  117. });
  118. }
  119. var getList = function() {
  120. var qry = new Object();
  121. qry.CMD = 1;
  122. var json_str = "queryJson:"+JSON.stringify(qry);
  123. document.getElementById("cam_sel").innerHTML="";
  124. $.ajax({
  125. url:"/demo.cgi",
  126. data:json_str,
  127. timeout:1000,
  128. type:"POST",
  129. success:function(result){
  130. var ret = eval('('+result+')');
  131. if(ret.REPLY==1){
  132. if((ret.RESULT!=undefined)&&(ret.RESULT.CMD==1)&&(ret.RESULT.LIST!=undefined)){
  133. var sel = document.getElementById("cam_sel");
  134. for(var n=0;n<ret.RESULT.LIST.length;n++){
  135. var opt = document.createElement("option");
  136. opt.innerHTML = ret.RESULT.LIST[n].DEVICE;
  137. sel.appendChild(opt);
  138. }
  139. }
  140. }
  141. }
  142. });
  143. }
  144. var flashChecker = function() {
  145. var hasFlash = 0; //是否安装了flash
  146. var flashVersion = 0; //flash版本
  147. var isIE = /*@cc_on!@*/0; //是否IE浏览器
  148. if (isIE) {
  149. var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
  150. if (swf) {
  151. hasFlash = 1;
  152. VSwf = swf.GetVariable("$version");
  153. flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
  154. }
  155. } else {
  156. if (navigator.plugins && navigator.plugins.length > 0) {
  157. var swf = navigator.plugins["Shockwave Flash"];
  158. if (swf) {
  159. hasFlash = 1;
  160. var words = swf.description.split(" ");
  161. for (var i = 0; i < words.length; ++i) {
  162. if (isNaN(parseInt(words[i]))) continue;
  163. flashVersion = parseInt(words[i]);
  164. }
  165. }
  166. }
  167. }
  168. return {f: hasFlash, v: flashVersion};
  169. }
  170. </script>
  171. </body>
  172. </html>