Trouble with current bitrate js - switchingChangeComplete

I’m trying to get the bitrate value of a video when a user change its quality.
I’m using:

kpd.kBind('switchingChangeComplete', function (newBitrate) {


kpd.kBind('switchingChangeComplete', function () {

and it seems like the value that this function returns, is the previous one (If I had 360p selected, when switching to 480p the triggered event reports the bitrate corresponding to 360p quality)
Is there any solution for this? Am I triggering the wrong event?

Also, I experimented that in chrome console, the method kdp.currentBitrate is working perfectly, returning the right value, but when I put it on the js script, the return value is undefined.

Can you help me with this?

Thank you so much for your help.

Hi @carlotagd

I haven’t seen the full context of the code, however, it could be that the kdp parameter was not defined, which is a bit more elaborated in the following article:

In addition, the following script is an example of somthing that you may want to achive:

kWidget.addReadyCallback( function( playerId ){
    var kdp = document.getElementById( 'kaltura_player' );
    kdp.kBind( 'bitrateChange', function(data){
        // Seek to 30 seconds from the start of the video

Hope it suits your needs.