Jessibuca是一款开源的纯H5直播流播放器,通过Emscripten将音视频解码库编译成Js(ams.js/wasm)运行于浏览器之中。兼容几乎所有浏览器,可以运行在PC、手机、微信中,无需额外安装插件。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.3 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
6 years ago
7 years ago
6 years ago
7 years ago
6 years ago
7 years ago
6 years ago
7 years ago
7 years ago
7 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>H5LiveClient 1.0</title>
  6. <meta charset="utf-8" />
  7. </head>
  8. <body>
  9. <canvas id="canvas" style="background-color: #0D0E1B" width="640" height="352"></canvas>
  10. <button id="connectbn" style="width: 100px;height: 100px" onclick="test()">播放1</button>
  11. <button onclick="h5lc.close()" style="width: 100px; height: 100px">结束</button>
  12. <div id="logout">
  13. </div>
  14. <script>
  15. onerror = handleErr;
  16. var txt = "";
  17. var h5lc = null;
  18. var canvas = document.getElementById("canvas");
  19. disabledMouseWheel(canvas)
  20. function test() {
  21. // h5lc.play("ws://10.24.13.58:8088/live/user1.flv", canvas)
  22. h5lc.play("wss://pulls.1234326.cn/live/L01.flv", canvas)
  23. // h5lc.play("ws://localhost:8080/live/user1", canvas)
  24. // h5lc.play("ws://test.qihaipi.com/gnddragon/test.flv", canvas)
  25. }
  26. function disabledMouseWheel(ele) {
  27. if (ele.addEventListener) {
  28. ele.addEventListener('DOMMouseScroll', scrollFunc, false);
  29. } //W3C
  30. ele.onmousewheel = scrollFunc; //IE/Opera/Chrome
  31. }
  32. function scrollFunc(evt) {
  33. evt = evt || window.event;
  34. if (evt.preventDefault) {
  35. // Firefox
  36. evt.preventDefault();
  37. evt.stopPropagation();
  38. } else {
  39. // IE
  40. evt.cancelBubble = true;
  41. evt.returnValue = false;
  42. }
  43. return false;
  44. }
  45. function handleErr(msg, url, l) {
  46. txt = "There was an error on this page.\n\n";
  47. txt += "Error: " + msg + "\n";
  48. txt += "URL: " + url + "\n";
  49. txt += "Line: " + l + "\n\n";
  50. document.getElementById("logout").innerHTML += txt + "<br>";
  51. return true;
  52. }
  53. var Module = {
  54. print: (function () {
  55. return function (text) {
  56. if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
  57. document.getElementById("logout").innerHTML += text + "<br>";
  58. // These replacements are necessary if you render to raw HTML
  59. //text = text.replace(/&/g, "&amp;");
  60. //text = text.replace(/</g, "&lt;");
  61. //text = text.replace(/>/g, "&gt;");
  62. //text = text.replace('\n', '<br>', 'g');
  63. console.log(text);
  64. };
  65. })(),
  66. printErr: function (text) {
  67. if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
  68. document.getElementById("logout").innerHTML += text + "<br>";
  69. if (0) { // XXX disabled for safety typeof dump == 'function') {
  70. dump(text + '\n'); // fast, straight to the real console
  71. } else {
  72. console.error(text);
  73. }
  74. },
  75. postRun: function () {
  76. h5lc = new H5LiveClient();
  77. h5lc.videoBuffer = 1;
  78. }
  79. };
  80. </script>
  81. <script src="264_mp3.js"></script>
  82. </body>
  83. </html>