Advertisement
M3uking

12345

Jun 4th, 2019
3,305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>CDNBye videojs5 demo</title>
  6. </head>
  7. <link href="//vjs.zencdn.net/7.2/video-js.min.css" rel="stylesheet">
  8. <script src="//vjs.zencdn.net/7.2/video.min.js"></script>
  9. <!-- increase browser support with MSE polyfill -->
  10. <script src="//unpkg.com/videojs-contrib-media-sources@4.4.4/dist/videojs-contrib-media-sources.min.js"></script>
  11. <script src="//cdn.jsdelivr.net/npm/cdnbye@latest"></script>
  12. <script src="//cdn.jsdelivr.net/npm/cdnbye@latest/dist/videojs-contrib-hlsjs.min.js"></script>
  13.  
  14. <body>
  15. <div id="main">
  16.     <video id="player" class="video-js vjs-default-skin" height="360" width="640" controls preload="none">
  17.         <source src="https://video-dev.github.io/streams/x36xhzz/url_2/193039199_mp4_h264_aac_ld_7.m3u8"
  18.                 type="application/x-mpegURL"/>
  19.     </video>
  20.     <p id="version"></p>
  21.     <h3>download info:</h3>
  22.     <p id="info"></p>
  23. </div>
  24. <script>
  25.     document.querySelector('#version').innerText = `hls.js version: ${Hls.version}  cdnbye version: ${Hls.engineVersion}`;
  26.     var player = videojs('#player', {
  27.         autoplay: true,
  28.         html5: {
  29.             hlsjsConfig: {
  30.                 debug: false,
  31.                 // Other hlsjsConfig options provided by hls.js
  32.                 p2pConfig: {
  33.                     logLevel: true,
  34.                     live: false,        // set to true in live mode
  35.                     wsSignalerAddr: 'wss://opensignal.cdnbye.com',
  36.                     getStats: function (totalP2PDownloaded, totalP2PUploaded, totalHTTPDownloaded) {
  37.                         var total = totalHTTPDownloaded + totalP2PDownloaded;
  38.                         document.querySelector('#info').innerText = `p2p ratio: ${Math.round(totalP2PDownloaded/total*100)}%, saved traffic: ${totalP2PDownloaded}KB, uploaded: ${totalP2PUploaded}KB`;
  39.                     },
  40.                     // Other p2pConfig options provided by CDNBye
  41.                 }
  42.             }
  43.         }
  44.     });
  45. </script>
  46. </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement