0

I am intending to show the real-time throughput (kbps) of my VOD stream (DASH-MPEG based, see the code below), but the main issue is that I happen to fail at getting MediaPlayer()-based, relevant functions to fetch it in my javascript function (HTML5, in-built). Is anyone able to help me out and point out whether it is possible to get such outputs out of current dash.js implementations? Throughputrule.js and other rule-based files seem to imply the existence of such throughput functions but they cannot be called by MediaPlayer-module it seems...thank you in advance

    <script src="http://mediapm.edgesuite.net/dash/public/nightly/dist/dash.all.min.js"></script>

<script type="application/javascript">

var playervar = dashjs.MediaPlayer().create();
playervar.initialize(document.querySelector("#videoStart"),"somekindofmanifest.mpd", false);
var buildin = document.getElementById("Divbuilt");
<!--buildin attaches this real-time function to the div-section of my html page-->

setInterval(function() {
<!--what I wanted to address with this issue-->
buildin.innerHTML= "the bitrate level is currently " + bitrate + " kbps";},1000)
</script>
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
M. cro
  • 1
  • 2

1 Answers1

0
setInterval(function() {
    // get current quality index 
    var currentQualityIndex = playervar.getQualityFor('video');

    // playervar.getBitrateInfoListFor('video') -- returns array of all qualities
    var currentQualityObject = playervar.getBitrateInfoListFor('video')[currentQualityIndex];

    var bitrate = currentQualityObject.bitrate;
    buildin.innerHTML= "the bitrate level is currently " + (bitrate / 1000) + " kbps";
},1000)
LAamanni
  • 177
  • 2
  • 13
oboshto
  • 3,478
  • 4
  • 25
  • 24