Hi, I am trying to upload video file to kaltura. It is showing error when addContent to media.
{“code”:“ENTRY_ID_NOT_FOUND”,“message”:“Entry id “0_ebc0v06k” not found”,“objectType”:“KalturaAPIException”,“args”:{“ENTRY_ID”:“0_ebc0v06k”}}
But I can certainly see mediaEntry is created before addContent call.
Any ideas?
exports.uploadMedia = function(videoFile,userId) {
var fs = require("fs");
var DOWNLOAD_DIR = './downloads/';
var fileWithPath=DOWNLOAD_DIR+videoFile;
fs.exists(fileWithPath, function(exists) {
if (exists) {
fs.readFile(fileWithPath, "utf8", function(error, data) {
var uploadToken = null;
KalturaClient.uploadToken.add(function(token){
console.log("upload token added " + JSON.stringify(token));
KalturaClient.uploadToken.upload(function(token){
console.log("upload token uploaded " + JSON.stringify(token));
var entry = new Kaltura.objects.KalturaMediaEntry();
entry.name = "My Video";
entry.description = "My video";
entry.userId = userId;
entry.creatorId = userId;
entry.type = KalturaConstants.KalturaEntryType.AUTOMATIC;
entry.mediaType = KalturaConstants.KalturaMediaType.VIDEO;
entry.sourceType = KalturaConstants.KalturaSourceType.FILE;
KalturaClient.media.add(function(result){
console.log("media entry added " + JSON.stringify(result));
var resource = new Kaltura.objects.KalturaUploadedFileTokenResource();
resource.token = token.id;
KalturaClient.media.addContent(function(result2){
console.log("media entry updated with content " + JSON.stringify(result2));
}, result.id, resource);
},entry);
},token.id,fileWithPath);
}, uploadToken);
});
}
});
}