demo-easy.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title></title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta http-equiv="Pragma" content="no-cache" />
  7. <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
  8. <meta http-equiv="Expires" content="0" />
  9. </head>
  10. <style>
  11. .plugin {
  12. width: 600px;
  13. height: 400px;
  14. }
  15. </style>
  16. <body>
  17. <div>
  18. <div id="divPlugin" class="plugin"></div>
  19. </div>
  20. </body>
  21. <script src="../jquery-1.7.1.min.js"></script>
  22. <!-- <script>
  23. function openBypass(original_function) {
  24. return function(method, url, async) {
  25. if(url.indexOf('/ISAPI')>-1||url.indexOf('SDK/')>-1){
  26. if(url.indexOf(location.host)>-1){
  27. url=url.replace(location.host,getCookie("webVideoCtrlProxy")||"http://192.168.3.250:80")
  28. console.log({url})
  29. this.requestURL = url;
  30. }
  31. }
  32. return original_function.apply(this, arguments);
  33. };
  34. }
  35. function getCookie(cname)
  36. {
  37. var name = cname + "=";
  38. var ca = document.cookie.split(';');
  39. for(var i=0; i<ca.length; i++)
  40. {
  41. var c = ca[i].trim();
  42. if (c.indexOf(name)==0) return c.substring(name.length,c.length);
  43. }
  44. return "";
  45. }
  46. function sendBypass(original_function) {
  47. return function(data) {
  48. // 保存请求相关参数
  49. this.requestData = data;
  50. return original_function.apply(this, arguments);
  51. };
  52. }
  53. XMLHttpRequest.prototype.open = openBypass(XMLHttpRequest.prototype.open);
  54. </script> -->
  55. <script src="../codebase/encryption/AES.js"></script>
  56. <script src="../codebase/encryption/cryptico.min.js"></script>
  57. <!-- <script src="../codebase/encryption/encryption.js"></script> -->
  58. <script src="../codebase/encryption/crypto-3.1.2.min.js"></script>
  59. <script src="../codebase/webVideoCtrl.js"></script>
  60. <script>
  61. $(function () {
  62. // 检查插件是否已经安装过
  63. var iRet = WebVideoCtrl.I_CheckPluginInstall();
  64. if (-1 == iRet) {
  65. alert("您还未安装过插件,双击开发包目录里的WebComponentsKit.exe安装!");
  66. return;
  67. }
  68. var oPlugin = {
  69. iWidth: 600, // plugin width
  70. iHeight: 400 // plugin height
  71. };
  72. var oLiveView = {
  73. iProtocol: 1, // protocol 1:http, 2:https
  74. szIP: "192.168.3.250", // protocol ip
  75. szPort: "80", // protocol port
  76. szUsername: "admin", // device username
  77. szPassword: "qzz878616", // device password
  78. iStreamType: 1, // stream 1:main stream 2:sub-stream 3:third stream 4:transcode stream
  79. iChannelID: 1, // channel no
  80. bZeroChannel: false // zero channel
  81. };
  82. // 初始化插件参数及插入插件
  83. WebVideoCtrl.I_InitPlugin(oPlugin.iWidth, oPlugin.iHeight, {
  84. bWndFull: true,//是否支持单窗口双击全屏,默认支持 true:支持 false:不支持
  85. iWndowType: 1,
  86. cbInitPluginComplete: function () {
  87. WebVideoCtrl.I_InsertOBJECTPlugin("divPlugin");
  88. // 检查插件是否最新
  89. if (-1 == WebVideoCtrl.I_CheckPluginVersion()) {
  90. alert("检测到新的插件版本,双击开发包目录里的WebComponentsKit.exe升级!");
  91. return;
  92. }
  93. // 登录设备
  94. WebVideoCtrl.I_Login(oLiveView.szIP, oLiveView.iProtocol, oLiveView.szPort, oLiveView.szUsername, oLiveView.szPassword, {
  95. success: function (xmlDoc) {
  96. // 开始预览
  97. var szDeviceIdentify = oLiveView.szIP + "_" + oLiveView.szPort;
  98. setTimeout(function () {
  99. WebVideoCtrl.I_StartRealPlay(szDeviceIdentify, {
  100. iStreamType: oLiveView.iStreamType,
  101. iChannelID: oLiveView.iChannelID,
  102. bZeroChannel: oLiveView.bZeroChannel
  103. });
  104. }, 1000);
  105. }
  106. });
  107. }
  108. });
  109. // window.addEventListener("message", (e) => {
  110. // var oLiveView = {
  111. // iProtocol: 1, // protocol 1:http, 2:https
  112. // // szIP: "192.168.3.250", // protocol ip
  113. // // szPort: "80", // protocol port
  114. // // szUsername: "admin", // device username
  115. // // szPassword: "qzz878616", // device password
  116. // iStreamType: 1, // stream 1:main stream 2:sub-stream 3:third stream 4:transcode stream
  117. // iChannelID: 1, // channel no
  118. // bZeroChannel: false // zero channel
  119. // };
  120. // if(e.data.oLiveView){
  121. // oLiveView={...oLiveView,...e.data.oLiveView}
  122. // }
  123. // // 初始化插件参数及插入插件
  124. // WebVideoCtrl.I_InitPlugin(oPlugin.iWidth, oPlugin.iHeight, {
  125. // bWndFull: true,//是否支持单窗口双击全屏,默认支持 true:支持 false:不支持
  126. // iWndowType: 1,
  127. // cbInitPluginComplete: function () {
  128. // WebVideoCtrl.I_InsertOBJECTPlugin("divPlugin");
  129. // // 检查插件是否最新
  130. // if (-1 == WebVideoCtrl.I_CheckPluginVersion()) {
  131. // alert("检测到新的插件版本,双击开发包目录里的WebComponentsKit.exe升级!");
  132. // return;
  133. // }
  134. // // 登录设备
  135. // WebVideoCtrl.I_Login(oLiveView.szIP, oLiveView.iProtocol, oLiveView.szPort, oLiveView.szUsername, oLiveView.szPassword, {
  136. // success: function (xmlDoc) {
  137. // // 开始预览
  138. // var szDeviceIdentify = oLiveView.szIP + "_" + oLiveView.szPort;
  139. // setTimeout(function () {
  140. // WebVideoCtrl.I_StartRealPlay(szDeviceIdentify, {
  141. // iStreamType: oLiveView.iStreamType,
  142. // iChannelID: oLiveView.iChannelID,
  143. // bZeroChannel: oLiveView.bZeroChannel
  144. // });
  145. // }, 1000);
  146. // }
  147. // });
  148. // }
  149. // });
  150. // })
  151. // 关闭浏览器
  152. $(window).unload(function () {
  153. WebVideoCtrl.I_Stop();
  154. });
  155. });
  156. </script>
  157. </html>