Video uploading with Kaltura javascript API

Hello,

I am using Kaltura SaaS platform and building some tools that use the Kaltura API. I want to have an ajax uploader that that will upload directly to my Kaltura account.

My main question is about the javascript API code. The version I see in the KalturaClient.js is “3.1.6”, which I downloaded just over a month ago. Also, the actual code I am using is similar to what gets generated by the TestMe console:

    var config = new KalturaConfiguration(partnerId);     config.serviceUrl = "http://www.kaltura.com/";     var client = new KalturaClient(config);     client.ks = "THE_GENERATED_KS_FROM_SERVER";     var uploadTokenId = "0_some_token_generated_by_uploadToken_add";     var fileData = "test.MOV";     var resume = null;     var finalChunk = null;     var resumeAt = null;     var result = client.uploadToken.upload(cb, uploadTokenId, fileData, resume, finalChunk, resumeAt);

However, when I am using the above code, I am getting a “MISSING_MANDATORY_PARAMETER” error about missing the “fileData” parameter. Upon inspection of the doHttpRequest method in KalturaClientBase.js, it doesn’t look like the files variable is even being used or passed to OX.AJAST.call().

I was able to get around this by hacking together my own CORS code that uses XmlHttpRequest2 and sends the fileData in a FormData (a la HTML5Rocks XHR2 tutorial), but I am wondering if I missed something that already does this. Although my code does upload the video and create/associate the media entry correctly, I certainly don’t want to reinvent the wheel. :slight_smile: So finally, my question is… Is this the right way to do it? (and am I using an API that is not deprecated? I saw a lot of deprecated APIs while reading documentation.)