2

I want to know the bitrate during video playback in jwplayer 6's auto mode. When the video starts, the selected value is "Auto". But unlike other values, the "Auto" value doesn't include bitrate or other parameters.

my default parameters:

primary: "flash",
autostart:"true"

I've read this post but it didn't help me.

Someone can help me?

4

1 回答 1

2

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.

于 2014-01-26T02:26:51.653 回答