Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Quality metrics


I've been working with JWPlayer API and I want to get download video bitrate and current buffer level in seconds for dash content. I use the following functions:

setInterval(updateStats, 500);
function updateStats(){

var qualityLevels = jwplayer().getQualityLevels()
var visualQuality = jwplayer().getVisualQuality();
var currentQuality = jwplayer().getCurrentQuality();

visualBitrate = qualityLevels[currentQuality].bitrate;
console.log("visualBitrate = ", visualBitrate);

}

But 'currentQuality' is always equals 0 and 'visualBitrate' = undefined. getCurrentQuality() should returns the index of the currently active quality level. Moreover qualityLevels = jwplayer().getQualityLevels() doen't have property 'bitrate'.

qualityLevels includes only: contentType, label and level_id

How can I get <download video bitrate value> and <current buffer level value> using JW Player API? What is wrong?
Thank you!

11 Community Answers

Randy

JW Player Support Agent  
0 rated :

Hello,

If you try the example code you’ve provided with a standard DASH stream or HLS stream are you seeing the same issue?

http://content.jwplatform.com/manifests/1peIG1Dj.m3u8

http://dash.edgesuite.net/envivio/dashpr/clear/Manifest.mpd

Randy

z...

User  
0 rated :

Hello Randy,

Thank you. I have tried your sources.

For source '1peIG1Dj.m3u8', qualityLevels = jwplayer().getQualityLevels() has a property 'bitrate' (also: height, index, label and width). But for 'currentQuality' I have the same situation, it always equals 0.

For your dash content 'Manifest.mpd' I have the same result as I had with my dash content.
-'currentQuality' is always equals 0,
-qualityLevels = jwplayer().getQualityLevels() doen't have property 'bitrate'.

Randy

JW Player Support Agent  
0 rated :

Hello,

Can you potentially place your code on a page for me so I can see the inner workings of what is going on?

Randy

z...

User  
0 rated :

Hello,

Yes, here you can find the code http://itmultimedia.ru/myexamples/dash-players/jwplayer-for-test/index.html

Anatoliy

z...

User  
0 rated :

I removed my license key! The code:

<html>
<head>

<script src="jwplayer.js"></script>
<script>jwplayer.key="123456789";</script>

</head>

<body>
<center>
<div id='myElement'>JW Player</div>

<script>
jwplayer("myElement").setup({
file: "http://dash.edgesuite.net/akamai/bbb_30fps/bbb_30fps.mpd",
//file: "http://dash.edgesuite.net/envivio/dashpr/clear/Manifest.mpd",
//file: "http://dash.edgesuite.net/envivio/dashpr/clear/Manifest.mpd",
"height": 360,
"width": 640,
"autostart": true
});

setInterval(updateStats, 500);

function updateStats(){

var qualityLevels = jwplayer().getQualityLevels()
console.log("-----qualityLevels------->", qualityLevels);
var visualQuality = jwplayer().getVisualQuality();
console.log("-----visualQuality------->", visualQuality);
var currentQuality = jwplayer().getCurrentQuality();

//currentQuality = "1";
console.log("-----currentQuality------->", currentQuality);

if(visualQuality /*> 0*/) {
visualBitrate = qualityLevels[currentQuality].bitrate;
console.log("------------>", visualBitrate);

}



}
</script>


<div>
<label for="bufferedDebug">Buffered:</label>
<span id="bufferedDebug"></span>
</div>

<div>
<label for="dlVideoBitrate">dlVideoBitrate:</label>
<span id="dlVideoBitrate"></span>
</div>

</center>

</body>
</html>

Randy

JW Player Support Agent  
0 rated :

Hello,

Thank you for sending over your code. jwplayer().getQualityLevels() will always return “0” if the stream is set to “Auto”. The 0 return will never changed unless the adaptive stream is forced into a manual stream feed. If you alter the HD button to change the stream do you see a different array number beside 0?

Randy

z...

User  
0 rated :

Hello,

You have written "jwplayer().getQualityLevels() will always return “0”" if the stream is set to “Auto”. I think you meant jwplayer().getCurrentQuality() will always return “0”?

If I alter the HD button to change the stream (stream is forced into a manual stream feed) the jwplayer().getCurrentQuality(); equils current quality (for example '5'). Yes it works for manual stream feed. But I steel have some questions:

1. How can I know what is the current quality if it's set to AUTO?
2. Why qualityLevels = jwplayer().getQualityLevels() doen't have property 'bitrate'? It should has this property (https://developer.jwplayer.com/jw-player/docs/developer-guide/api/javascript_api_reference/#quality)
3. How can I get download video bitrate and current buffer level in seconds for dash content if it's set to AUTO?

Thanks!
Anatoliy

Randy

JW Player Support Agent  
0 rated :

Hello,

I looked into this a bit further on my end and if you try using: jwplayer().getVisualQuality(); does that deliver the detail you require.

Kindly,

Randy

a...

User  
0 rated :

Hello Randy,

Yes, thanks. I gould get the download video bitrate.

var visualQuality = jwplayer().getVisualQuality();
level = "level";
downloadBitrate = visualQuality[level].bitrate;

How can I get a current player buffer level in seconds for dash content?

Anatoliy

Randy

JW Player Support Agent  
0 rated :

Hello,

At the moment our API does not support this. We are always updating our API parameters so please stay tuned as this could potentially be a feature down the line.

Randy

a...

User  
0 rated :

Hello, Randy

We really need this parameter for our system. We already use it for some other players which support MPEG-DASH.
We hope that you will add this feature in API soon.

Thank you!

This question has received the maximum number of answers.