index.html 21 KB

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