video.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Aisky-coffee</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  8. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  9. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  10. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  11. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  12. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  13. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  14. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  15. <!--可用來建立使用者小圖示-->
  16. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  17. <style>
  18. body {
  19. margin: 0;
  20. }
  21. .navbar-dark .navbar-nav .nav-link {
  22. color: white;
  23. cursor: pointer;
  24. text-decoration: none;
  25. width: 110px;
  26. height: 46px;
  27. }
  28. .nav-top {
  29. line-height: 40px;
  30. background-color: #C4C4C4;
  31. }
  32. .website_title {
  33. font-family: Roboto;
  34. font-style: normal;
  35. font-weight: normal;
  36. font-size: 30px;
  37. color: #000000;
  38. }
  39. .navbar-nav>li {
  40. float: none;
  41. display: inline-block;
  42. width: 100px;
  43. margin: 0 auto;
  44. text-align: center;
  45. }
  46. .navbar-nav>li a {
  47. font-size: 20px;
  48. }
  49. .main-page {
  50. margin-top: 200px;
  51. }
  52. .page-title {
  53. font-family: Roboto;
  54. font-style: normal;
  55. font-weight: bold;
  56. font-size: 36px;
  57. }
  58. .flex {
  59. display: flex;
  60. flex-direction: row;
  61. flex-wrap: wrap;
  62. justify-content: center;
  63. }
  64. .set-link {
  65. display: inline-block;
  66. width: 350px;
  67. height: 100px;
  68. line-height: 100px;
  69. background: #008CBA;
  70. border: 1px solid #CFCFCF;
  71. box-sizing: border-box;
  72. color: #FFFFFF;
  73. border-radius: 10px;
  74. font-size: 36px;
  75. }
  76. @media(max-width:373px) {
  77. .card {
  78. margin-right: 0px;
  79. }
  80. }
  81. @media(max-width:577px) {}
  82. @media(min-width:576px) {}
  83. @media(min-width:768px) {
  84. .navbar-nav>li {
  85. margin-left: 0px;
  86. }
  87. .navbar-nav .li-block {
  88. display: none;
  89. }
  90. }
  91. @media(min-width:991px) {
  92. .navbar-nav>li {
  93. margin-left: 20px;
  94. }
  95. .navbar-nav .li-block {
  96. display: none;
  97. }
  98. }
  99. @media(min-width:1200px) {
  100. .navbar-nav>li {
  101. margin-left: 50px;
  102. }
  103. .navbar-nav .li-block {
  104. display: inline-block;
  105. width: 100px;
  106. }
  107. }
  108. @media(min-width:1400px) {
  109. .navbar-nav .li-block {
  110. display: inline-block;
  111. width: 200px;
  112. }
  113. }
  114. @media(min-width:1689px) {
  115. .navbar-nav>li {
  116. margin-left: 50px;
  117. }
  118. .navbar-nav .li-block {
  119. display: inline-block;
  120. width: 500px;
  121. }
  122. }
  123. </style>
  124. <script>
  125. /*
  126. <!--//影像串流-->
  127. <!--function Btx() {-->
  128. <!--console.log('test');-->
  129. <!--console.log(document.getElementById("img3"));-->
  130. <!--document.getElementById("img3").src = "{{url_for('main.video_feed_views')}}";-->
  131. <!--$.get("/udp_client",'OK' , function(resText){-->
  132. <!--console.log(resText);-->
  133. <!--}, 'text');-->
  134. <!--};-->
  135. <!--function Btn() {-->
  136. <!--document.getElementById("img3").src = "../static/img/PV.jpg";-->
  137. <!--$.post("/udp_client", "OK", function(){-->
  138. <!--console.log(resText);-->
  139. <!--}, 'text');-->
  140. <!--$.post('/video_feed', "OK", function(){-->
  141. <!--console.log(resText);-->
  142. <!--}, 'text');-->
  143. <!--};-->
  144. */
  145. </script>
  146. </head>
  147. <body>
  148. <nav class="fixed-top">
  149. <nav class="navbar navbar-expand-md nav-top justify-content-center">
  150. <div>
  151. <span class="website_title">影像串流</span>
  152. </div>
  153. </nav>
  154. <nav class="navbar navbar-expand-md bg-dark navbar-dark nav-bottom">
  155. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
  156. <span class="navbar-toggler-icon"></span>
  157. </button>
  158. <div class="collapse navbar-collapse" id="collapsibleNavbar">
  159. <ul class="navbar-nav">
  160. <li class="nav-item">
  161. <a class="nav-link" href="/">首頁</a>
  162. </li>
  163. <li class="nav-item">
  164. <a class="nav-link" href="#">關於我們</a>
  165. </li>
  166. <li class="nav-item">
  167. <a class="nav-link" href="#">資訊</a>
  168. </li>
  169. <li class="nav-item">
  170. <a class="nav-link" href="#">聯絡方法</a>
  171. </li>
  172. <li class="nav-item">
  173. <a class="nav-link" href="/cargo_list">咖啡貨櫃</a>
  174. </li>
  175. <li class="nav-item">
  176. <a class="nav-link" href="/video">影像串流</a>
  177. </li>
  178. <li class="li-block"></li>
  179. <li class="nav-item">
  180. <a class="nav-link" href="#"><i class="fa fa-user-o"></i> {{params.username}}</a>
  181. </li>
  182. <li class="nav-item">
  183. <a class="nav-link" href="/logout">Logout</a>
  184. </li>
  185. </ul>
  186. </div>
  187. </nav>
  188. </nav>
  189. <div class="main-page">
  190. <!--<form method="" action="">-->
  191. <div class="container-fluid">
  192. <div class="row" style="margin-top:100px;">
  193. <div class="col flex">
  194. <!--<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 col-xs-12" style="margin-right: 20px ;margin-left: 20px; margin-top:20px; margin-bottom:20px;">-->
  195. <!--<div class="page-title text-center">-->
  196. <!--<a class="set-link" type="button" href="/learn">1.CNN</a>-->
  197. <!--</div>-->
  198. <!--</div>-->
  199. <!--<div class="col-xl-3 col-lg-6 col-md-6 col-sm-12 col-xs-12" style="margin-right: 20px ;margin-left: 20px; margin-top:20px; margin-bottom:20px;">-->
  200. <!--<div class="page-title text-center">-->
  201. <!--<a class="set-link" type="button" href="/learn">2.KNN</a>-->
  202. <!--</div>-->
  203. <!--</div>-->
  204. <!--<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12" style="margin-right: 20px ;margin-left: 20px; margin-top:20px; margin-bottom:20px;"></div>-->
  205. <!--<div class="col-md-12" style="text-align:center;margin-top:5px;">-->
  206. <!--<img id="img3" src="../static/img/PV.jpg" style="max-width:100%;height:auto;">-->
  207. <!--</div>-->
  208. <!--<div class="col-md-12 row" style="text-align:center;margin-top:5px;">-->
  209. <!--<div class="col-md-6" style="text-align:center;margin-top:5px;">-->
  210. <!--<button id="btn" style="font-size:20px" onclick="Btn()">關閉</button>-->
  211. <!--</div>-->
  212. <!--<div class="col-md-6" style="text-align:center;margin-top:5px;">-->
  213. <!--<button id="btx" style="font-size:20px" onclick="Btx()">影像串流</button>-->
  214. <!--</div>-->
  215. <!--</div>-->
  216. <div class="col-md-12 row flex" style="text-align:center;margin-top:5px;">
  217. <div class="col-md-4 row flex">
  218. <img src="" id="one" width="320" height="240">
  219. </div>
  220. <div class="col-md-4 row flex">
  221. <img src="" id="two" width="320" height="240">
  222. </div>
  223. <div class="col-md-4 row flex">
  224. <img src="" id="three" width="320" height="240">
  225. </div>
  226. </div>
  227. <div class="col-md-12 row flex" style="text-align:center;margin-top:5px;">
  228. <div class="col-md-4 row flex">
  229. <img src="" id="four" width="320" height="240">
  230. </div>
  231. <div class="col-md-4 row flex">
  232. <img src="" id="five" width="320" height="240">
  233. </div>
  234. <div class="col-md-4 row flex">
  235. <img src="" id="six" width="320" height="240">
  236. </div>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. <!--</form>-->
  242. </div>
  243. </body>
  244. <script>
  245. const img = document.querySelector('#one');
  246. const WS_URL = 'ws:///60.250.156.230:8088';
  247. const ws = new WebSocket(WS_URL);
  248. let urlObject;
  249. ws.onopen = () => console.log(`Connected to ${WS_URL}`);
  250. ws.onmessage = message => {
  251. const arrayBuffer = message.data;
  252. if (urlObject) {
  253. URL.revokeObjectURL(urlObject);
  254. }
  255. urlObject = URL.createObjectURL(new Blob([arrayBuffer]));
  256. img.src = urlObject;
  257. }
  258. const img1 = document.querySelector('#two');
  259. const WS_URL1 = 'ws:///60.250.156.230:8089';
  260. const ws1 = new WebSocket(WS_URL1);
  261. let urlObject1;
  262. ws1.onopen = () => console.log(`Connected to ${WS_URL1}`);
  263. ws1.onmessage = message1 => {
  264. const arrayBuffer1 = message1.data;
  265. if (urlObject1) {
  266. URL.revokeObjectURL(urlObject1);
  267. }
  268. urlObject1 = URL.createObjectURL(new Blob([arrayBuffer1]));
  269. img1.src = urlObject1;
  270. }
  271. const img2 = document.querySelector('#three');
  272. const WS_URL2 = 'ws:///60.250.156.230:8090';
  273. const ws2 = new WebSocket(WS_URL2);
  274. let urlObject2;
  275. ws2.onopen = () => console.log(`Connected to ${WS_URL2}`);
  276. ws2.onmessage = message2 => {
  277. const arrayBuffer2 = message2.data;
  278. if (urlObject2) {
  279. URL.revokeObjectURL(urlObject2);
  280. }
  281. urlObject2 = URL.createObjectURL(new Blob([arrayBuffer2]));
  282. img2.src = urlObject2;
  283. }
  284. const img3 = document.querySelector('#four');
  285. const WS_URL3 = 'ws:///60.250.156.230:8091';
  286. const ws3 = new WebSocket(WS_URL3);
  287. let urlObject3;
  288. ws3.onopen = () => console.log(`Connected to ${WS_URL3}`);
  289. ws3.onmessage = message3 => {
  290. const arrayBuffer3 = message3.data;
  291. if (urlObject3) {
  292. URL.revokeObjectURL(urlObject3);
  293. }
  294. urlObject3 = URL.createObjectURL(new Blob([arrayBuffer3]));
  295. img3.src = urlObject3;
  296. }
  297. const img4 = document.querySelector('#five');
  298. const WS_URL4 = 'ws:///60.250.156.230:8092';
  299. const ws4 = new WebSocket(WS_URL4);
  300. let urlObject4;
  301. ws4.onopen = () => console.log(`Connected to ${WS_URL4}`);
  302. ws4.onmessage = message4 => {
  303. const arrayBuffer4 = message4.data;
  304. if (urlObject4) {
  305. URL.revokeObjectURL(urlObject4);
  306. }
  307. urlObject4 = URL.createObjectURL(new Blob([arrayBuffer4]));
  308. img4.src = urlObject4;
  309. }
  310. const img5 = document.querySelector('#six');
  311. const WS_URL5 = 'ws:///60.250.156.230:8093';
  312. const ws5 = new WebSocket(WS_URL5);
  313. let urlObject5;
  314. ws5.onopen = () => console.log(`Connected to ${WS_URL5}`);
  315. ws5.onmessage = message5 => {
  316. const arrayBuffer5 = message5.data;
  317. if (urlObject5) {
  318. URL.revokeObjectURL(urlObject5);
  319. }
  320. urlObject5 = URL.createObjectURL(new Blob([arrayBuffer5]));
  321. img5.src = urlObject5;
  322. }
  323. </script>
  324. </html>