demo-live.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. width: 100%;
  19. }
  20. .btn-container {
  21. margin: 10px;
  22. }
  23. #myPlayer {
  24. max-width: 600px;
  25. width: 100%;
  26. }
  27. </style>
  28. <script src="../ezuikit.js"></script>
  29. <script src="../js/jquery.min.js"></script>
  30. </head>
  31. <body>
  32. <!-- ezopen://open.ys7.com/f01018a141094b7fa138b9d0b856507b[.hd].live.[rtmp|hls|ws|flv|m3u8] http://hls.open.ys7.com/openlive/f01018a141094b7fa138b9d0b856507b.hd.m3u8-->
  33. <div class="hint">demo页面仅为代码示例无法直接运行,需要部署到服务器上才可以播放。另外监控模式与多窗口模式对浏览器版本有要求:Chrome: 55+ Firefox: V55+。</div>
  34. <textarea id="url"
  35. placeholder="这里输入直播地址">http://hls.open.ys7.com/openlive/f01018a141094b7fa138b9d0b856507b.m3u8</textarea>
  36. <div class="btn-container">
  37. <button id="init">初始化播放</button>
  38. <button id="stop">结束</button>
  39. </div>
  40. <video
  41. id="myPlayer"
  42. autoplay
  43. src=""
  44. controls
  45. playsInline
  46. webkit-playsinline
  47. >
  48. </video>
  49. <script>
  50. $('#init').click(function () {
  51. var url = $('#url').val().trim();
  52. $('#myPlayer').attr("src", url);
  53. var player = new EZUIKit.EZUIPlayer('myPlayer');
  54. // 日志
  55. player.on('log', log);
  56. function log(str) {
  57. var div = document.createElement('DIV');
  58. div.innerHTML = (new Date()).Format('yyyy-MM-dd hh:mm:ss.S') + JSON.stringify(str);
  59. document.body.appendChild(div);
  60. }
  61. $("#stop").click(function () {
  62. player.stop();
  63. })
  64. });
  65. </script>
  66. </body>
  67. </html>