@dohsoft wrote:
Hi all,
I'm new to using Kaltura but not to using APIs to achieve things in C# so I was hopeful of being able to get up to speed quite quickly. However I'm hitting an issue when I try and upload a video. I've based my code on these examples:
http://knowledge.kaltura.com/how-start-kaltura-session-using-testme-console
http://knowledge.kaltura.com/uploading-media-using-kaltura-api-consoleWhen I then check the KMC I see an entry but the status of the file is "uploading" and not running time etc. is held against the video.
I've posted below my code, I'm sure I can't be a million miles away from getting it right as I don't get any error messages so any help would be very gratefully received,
=========CODE START===========
KalturaConfiguration config = new KalturaConfiguration(Convert.ToInt16(ConfigurationManager.AppSettings["PARTNER_ID"]));
config.ServiceUrl = ConfigurationManager.AppSettings["SERVICE_URL"];
KalturaClient client = new KalturaClient(config);
String secret = ConfigurationManager.AppSettings["ADMIN_SECRET"];
String userId = null;
KalturaSessionType type = KalturaSessionType.ADMIN;
int partnerId = Convert.ToInt16(ConfigurationManager.AppSettings["PARTNER_ID"]);
int expiry = 86400;
String privileges = null;
Object result = client.SessionService.Start(secret, userId, type, partnerId, expiry, privileges);client.KS = result.ToString(); KalturaUploadToken uploadToken = new KalturaUploadToken(); KalturaUploadToken result2 = client.UploadTokenService.Add(uploadToken); string uploadTokenID = result2.Id; uploadToken.Id = uploadTokenID; FileStream fileData = File.Create(context.Server.MapPath("~") + "//CourseUploadTemp//" + fileName); bool resume = false; bool finalChunk = false; float resumeAt = 0; KalturaUploadToken resultUp = client.UploadTokenService.Upload(uploadTokenID, fileData, resume, finalChunk, resumeAt); string fName = resultUp.FileName; KalturaMediaEntry entry = new KalturaMediaEntry(); entry.MediaType = KalturaMediaType.VIDEO; KalturaMediaEntry resultFE = client.MediaService.Add(entry); string entryID = resultFE.Id; KalturaUploadedFileTokenResource resource = new KalturaUploadedFileTokenResource(); resource.Token = uploadTokenID; Object resultTR = client.MediaService.AddContent(entryID, resource);
=========CODE ENDED============
Many thanks,
Steve
Posts: 12
Participants: 2