index.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  5. <meta name="renderer" content="webkit">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  7. <!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
  8. <title>
  9. 启东市铁路沿线综合治理信息化管理平台
  10. </title>
  11. <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
  12. <style>
  13. html,
  14. body,
  15. #app {
  16. height: 100%;
  17. margin: 0px;
  18. padding: 0px;
  19. font-size: 10px;
  20. }
  21. .chromeframe {
  22. margin: 0.2em 0;
  23. background: #ccc;
  24. color: #000;
  25. padding: 0.2em 0;
  26. }
  27. #loader-wrapper {
  28. position: fixed;
  29. top: 0;
  30. left: 0;
  31. width: 100%;
  32. height: 100%;
  33. z-index: 999999;
  34. }
  35. #loader {
  36. display: block;
  37. position: relative;
  38. left: 50%;
  39. top: 50%;
  40. width: 150px;
  41. height: 150px;
  42. margin: -75px 0 0 -75px;
  43. border-radius: 50%;
  44. border: 3px solid transparent;
  45. border-top-color: #FFF;
  46. -webkit-animation: spin 2s linear infinite;
  47. -ms-animation: spin 2s linear infinite;
  48. -moz-animation: spin 2s linear infinite;
  49. -o-animation: spin 2s linear infinite;
  50. animation: spin 2s linear infinite;
  51. z-index: 1001;
  52. }
  53. #loader:before {
  54. content: "";
  55. position: absolute;
  56. top: 5px;
  57. left: 5px;
  58. right: 5px;
  59. bottom: 5px;
  60. border-radius: 50%;
  61. border: 3px solid transparent;
  62. border-top-color: #FFF;
  63. -webkit-animation: spin 3s linear infinite;
  64. -moz-animation: spin 3s linear infinite;
  65. -o-animation: spin 3s linear infinite;
  66. -ms-animation: spin 3s linear infinite;
  67. animation: spin 3s linear infinite;
  68. }
  69. #loader:after {
  70. content: "";
  71. position: absolute;
  72. top: 15px;
  73. left: 15px;
  74. right: 15px;
  75. bottom: 15px;
  76. border-radius: 50%;
  77. border: 3px solid transparent;
  78. border-top-color: #FFF;
  79. -moz-animation: spin 1.5s linear infinite;
  80. -o-animation: spin 1.5s linear infinite;
  81. -ms-animation: spin 1.5s linear infinite;
  82. -webkit-animation: spin 1.5s linear infinite;
  83. animation: spin 1.5s linear infinite;
  84. }
  85. @-webkit-keyframes spin {
  86. 0% {
  87. -webkit-transform: rotate(0deg);
  88. -ms-transform: rotate(0deg);
  89. transform: rotate(0deg);
  90. }
  91. 100% {
  92. -webkit-transform: rotate(360deg);
  93. -ms-transform: rotate(360deg);
  94. transform: rotate(360deg);
  95. }
  96. }
  97. @keyframes spin {
  98. 0% {
  99. -webkit-transform: rotate(0deg);
  100. -ms-transform: rotate(0deg);
  101. transform: rotate(0deg);
  102. }
  103. 100% {
  104. -webkit-transform: rotate(360deg);
  105. -ms-transform: rotate(360deg);
  106. transform: rotate(360deg);
  107. }
  108. }
  109. #loader-wrapper .loader-section {
  110. position: fixed;
  111. top: 0;
  112. width: 51%;
  113. height: 100%;
  114. background: #7171C6;
  115. z-index: 1000;
  116. -webkit-transform: translateX(0);
  117. -ms-transform: translateX(0);
  118. transform: translateX(0);
  119. }
  120. #loader-wrapper .loader-section.section-left {
  121. left: 0;
  122. }
  123. #loader-wrapper .loader-section.section-right {
  124. right: 0;
  125. }
  126. .loaded #loader-wrapper .loader-section.section-left {
  127. -webkit-transform: translateX(-100%);
  128. -ms-transform: translateX(-100%);
  129. transform: translateX(-100%);
  130. -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  131. transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  132. }
  133. .loaded #loader-wrapper .loader-section.section-right {
  134. -webkit-transform: translateX(100%);
  135. -ms-transform: translateX(100%);
  136. transform: translateX(100%);
  137. -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  138. transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  139. }
  140. .loaded #loader {
  141. opacity: 0;
  142. -webkit-transition: all 0.3s ease-out;
  143. transition: all 0.3s ease-out;
  144. }
  145. .loaded #loader-wrapper {
  146. visibility: hidden;
  147. -webkit-transform: translateY(-100%);
  148. -ms-transform: translateY(-100%);
  149. transform: translateY(-100%);
  150. -webkit-transition: all 0.3s 1s ease-out;
  151. transition: all 0.3s 1s ease-out;
  152. }
  153. .no-js #loader-wrapper {
  154. display: none;
  155. }
  156. .no-js h1 {
  157. color: #222222;
  158. }
  159. #loader-wrapper .load_title {
  160. font-family: 'Open Sans';
  161. color: #FFF;
  162. font-size: 19px;
  163. width: 100%;
  164. text-align: center;
  165. z-index: 9999999999999;
  166. position: absolute;
  167. top: 60%;
  168. opacity: 1;
  169. line-height: 30px;
  170. }
  171. #loader-wrapper .load_title span {
  172. font-weight: normal;
  173. font-style: italic;
  174. font-size: 13px;
  175. color: #FFF;
  176. opacity: 0.5;
  177. }
  178. </style>
  179. <!--三个必要的js文件引入-->
  180. <script src="./html/jquery-1.12.4.min.js"></script>
  181. <script src="./html/jsencrypt.min.js"></script>
  182. <!-- 用于RSA加密 -->
  183. <!-- <script src="./html/jsWebControl-1.0.0.min.js"></script> -->
  184. <script type="text/javascript" src="ckplayer3.0x/hls.js/hls.min.js"></script>
  185. <link type="text/css" rel="stylesheet" href="./ckplayer3.0x/css/ckplayer.css" />
  186. <script type="text/javascript" src="./ckplayer3.0x/js/ckplayer.js" charset="utf-8" data-name="ckplayer"></script>
  187. <!-- <script type="text/javascript" src="./ckplayer/ckplayer.js" charset="utf-8" data-name="ckplayer"></script> -->
  188. <!-- <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> -->
  189. <link rel="stylesheet" href="./html/bootstrap.min.css">
  190. <script src="./html/bootstrap.bundle.min.js"></script>
  191. <script src="<%= BASE_URL %>js/liveplayer-lib.min.js"></script>
  192. <!-- 用于前端与插件交互 -->
  193. <script src="./jess/js/jessibuca-pro-demo.js"></script>
  194. <!-- <script src="./SkeyeWebPlayer/SkeyeWebPlayer.js"></script> -->
  195. <!-- <script type="text/javascript">
  196. var b_width = 1000;
  197. var b_height = 400;
  198. function getsize() {
  199. var oDivRect = $("#playWnd").get(0).getBoundingClientRect();
  200. b_width = oDivRect.width;
  201. b_height = oDivRect.height;
  202. }
  203. // if (cameraid == null) {
  204. // alert("缺少摄像机编号");
  205. // setTimeout(function() {
  206. // window.open("about:blank", "_self").close();
  207. // }, 1000);
  208. // } else {
  209. // getsize();
  210. //页面加载时创建播放实例初始化
  211. // $(window).load(function() {
  212. // initPlugin();
  213. // });
  214. //声明公用变量
  215. var initCount = 0;
  216. var pubKey = "";
  217. // 创建播放实例
  218. function initPlugin() {
  219. oWebControl = new WebControl({
  220. szPluginContainer: "playWnd", // 指定容器id
  221. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  222. iServicePortEnd: 15909,
  223. szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // 用于IE10使用ActiveX的clsid
  224. cbConnectSuccess: function() {
  225. // 创建WebControl实例成功
  226. oWebControl
  227. .JS_StartService("window", {
  228. // WebControl实例创建成功后需要启动服务
  229. dllPath: "./VideoPluginConnect.dll", // 值"./VideoPluginConnect.dll"写死
  230. })
  231. .then(
  232. function() {
  233. // 启动插件服务成功
  234. oWebControl.JS_SetWindowControlCallback({
  235. // 设置消息回调
  236. cbIntegrationCallBack: cbIntegrationCallBack,
  237. });
  238. oWebControl
  239. .JS_CreateWnd("playWnd", b_width, b_height)
  240. .then(function() {
  241. //JS_CreateWnd创建视频播放窗口,宽高可设定
  242. init(); // 创建播放实例成功后初始化
  243. });
  244. },
  245. function() {
  246. // 启动插件服务失败
  247. }
  248. );
  249. },
  250. cbConnectError: function() {
  251. // 创建WebControl实例失败
  252. oWebControl = null;
  253. $("#playWnd").html("插件未启动,正在尝试启动,请稍候...");
  254. WebControl.JS_WakeUp("VideoWebPlugin://"); // 程序未启动时执行error函数,采用wakeup来启动程序
  255. initCount++;
  256. if (initCount < 3) {
  257. setTimeout(function() {
  258. initPlugin();
  259. }, 3000);
  260. } else {
  261. $("#playWnd").html("插件启动失败,请检查插件是否安装!");
  262. }
  263. },
  264. cbConnectClose: function(bNormalClose) {
  265. // 异常断开:bNormalClose = false
  266. // JS_Disconnect正常断开:bNormalClose = true
  267. console.log("cbConnectClose");
  268. oWebControl = null;
  269. },
  270. });
  271. }
  272. // 设置窗口控制回调
  273. function setCallbacks() {
  274. oWebControl.JS_SetWindowControlCallback({
  275. cbIntegrationCallBack: cbIntegrationCallBack,
  276. });
  277. }
  278. // 推送消息
  279. function cbIntegrationCallBack(oData) {
  280. console.log(JSON.stringify(oData.responseMsg));
  281. }
  282. window.videosize = "1x1";
  283. //初始化
  284. function init() {
  285. getPubKey(function() {
  286. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  287. var appkey = "27794545"; //综合安防管理平台提供的appkey,必填
  288. var secret = setEncrypt("5Xi27Gl7JrbHHF1MpdaB"); //综合安防管理平台提供的secret,必填
  289. var ip = "2.90.220.252"; //综合安防管理平台IP地址,必填
  290. var playMode = 0; //初始播放模式:0-预览,1-回放
  291. var port = 443; //综合安防管理平台端口,若启用HTTPS协议,默认443
  292. var snapDir = "D:\\SnapDir"; //抓图存储路径
  293. var videoDir = "D:\\VideoDir"; //紧急录像或录像剪辑存储路径
  294. var layout = window.videosize; //playMode指定模式的布局
  295. var enableHTTPS = 1; //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  296. var encryptedFields = "secret"; //加密字段,默认加密领域为secret
  297. var showToolbar = 1; //是否显示工具栏,0-不显示,非0-显示
  298. var showSmart = 1; //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  299. var buttonIDs =
  300. "1,0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; //自定义工具条按钮
  301. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  302. oWebControl
  303. .JS_RequestInterface({
  304. funcName: "init",
  305. argument: JSON.stringify({
  306. appkey: appkey, //API网关提供的appkey
  307. secret: secret, //API网关提供的secret
  308. ip: ip, //API网关IP地址
  309. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  310. port: port, //端口
  311. snapDir: snapDir, //抓图存储路径
  312. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  313. layout: layout, //布局
  314. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  315. encryptedFields: encryptedFields, //加密字段
  316. showToolbar: showToolbar, //是否显示工具栏
  317. showSmart: showSmart, //是否显示智能信息
  318. buttonIDs: buttonIDs, //自定义工具条按钮
  319. }),
  320. })
  321. .then(function(oData) {
  322. oWebControl.JS_Resize(b_width, b_height); // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  323. if (window.videoresiz === "1x1") {
  324. window.startPreview(window.cameraid, -1);
  325. }
  326. });
  327. });
  328. }
  329. //获取公钥
  330. function getPubKey(callback) {
  331. oWebControl
  332. .JS_RequestInterface({
  333. funcName: "getRSAPubKey",
  334. argument: JSON.stringify({
  335. keyLength: 1024,
  336. }),
  337. })
  338. .then(function(oData) {
  339. console.log(oData);
  340. if (oData.responseMsg.data) {
  341. pubKey = oData.responseMsg.data;
  342. callback();
  343. }
  344. });
  345. }
  346. //RSA加密
  347. function setEncrypt(value) {
  348. var encrypt = new JSEncrypt();
  349. encrypt.setPublicKey(pubKey);
  350. return encrypt.encrypt(value);
  351. }
  352. // 监听resize事件,使插件窗口尺寸跟随DIV窗口变化
  353. $(window).resize(function() {
  354. videoresiz();
  355. });
  356. function videoresiz() {
  357. if (oWebControl != null) {
  358. getsize();
  359. oWebControl.JS_Resize(b_width, b_height);
  360. // setWndCover();
  361. }
  362. }
  363. // 监听滚动条scroll事件,使插件窗口跟随浏览器滚动而移动
  364. /**$(window).scroll(function () {
  365. if (oWebControl != null) {
  366. oWebControl.JS_Resize(1000, 600);
  367. setWndCover();
  368. }
  369. });**/
  370. // 设置窗口裁剪,当因滚动条滚动导致窗口需要被遮住的情况下需要JS_CuttingPartWindow部分窗口
  371. function setWndCover() {
  372. var iWidth = $(window).width();
  373. var iHeight = $(window).height();
  374. var oDivRect = $("#playWnd").get(0).getBoundingClientRect();
  375. var iCoverLeft = oDivRect.left < 0 ? Math.abs(oDivRect.left) : 0;
  376. var iCoverTop = oDivRect.top < 0 ? Math.abs(oDivRect.top) : 0;
  377. var iCoverRight =
  378. oDivRect.right - iWidth > 0 ? Math.round(oDivRect.right - iWidth) : 0;
  379. var iCoverBottom =
  380. oDivRect.bottom - iHeight > 0 ?
  381. Math.round(oDivRect.bottom - iHeight) :
  382. 0;
  383. iCoverLeft = iCoverLeft > 1000 ? 1000 : iCoverLeft;
  384. iCoverTop = iCoverTop > 600 ? 600 : iCoverTop;
  385. iCoverRight = iCoverRight > 1000 ? 1000 : iCoverRight;
  386. iCoverBottom = iCoverBottom > 600 ? 600 : iCoverBottom;
  387. oWebControl.JS_RepairPartWindow(0, 0, 1001, 600); // 多1个像素点防止还原后边界缺失一个像素条
  388. if (iCoverLeft != 0) {
  389. oWebControl.JS_CuttingPartWindow(0, 0, iCoverLeft, 600);
  390. }
  391. if (iCoverTop != 0) {
  392. oWebControl.JS_CuttingPartWindow(0, 0, 1001, iCoverTop); // 多剪掉一个像素条,防止出现剪掉一部分窗口后出现一个像素条
  393. }
  394. if (iCoverRight != 0) {
  395. oWebControl.JS_CuttingPartWindow(
  396. 1000 - iCoverRight,
  397. 0,
  398. iCoverRight,
  399. 600
  400. );
  401. }
  402. if (iCoverBottom != 0) {
  403. oWebControl.JS_CuttingPartWindow(
  404. 0,
  405. 600 - iCoverBottom,
  406. 1000,
  407. iCoverBottom
  408. );
  409. }
  410. }
  411. //视频预览功能
  412. $("#startPreview").click(function() {
  413. startPreview(window.cameraid, -1);
  414. });
  415. //停止全部预览
  416. $("#stopAllPreview").click(function() {
  417. stopall();
  418. });
  419. // 标签关闭
  420. // $(window).unload(function() {
  421. function closevideo() {
  422. if (oWebControl != null) {
  423. oWebControl.JS_HideWnd(); // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  424. oWebControl.JS_Disconnect().then(
  425. function() {
  426. // 断开与插件服务连接成功
  427. },
  428. function() {
  429. // 断开与插件服务连接失败
  430. }
  431. );
  432. }
  433. }
  434. // });
  435. function stopall() {
  436. oWebControl.JS_RequestInterface({
  437. funcName: "stopAllPreview",
  438. });
  439. }
  440. // windexlist [{wndId: 1},{wndId: 2}]
  441. function stoppreview(windexlist = []) {
  442. oWebControl.JS_RequestInterface({
  443. funcName: "stopMultiPlay",
  444. argument: {
  445. list: windexlist
  446. }
  447. });
  448. }
  449. function startPreview(cameraIndexCode = window.cameraid, index = -1) {
  450. console.log(cameraIndexCode)
  451. var cameraIndexCode = cameraIndexCode; //获取输入的监控点编号值,必填
  452. var streamMode = 0; //主子码流标识:0-主码流,1-子码流
  453. var transMode = 0; //传输协议:0-UDP,1-TCP
  454. var gpuMode = 0; //是否启用GPU硬解,0-不启用,1-启用
  455. var wndId = index; //播放窗口序号(在2x2以上布局下可指定播放窗口)
  456. cameraIndexCode = (cameraIndexCode + "").replace(/(^\s*)/g, "");
  457. cameraIndexCode = (cameraIndexCode + "").replace(/(\s*$)/g, "");
  458. console.log(JSON.stringify({
  459. cameraIndexCode: cameraIndexCode, //监控点编号
  460. streamMode: streamMode, //主子码流标识
  461. transMode: transMode, //传输协议
  462. gpuMode: gpuMode, //是否开启GPU硬解
  463. wndId: wndId, //可指定播放窗口
  464. }));
  465. oWebControl.JS_RequestInterface({
  466. funcName: "startPreview",
  467. argument: JSON.stringify({
  468. cameraIndexCode: cameraIndexCode, //监控点编号
  469. streamMode: streamMode, //主子码流标识
  470. transMode: transMode, //传输协议
  471. gpuMode: gpuMode, //是否开启GPU硬解
  472. wndId: wndId, //可指定播放窗口
  473. }),
  474. });
  475. }
  476. // }
  477. window.startPreview = startPreview;
  478. function getQueryString(name) {
  479. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  480. var r = window.location.search.substr(1).match(reg);
  481. if (r != null) return unescape(r[2]);
  482. return null;
  483. }
  484. </script> -->
  485. </head>
  486. <body>
  487. <div id="app">
  488. <div id="loader-wrapper">
  489. <div id="loader"></div>
  490. <div class="loader-section section-left"></div>
  491. <div class="loader-section section-right"></div>
  492. <div class="load_title">正在加载系统资源,请耐心等待</div>
  493. </div>
  494. </div>
  495. </body>
  496. </html>