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.
|
|
<!DOCTYPE html> <html>
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>H5LiveClient 1.0</title> <meta charset="utf-8" /> </head>
<body> <canvas id="canvas" style="background-color: #0D0E1B" width="640" height="352"></canvas> <button id="connectbn" style="width: 100px;height: 100px" onclick="test()">播放1</button> <button onclick="h5lc.close()" style="width: 100px; height: 100px">结束</button> <div id="logout"> </div> <script> onerror = handleErr; var txt = ""; var h5lc = null; var canvas = document.getElementById("canvas"); disabledMouseWheel(canvas)
function test() { // h5lc.play("ws://10.24.13.58:8088/live/user1.flv", canvas) h5lc.play("wss://pulls.1234326.cn/live/L01.flv", canvas) // h5lc.play("ws://localhost:8080/live/user1", canvas) // h5lc.play("ws://test.qihaipi.com/gnddragon/test.flv", canvas) }
function disabledMouseWheel(ele) { if (ele.addEventListener) { ele.addEventListener('DOMMouseScroll', scrollFunc, false); } //W3C ele.onmousewheel = scrollFunc; //IE/Opera/Chrome }
function scrollFunc(evt) { evt = evt || window.event; if (evt.preventDefault) { // Firefox evt.preventDefault(); evt.stopPropagation(); } else { // IE evt.cancelBubble = true; evt.returnValue = false; } return false; }
function handleErr(msg, url, l) { txt = "There was an error on this page.\n\n"; txt += "Error: " + msg + "\n"; txt += "URL: " + url + "\n"; txt += "Line: " + l + "\n\n"; document.getElementById("logout").innerHTML += txt + "<br>"; return true; } var Module = { print: (function () { return function (text) { if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); document.getElementById("logout").innerHTML += text + "<br>"; // These replacements are necessary if you render to raw HTML //text = text.replace(/&/g, "&"); //text = text.replace(/</g, "<"); //text = text.replace(/>/g, ">"); //text = text.replace('\n', '<br>', 'g'); console.log(text); }; })(), printErr: function (text) { if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); document.getElementById("logout").innerHTML += text + "<br>"; if (0) { // XXX disabled for safety typeof dump == 'function') { dump(text + '\n'); // fast, straight to the real console } else { console.error(text); } }, postRun: function () { h5lc = new H5LiveClient(); h5lc.videoBuffer = 1; } }; </script> <script src="264_mp3.js"></script> </body>
</html>
|