I am newbie. Please provide code sample to connect to Kaltura and get media listing in account for Node.js. I always see client object is undefined in my code. I masked user id.
var cb = function (success, results){
console.info(results);
};
var kc = require('../lib/kaltura/KalturaClient');
var ktypes = require('../lib/kaltura/KalturaTypes');
var partnerId = 1111111;
var conf = new kc.KalturaConfiguration(partnerId);
conf.serviceUrl = "http://www.kaltura.com";
var client = new kc.KalturaClient(conf);
var secret = "XXXXXXXXX";
var userId = "XXXX@XXXXX.com";
var type = ktypes.KalturaSessionType.ADMIN;
var expiry = 100000;
var privileges = null;
var result = client.session.start(cb, secret, userId, type, partnerId, expiry, privileges);
First, can you check the /opt/kaltura/log/kaltura_api_v3.log for errors?
Second, can you try to create a session using the test console module? it is under the ‘developer’ tab in the admin console.
It displayed this string in console. djJ8MTgyMDk0MXx3MMvcMRJFGcDALif_CPaHOmLEaq1ZPDjB2GZpYx5rrXT0M8UCWSlQzAIdzYMv0nLhKB2ovo-VY-zD4lIXOYZKd55c1TTWzrOWkvq5YmU4puAc4u-sX4VUCP_TPurrZR4=0.00040292739868164
Does this mean call successful for session?
I am working on mac. which directory will have log file?
You problem is here:
‘var cb = function (success, results){’
This is true for JS but the signature in NodeJS is only with ‘results’
Please try the following:
var cb = function (results){
if(results){
console.log(results);
return;
}
handleResults(results);
};
var kc = require(’./KalturaClient’);
var ktypes = require(’./KalturaTypes’);
var partnerId = ;
var secret = ‘’;
var conf = new kc.KalturaConfiguration(partnerId);
conf.serviceUrl = “http://www.kaltura.com/”;
var client = new kc.KalturaClient(conf);
var userId=null;
var type = ktypes.KalturaSessionType.ADMIN;
var expiry = null;
var privileges = null; //console.log(client);
var result = client.session.start(cb, secret, userId, type, partnerId, expiry, privileges);