How to get session id in custom plugin

As in the subject - I need to get kaltura session id in my custom plugin.
I found that i can take it from Services:

but I can not make it works. Could anyone help me with it?


Please paste your code.

Hii @jess can you plz look this issue also

i am trying to get it like that:

requestVars.uks = window.kWidgetSupport.kSessionId;

Hey Jess, any suggestion for this one?

From your custom plugin you should have access to the embedPlayer object.
So you can get the session ID by using:

kSession is different than sessionId from configProxy. Here is the way how to get kSession:

   var kClient = mw.kApiGetPartnerClient( embedPlayer.kwidgetid );
            //generate KS if missing
            if( !kClient.getKs() ){
                kClient.doRequest( { 'service' : 'session', 'action' : 'startWidgetSession', 'widgetId': embedPlayer.kwidgetid }, function( data ) {
                    if ( data.code ) {
                        trace("stats:: Error:: startWidgetSession failed");
                    } else if ( data.ks ) {
                        if (typeof console != 'undefined' && console.log)
                        kClient.setKs( data.ks );
                        cb_uks = data.ks;
                }, true );