cdnbye
Version:
Save Your Bandwidth using WebRTC.
46 lines (45 loc) • 1.78 kB
HTML
<html>
<head>
<meta charset="utf-8">
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui">
<meta name="referrer" content="no-referrer">
<title>CDNBye XGPlayer Demo</title>
<style type="text/css">
html, body {width:100%;height:100%;margin:auto;overflow: hidden;}
body {display:flex;}
#mse {flex:auto;}
</style>
<script type="text/javascript">
window.addEventListener('resize',function(){document.getElementById('mse').style.height=window.innerHeight+'px';});
</script>
</head>
<body>
<div id="mse"></div>
<script src="//cdn.jsdelivr.net/npm/xgplayer@1.1.4-beta.3/browser/index.js" charset="utf-8"></script>
<script src="//cdn.jsdelivr.net/npm/cdnbye@latest"></script>
<script src="//cdn.jsdelivr.net/npm/p2p-xgplayer-hlsjs@latest"></script>
<script type="text/javascript">
new window.HlsJsPlayer({
id: 'mse',
url: '//video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8',
autoplay: true,
playsinline: true,
height: window.innerHeight,
width: window.innerWidth,
hlsOpts: {
debug: false,
// Other hlsjsConfig options provided by hls.js
p2pConfig: {
logLevel: true,
live: false, // set to true in live mode
getStats: function (totalP2PDownloaded, totalP2PUploaded, totalHTTPDownloaded) {
console.log(`totalP2PDownloaded ${totalP2PDownloaded} totalP2PUploaded ${totalP2PUploaded} totalHTTPDownloaded ${totalHTTPDownloaded}`)
},
// Other p2pConfig options provided by CDNBye
}
}
});
</script>
</body>
</html>