h52.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <!DOCTYPE html>
  2. <html lang=zh-CN>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport"
  6. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <title>监控详情页</title>
  8. <link href="https://unpkg.com/video.js@7.10.2/dist/video-js.min.css" rel="stylesheet" />
  9. <style type="text/css">
  10. body {
  11. margin: 0;
  12. background-color: #f3f3f3;
  13. }
  14. span.vjs-control-text{
  15. display: none;
  16. }
  17. /* iframe {
  18. width: 375px;
  19. height: 667px;
  20. background-color: #fff;
  21. box-sizing: content-box;
  22. border: none;
  23. } */
  24. .btn-box {
  25. margin-top: 20px;
  26. display: flex;
  27. flex-direction: row;
  28. justify-content: space-around;
  29. align-items: center;
  30. }
  31. .more,
  32. .less {
  33. flex: 1
  34. }
  35. img {
  36. width: 100%;
  37. }
  38. .direc {
  39. width: 150px;
  40. height: 150px;
  41. background: url('http://www.hnyfwlw.com:8006/bigdata_app/image/monitor/1.png');
  42. background-size: 100% auto;
  43. background-repeat: no-repeat;
  44. position: relative;
  45. }
  46. .direc div {
  47. width: 50px;
  48. height: 50px;
  49. position: absolute;
  50. }
  51. .top {
  52. top: 0;
  53. left: 50px
  54. }
  55. .bottom {
  56. bottom: 0;
  57. left: 50px
  58. }
  59. .left {
  60. left: 0;
  61. top: 50px
  62. }
  63. .right {
  64. right: 0;
  65. top: 50px
  66. }
  67. #box {
  68. height: 300px;
  69. width: 100%;
  70. background: #000;
  71. overflow: hidden;
  72. }
  73. #dialog {
  74. display: none;
  75. width: 200px;
  76. line-height: 80px;
  77. background: rgba(0, 0, 0, .8);
  78. color: #fff;
  79. text-align: center;
  80. position: absolute;
  81. left: 50%;
  82. margin-left: -100px;
  83. border-radius: 4px;
  84. z-index: 999;
  85. top: 50%;
  86. margin-top: -40px;
  87. }
  88. .imgBtn {
  89. position: absolute;
  90. width: 100%;
  91. padding: 10px;
  92. bottom: 0;
  93. left: 0;
  94. text-align: center;
  95. color: #338cd9;
  96. font-size: 16px;
  97. box-sizing: border-box;
  98. }
  99. .imgBtn img {
  100. display: inline-block;
  101. width: 20px;
  102. height: 20px;
  103. vertical-align: middle;
  104. margin-right: 2px;
  105. margin-bottom: 3px;
  106. }
  107. </style>
  108. </head>
  109. <body>
  110. <div id="box"></div>
  111. <div id="dialog">
  112. </div>
  113. <div class="btn-box">
  114. <div class="more" ontouchstart="configCamera('move', 8)" ontouchend="stopConfigCamera()">
  115. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/monitor/3.png" mode="widthFix"></image>
  116. </div>
  117. <div class="direc">
  118. <div class="top" ontouchstart="configCamera('move', 0)" ontouchend="stopConfigCamera()">
  119. </div>
  120. <div class="bottom" ontouchstart="configCamera('move', 1)" ontouchend="stopConfigCamera()">
  121. </div>
  122. <!-- <div class="photo" ontouchstart="configCamera('takephoto', '')">
  123. </div> -->
  124. <div class="left" ontouchstart="configCamera('move', 2)" ontouchend="stopConfigCamera()">
  125. </div>
  126. <div class="right" ontouchstart="configCamera('move', 3)" ontouchend="stopConfigCamera()">
  127. </div>
  128. </div>
  129. <div class="less" ontouchstart="configCamera('move', 9)" ontouchend="stopConfigCamera()">
  130. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/monitor/2.png" mode="widthFix"></image>
  131. </div>
  132. </div>
  133. <div class="imgBtn">
  134. <img src="images/image.png" />查看图片
  135. </div>
  136. </body>
  137. <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  138. <!-- 微信 JS-SDK 如果不需要兼容小程序,则无需引用此 JS 文件。 -->
  139. <!-- <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> -->
  140. <!-- uni 的 SDK -->
  141. <script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
  142. <!-- <script type="text/javascript" src="http://www.hnyfwlw.com:8006/bigdata_app/js/ezuikit.js"></script> -->
  143. <script src="https://unpkg.com/video.js@7.10.2/dist/video.min.js"></script>
  144. <script type="text/javascript">
  145. function configCamera(ctrl, movenum) {
  146. if (ctrl == "takephoto") {
  147. $.ajax({
  148. type: "POST",
  149. url: "https://wx.hnyfwlw.com/api/api_gateway?method=camera.camera_manage.camera_takephoto",
  150. data: {
  151. device_id: device_id,
  152. }
  153. }).then((res) => {
  154. if (res.data.data) {
  155. var data = JSON.parse(res.data.data);
  156. var picUrl = data.data.picUrl;
  157. } else {
  158. console.log(res.data.message)
  159. }
  160. });
  161. } else {
  162. //上下左右、放大、缩小
  163. $.ajax({
  164. type: "POST",
  165. url: "https://wx.hnyfwlw.com/api/api_gateway?method=camera.camera_manage.ctrl_camera",
  166. data: {
  167. device_id: device_id,
  168. ctrl: ctrl,
  169. movenum: movenum,
  170. }
  171. }).then((res) => {
  172. $('#dialog').html('指令下发成功,请等待...').stop().show(500).delay(3000).hide(500)
  173. })
  174. }
  175. }
  176. function stopConfigCamera() {
  177. $.ajax({
  178. type: "POST",
  179. url: "https://wx.hnyfwlw.com/api/api_gateway?method=camera.camera_manage.ctrl_camera",
  180. data: {
  181. device_id: device_id,
  182. ctrl: "stop",
  183. },
  184. });
  185. }
  186. //上下左右和拍照
  187. var str = window.location.search.substr(1)
  188. var arr = str.split('&')
  189. // console.log(str);
  190. var device_id = arr[0].split('=')[1]
  191. // console.log(device_id);
  192. var accessToken = arr[1].split('=')[1]
  193. // console.log(accessToken)
  194. $.ajax({
  195. type: "POST",
  196. url: "https://wx.hnyfwlw.com/api/api_gateway?method=camera.camera_manage.addr_camera",
  197. // url: "http://192.168.0.117:8003/api/api_gateway?method=camera.camera_manage.addr_camera",
  198. data: {
  199. device_id: device_id
  200. // device_id: 'FA8690323-1',
  201. // token: localStorage.getItem('session_key')
  202. }
  203. }).then((res) => {
  204. // console.log(JSON.stringify(res))
  205. if(res.message == '') {
  206. if (typeof res.data == 'string') {
  207. var data = eval('(' + res.data + ')');
  208. } else {
  209. var data = res.data;
  210. }
  211. // console.log(data, 'data');
  212. let hlsHdSrc = data.type_id == 0 ? data.hls : data.hlsHd;
  213. var playHtml =
  214. `<video id="myPlayer" poster='' controls playsInline webkit-playsinline src=${hlsHdSrc} style="width:100%; height:100%;"></video>`;
  215. $("#box").html(playHtml)
  216. var myVideo = videojs(`myPlayer`, {
  217. controls: true,
  218. autoplay: 'play',
  219. url:hlsHdSrc,
  220. sources: [{
  221. type: 'application/x-mpegURL',
  222. src: hlsHdSrc,
  223. }],
  224. },function onPlayerReady() {
  225. myVideo.play()
  226. console.log('准备好了')
  227. });
  228. myVideo.on('play',function(){
  229. console.log('开始播放')
  230. })
  231. } else {
  232. alert(res.message)
  233. }
  234. })
  235. document.addEventListener('UniAppJSBridgeReady', function() {
  236. $('.imgBtn').click(function() {
  237. uni.navigateTo({
  238. url: '/pages/monitor/imagelist?id=' + device_id
  239. })
  240. })
  241. });
  242. </script>
  243. </html>