2017-05-29 90 views
0

我打算展示我的點播視頻流(基於DASH-MPEG的實時吞吐量(kbps),見下面的代碼),但主要問題是我碰巧無法獲得基於MediaPlayer()的相關函數以在我的JavaScript函數(HTML5,內置)中獲取它。有人能夠幫助我,並指出是否有可能從當前的dash.js實現中獲得這樣的輸出? Throughputrule.js和其他基於規則的文件似乎在暗示這樣的吞吐量函數的存在,但他們不能用MediaPlayer的模塊似乎叫......謝謝你提前MPEG DASH - 獲得點播視頻流的平均吞吐量/比特率

<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> 

回答

1
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 + " kbps"; 
},1000)