daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html>
  3.     <head>
  4.         <title>Dash.js Rocks</title>
  5.         <style>
  6.             video {
  7.                 width: 1280px;
  8.                 height: 720px;
  9.             }
  10.         </style>
  11.     </head>
  12.     <body>
  13.         <div>
  14.             <video id="videoPlayer" controls></video>
  15.         </div>
  16.         <script src="dash.all.min.js"></script>
  17.         <script>
  18.             (function(){
  19.         var host="http://10.0.0.1:8000/";
  20.         var url = host+"BigBuckBunny_4s_simple_2014_05_09.mpd";
  21.         var player = dashjs.MediaPlayer().create();
  22.                 player.initialize(document.querySelector("#videoPlayer"), url, true);
  23.         setInterval(function() {
  24.             var currentQualityIndex = player.getQualityFor('video');
  25.             var currentQualityObject = player.getBitrateInfoListFor('video')[currentQualityIndex];
  26.             var bitrate = currentQualityObject.bitrate;
  27.             var xhr = new XMLHttpRequest();
  28.             var url = "http://10.0.0.1:90/";
  29.             xhr.open("POST", url, true);
  30.             xhr.setRequestHeader("Content-Type", "application/json");
  31.             xhr.onreadystatechange = function () {
  32.                     if (xhr.readyState === 4 && xhr.status === 200) {
  33.                         console.log(xhr.responseText);
  34.                     }
  35.             };
  36.             var data = JSON.stringify({"file": "editor_data_h2", "content": bitrate+"\n"});
  37.             xhr.send(data);
  38.         },4000)
  39.    
  40.             })();
  41.         </script>
  42.     </body>
  43. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top