Embed video with user problem

Hi, I am trying to embed a video on a website and I would like to know who watches the video (Viewers). So I try to use the following code to login.
var config = new KalturaConfiguration();
config.serviceUrl = ‘https://www.kaltura.com’;
var client = new KalturaClient(config);
KalturaUserService.loginByLoginId(loginId, password, partnerId, expiry, privileges, otp)
.execute(client, function(success, results) {
if (!success || (results && results.code && results.message)) {
console.log(‘Kaltura Error’, success, results);
} else {
console.log(‘Kaltura Result’, results);
client.setKs(results);
}
});
And I use the following code to embed the video
kWidget.embed({
“targetId”: “{targetId}”,
“wid”: “_{partnerId}}”,
“uiconf_id”: ‘{uiConfId}’,
“flashvars”: {},
“entry_id”: “{entry_id}”
});
Then I try to see the video analytics in KMC Engagement Per User of that video, the Unknown (Name) data is updated not the account I login. So what should I do to let it know
the login user play the video instead of the Unknown? Thanks.

1 Like

Hello @chau_chow,

Calling KalturaUserService.loginByLoginId(loginId, password, partnerId, expiry, privileges, otp) will return a KS (Kaltura Session) string. You should include that in the embed code, like so:

kWidget.embed({
“targetId”: “{targetId}”,
“wid”: “_{partnerId}}”,
“uiconf_id”: ‘{uiConfId}’,
  "flashvars": 
  {
    "ks": ""
  },
  "cache_st": 1564598506,
  "entry_id": "{entry_id}"

});
1 Like