index-iframe.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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: 390px;
  14. height: 96vh;
  15. max-width: 100%;
  16. max-height: 100%;
  17. }
  18. </style>
  19. <body>
  20. <div>
  21. <div id="divPlugin" class="plugin"></div>
  22. </div>
  23. </body>
  24. <script src="../jquery-1.7.1.min.js"></script>
  25. <script src="../codebase/encryption/AES.js"></script>
  26. <script src="../codebase/encryption/cryptico.min.js"></script>
  27. <!-- <script src="../codebase/encryption/encryption.js"></script> -->
  28. <script src="../codebase/encryption/crypto-3.1.2.min.js"></script>
  29. <script src="../codebase/webVideoCtrl.js"></script>
  30. <script>
  31. $(function () {
  32. // 检查插件是否已经安装过
  33. var iRet = WebVideoCtrl.I_CheckPluginInstall();
  34. if (-1 == iRet) {
  35. alert("您还未安装过插件,双击开发包目录里的WebComponentsKit.exe安装!");
  36. return;
  37. }
  38. var oPlugin = {
  39. iWidth: $('#divPlugin').width(), // plugin width
  40. iHeight: $('#divPlugin').height() // plugin height
  41. };
  42. var oLiveView = {
  43. iProtocol: 1, // protocol 1:http, 2:https
  44. iStreamType: 1, // stream 1:main stream 2:sub-stream 3:third stream 4:transcode stream
  45. iChannelID: 1, // channel no
  46. bZeroChannel: false // zero channel
  47. };
  48. if(GetQueryString('ip')&&GetQueryString('port')&&GetQueryString('name')&&GetQueryString('pwd')){
  49. oLiveView.szIP=GetQueryString('ip')
  50. oLiveView.szPort=GetQueryString('port')
  51. oLiveView.szUsername=GetQueryString('name')
  52. oLiveView.szPassword=GetQueryString('pwd')
  53. }else{
  54. alert('参数不全')
  55. return
  56. }
  57. // 初始化插件参数及插入插件
  58. WebVideoCtrl.I_InitPlugin(oPlugin.iWidth, oPlugin.iHeight, {
  59. bWndFull: true,//是否支持单窗口双击全屏,默认支持 true:支持 false:不支持
  60. iWndowType: 1,
  61. cbInitPluginComplete: function () {
  62. WebVideoCtrl.I_InsertOBJECTPlugin("divPlugin");
  63. // 检查插件是否最新
  64. if (-1 == WebVideoCtrl.I_CheckPluginVersion()) {
  65. alert("检测到新的插件版本,双击开发包目录里的WebComponentsKit.exe升级!");
  66. return;
  67. }
  68. // 登录设备
  69. WebVideoCtrl.I_Login(oLiveView.szIP, oLiveView.iProtocol, oLiveView.szPort, oLiveView.szUsername, oLiveView.szPassword, {
  70. success: function (xmlDoc) {
  71. // 开始预览
  72. var szDeviceIdentify = oLiveView.szIP + "_" + oLiveView.szPort;
  73. setTimeout(function () {
  74. WebVideoCtrl.I_StartRealPlay(szDeviceIdentify, {
  75. iStreamType: oLiveView.iStreamType,
  76. iChannelID: oLiveView.iChannelID,
  77. bZeroChannel: oLiveView.bZeroChannel
  78. });
  79. }, 1000);
  80. }
  81. });
  82. }
  83. });
  84. // 关闭浏览器
  85. $(window).unload(function () {
  86. WebVideoCtrl.I_Stop();
  87. });
  88. });
  89. function GetQueryString(name)
  90. {
  91. var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
  92. var r = window.location.search.substr(1).match(reg);
  93. if(r!=null)return unescape(r[2]); return null;
  94. }
  95. </script>
  96. </html>