index.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>player</title>
  6. <style>
  7. .sk-chase {
  8. width: 40px;
  9. height: 40px;
  10. position: absolute;
  11. top: 50%;
  12. left: 50%;
  13. transform: translate(-50%, -50%);
  14. display: block;
  15. animation: sk-chase 2.5s infinite linear both;
  16. }
  17. .sk-chase-dot {
  18. width: 100%;
  19. height: 100%;
  20. position: absolute;
  21. left: 0;
  22. top: 0;
  23. animation: sk-chase-dot 2.0s infinite ease-in-out both;
  24. }
  25. .sk-chase-dot:before {
  26. content: '';
  27. display: block;
  28. width: 25%;
  29. height: 25%;
  30. background-color: #8cc5ff;
  31. border-radius: 100%;
  32. animation: sk-chase-dot-before 2.0s infinite ease-in-out both;
  33. }
  34. .sk-chase-dot:nth-child(1) { animation-delay: -1.1s; }
  35. .sk-chase-dot:nth-child(2) { animation-delay: -1.0s; }
  36. .sk-chase-dot:nth-child(3) { animation-delay: -0.9s; }
  37. .sk-chase-dot:nth-child(4) { animation-delay: -0.8s; }
  38. .sk-chase-dot:nth-child(5) { animation-delay: -0.7s; }
  39. .sk-chase-dot:nth-child(6) { animation-delay: -0.6s; }
  40. .sk-chase-dot:nth-child(1):before { animation-delay: -1.1s; }
  41. .sk-chase-dot:nth-child(2):before { animation-delay: -1.0s; }
  42. .sk-chase-dot:nth-child(3):before { animation-delay: -0.9s; }
  43. .sk-chase-dot:nth-child(4):before { animation-delay: -0.8s; }
  44. .sk-chase-dot:nth-child(5):before { animation-delay: -0.7s; }
  45. .sk-chase-dot:nth-child(6):before { animation-delay: -0.6s; }
  46. @keyframes sk-chase {
  47. 100% { transform: rotate(360deg); }
  48. }
  49. @keyframes sk-chase-dot {
  50. 80%, 100% { transform: rotate(360deg); }
  51. }
  52. @keyframes sk-chase-dot-before {
  53. 50% {
  54. transform: scale(0.4);
  55. } 100%, 0% {
  56. transform: scale(1.0);
  57. }
  58. }
  59. #error_text {
  60. width: 170px;
  61. height: 170px;
  62. background: url("./image/siagn.png") no-repeat;
  63. background-size: 100%;
  64. position: absolute;
  65. top: 50%;
  66. left: 50%;
  67. transform: translate(-50%, -50%);
  68. display: none;
  69. }
  70. body::-webkit-scrollbar {
  71. display: none;
  72. }
  73. </style>
  74. </head>
  75. <body style="margin: 0; width: 100%; text-align: center; z-index:999; background-color: transparent; overflow: hidden" >
  76. <video width="100%" id="video"></video>
  77. <canvas id="canvas"></canvas>
  78. <canvas id="draw"></canvas>
  79. <div class="sk-chase">
  80. <div class="sk-chase-dot"></div>
  81. <div class="sk-chase-dot"></div>
  82. <div class="sk-chase-dot"></div>
  83. <div class="sk-chase-dot"></div>
  84. <div class="sk-chase-dot"></div>
  85. <div class="sk-chase-dot"></div>
  86. </div>
  87. <div id="error_text" ></div>
  88. </body>
  89. <script type="module">
  90. import Player from "./src/player.js";
  91. var clickTimeId;
  92. let str = location.href;
  93. let num = str.indexOf('?');
  94. str = str.substr(num+1);
  95. let data = str.split(',');
  96. let isShow = Number(data[0]);
  97. let key = data[4];
  98. let video = document.getElementsByTagName('body')[0];
  99. let height = video.clientHeight;
  100. video.dblclick = function () {
  101. };
  102. function onDocumentClick(event) {
  103. // 取消上次延时未执行的方法
  104. clearTimeout(clickTimeId);
  105. //执行延时
  106. clickTimeId = setTimeout(function() {
  107. //此处为单击事件要执行的代码
  108. console.log("鼠标单击");
  109. }, 250);
  110. }
  111. function onDocumenDblClick(event) {
  112. // 取消上次延时未执行的方法
  113. clearTimeout(clickTimeId);
  114. console.log("鼠标双击");
  115. // isFullscreenEnabled();
  116. let video = document.getElementById('video');
  117. if (video.requestFullscreen) { //w3c
  118. console.log(video.requestFullscreen);
  119. console.log(video.requestFullscreen());
  120. video.requestFullscreen();
  121. } else if (video.mozRequestFullScreen) { //moz Firefox
  122. video.mozRequestFullScreen();
  123. } else if (video.msRequestFullscreen) { //IE
  124. video.msRequestFullscreen();
  125. } else if (video.oRequestFullscreen) { //Opera
  126. video.oRequestFullscreen();
  127. } else if (video.webkitRequestFullscreen) { //webkit内核 Chrome Safari
  128. video.webkitRequestFullScreen();
  129. }
  130. }
  131. const options = {
  132. video: document.getElementById('video'),
  133. canvas: document.getElementById('canvas'),
  134. drawer: document.getElementById('draw'),
  135. // wsUrl:'ws://111.2.71.225:10080/camera_relay?tcpaddr=admin%3Ahmkj6688%40192.168.1.144',
  136. // rtspUrl: 'rtsp://admin:hmkj6688@192.168.1.144',
  137. user: '',
  138. pwd: ''
  139. };
  140. options.wsUrl = data[1];
  141. options.rtspUrl = data[2];
  142. console.log(options.rtspUrl);
  143. let player = new Player(options);
  144. player.init();
  145. player.on('error', function () {
  146. console.log('连接失败')
  147. let er = document.getElementById('error_text');
  148. er.style.display = 'block';
  149. // er.style.lineHeight = height + 'px';
  150. er.style.lineHeight = height + 'px';
  151. });
  152. player.on('noStream', function () {
  153. console.log('noStream');
  154. player.close();
  155. player = null;
  156. player = new Player(options);
  157. player.init();
  158. player.connect();
  159. });
  160. // 首次播放
  161. player.on('canplay', function () {
  162. //player.close();
  163. let sk = document.getElementsByClassName('sk-chase')[0];
  164. sk.style.display = 'none';
  165. });
  166. player.on('initialCompleted', function () {
  167. });
  168. player.on('ROIFinished', function () {
  169. console.log('ROIFinished');
  170. });
  171. player.connect();
  172. window.onload = function() {
  173. document.addEventListener('dblclick', onDocumenDblClick);
  174. };
  175. </script>
  176. </html>