demo-easy.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 src="../codebase/webVideoCtrl.js"></script>
  23. <script>
  24. $(function () {
  25. // check the installation status of plugin
  26. var iRet = WebVideoCtrl.I_CheckPluginInstall();
  27. if (-1 == iRet) {
  28. alert("If the plugin is uninstalled, please install the WebComponentsKit.exe!");
  29. return;
  30. }
  31. var oPlugin = {
  32. iWidth: 600, // plugin width
  33. iHeight: 400 // plugin height
  34. };
  35. var oLiveView = {
  36. iProtocol: 1, // protocol 1£ºhttp, 2:https
  37. szIP: "172.10.18.59", // protocol ip
  38. szPort: "80", // protocol port
  39. szUsername: "admin", // device username
  40. szPassword: "12345678q", // device password
  41. iStreamType: 1, // stream 1£ºmain stream 2£ºsub-stream 3£ºthird stream 4£ºtranscode stream
  42. iChannelID: 1, // channel no
  43. bZeroChannel: false // zero channel
  44. };
  45. // Init plugin parameters and insert the plugin
  46. WebVideoCtrl.I_InitPlugin(oPlugin.iWidth, oPlugin.iHeight, {
  47. bWndFull: true,//Wether support doule clicking to switch the full-screen mode: it's supported by default; true:support, false:not support
  48. iWndowType: 1,
  49. cbInitPluginComplete: function () {
  50. WebVideoCtrl.I_InsertOBJECTPlugin("divPlugin");
  51. // check plugin to see whether it is the latest
  52. if (-1 == WebVideoCtrl.I_CheckPluginVersion()) {
  53. alert("Detect the latest version, please double click WebComponentsKit.exe to update!");
  54. return;
  55. }
  56. // login
  57. WebVideoCtrl.I_Login(oLiveView.szIP, oLiveView.iProtocol, oLiveView.szPort, oLiveView.szUsername, oLiveView.szPassword, {
  58. success: function (xmlDoc) {
  59. // strat real play
  60. var szDeviceIdentify = oLiveView.szIP + "_" + oLiveView.szPort;
  61. setTimeout(function () {
  62. WebVideoCtrl.I_StartRealPlay(szDeviceIdentify, {
  63. iStreamType: oLiveView.iStreamType,
  64. iChannelID: oLiveView.iChannelID,
  65. bZeroChannel: oLiveView.bZeroChannel
  66. });
  67. }, 1000);
  68. }
  69. });
  70. }
  71. });
  72. // unload
  73. $(window).unload(function () {
  74. WebVideoCtrl.I_Stop();
  75. });
  76. });
  77. </script>
  78. </html>