I got a demo from @EthanJWPlayer. It's very clear demo..
And i'm simplify that code.
Firstly add this method on your jwplayer functions:
var bitrateList = [],
bandwidth = 0,
currentBitrate =0,
levels;
jwplayer().setup({
....
events:
onQualityChange: function(callback) {
levels = callback.levels;
render();
},
onQualityLevels: function(callback) {
levels = callback.levels;
render();
},
onMeta: function(event) {
if (event.metadata.bandwidth) {
var b = event.metadata.bandwidth;
var l = Number(event.metadata.currentLevel.substr(0, 1));
if (b != bandwidth) {
bandwidth = b;
currentBitrate = bitrateList[l - 1];
}
}
}
});
function render() {
bitrateList = [];
for (var i = 1; i < levels.length; i++) {
bitrateList.push(levels[i].bitrate);
}
}
and you can be give anywhere on your JavaScript code from "currentBitrate" variable.
for example:
sendStatistics(currentBitrate);
In addition to adaptive bitrate streaming (adaptive streaming - jw player auto mode), changed every second bitrate value depending on the current bandwidth. If you want get value of the bitrate, append above code and get currentBitrate
value.