demo-monitorsplit.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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. <title>EZOPEN播放协议</title>
  8. <style>
  9. body {
  10. margin: 0;
  11. }
  12. .hint {
  13. font-size: 14px;
  14. line-height: 3em;
  15. color: gray;
  16. }
  17. #url,
  18. #url2,
  19. #accessToken {
  20. width: 100%;
  21. }
  22. .btn-container {
  23. margin: 10px;
  24. }
  25. .normal {
  26. color: green;
  27. margin: 5px;
  28. }
  29. .error {
  30. color: red;
  31. margin: 5px;
  32. }
  33. </style>
  34. </head>
  35. <script>
  36. </script>
  37. <body>
  38. <script src="../ezuikit.js"></script>
  39. <!-- <script src="../js/jsPlugin-1.2.0.js"></script> -->
  40. <!-- <script src="https://cdn.jsdelivr.net/bluebird/latest/bluebird.min.js"></script> -->
  41. <div class="hint">demo页面仅为代码示例无法直接运行,需要部署到服务器上才可以播放。另外监控模式与多窗口模式对浏览器版本有要求:Chrome: 55+ Firefox: V55+。</div>
  42. <script src="../js/jquery.min.js"></script>
  43. <h2>预览,回放 多窗口模式示例:</h2>
  44. <!-- <p>ezopen地址用逗号分隔</p> -->
  45. <textarea id="url" placeholder="这里输入ezopen地址"></textarea>
  46. <textarea id="accessToken" placeholder="这里输入accessToken"></textarea>
  47. <div class="btn-container">
  48. <button id="init">开始初始化</button>
  49. <button id="start">初始化播放</button>
  50. <button id="stop">全部结束</button>
  51. </div>
  52. <div id="playWind" style="width: 1200px; height: 800px;">
  53. </div>
  54. <script>
  55. var decoder;
  56. $("#init").click(function () {
  57. var url = $('#url').val().trim();
  58. var accessToken = $('#accessToken').val().trim();
  59. decoder = new EZUIKit.EZUIPlayer({
  60. id: 'playWind',
  61. autoplay: true,
  62. url: url,
  63. accessToken: accessToken,
  64. decoderPath: '../',
  65. width: 1200,
  66. height: 800,
  67. splitBasis: 2, // 1*1 2*2 3*3 4*4
  68. });
  69. // 这里是打印日志,本例抛出到播放页面
  70. decoder.on('log', log);
  71. function log(str, className) {
  72. var div = document.createElement('DIV');
  73. div.className = className || 'normal';
  74. div.innerHTML = (new Date()).Format('yyyy-MM-dd hh:mm:ss.S') + JSON.stringify(str);
  75. document.body.appendChild(div);
  76. }
  77. $("#start").click(function () {
  78. decoder.play({
  79. //index:[0,1],
  80. // handleError: handleError,
  81. // handleSuccess: handleSuccess,
  82. });
  83. })
  84. })
  85. $("#stop").click(function () {
  86. var url = $('#url').val().trim();
  87. var urlList = [];
  88. if (url.length > 0) {
  89. urlList = url.split(',');
  90. }
  91. for (var i = 0; i < urlList.length; i++) {
  92. if (urlList[i] && urlList[i].length > 0) {
  93. decoder.stop(i);
  94. }
  95. }
  96. })
  97. </script>
  98. </body>
  99. </html>