Javascript function KalturaUploadService.upload() not found!

Hey All,

Very new to using Kaltura, I’m following the Console API/Tutorial and I stuck when attempting to call the function KalturaUploadService.upload(). The Chrome browser/debugger is telling me "xxx.upload is not a function. When I look at the source code there is only one method on that object, it’s named ‘getUploadedFileTokenByFileName’.

All suggestions are appreciated,
F
PS: this is where the library code came from: http://cdnbakmi.kaltura.com/content/clientlibs/ajax_22-03-2017.tar.gz

Hi @garberfc,

Please follow the code samples here:
https://developer.kaltura.com/workflows/Ingest_and_Upload_Media;step=1
If something doesn’t work, please provide a full code sample and I’ll take a look.

Hi Jess,

Thanks for ALL you help!

In my code I already have the uploadTokenId. Here’s the code I’m attempting to execute:
var fileData = {};
var resume = true;
var finalChunk = true;
var resumeAt = 0;

	      KalturaUploadTokenService.upload(uploadTokenId, fileData, resume, finalChunk, resumeAt)
	        .execute(client, function(success, results) {
	          if (!success || (results && results.code && results.message)) {
	            console.log('Kaltura Error', success, results);
	          } else {
	            console.log('Kaltura Result', results);
	          }
	        });

The problem is that there isn’t a function named ‘upload’ on the KalturaUploadTokenService variable. I downloaded the source/library code from here: http://cdnbakmi.kaltura.com/content/clientlibs/ajax_22-03-2017.tar.gz. If you download the source and expand it you’ll find that the file KalturaUploadTokenService.js file doesn’t have the ‘upload’ function defined.

Hi Jess,

I replied to the thread and not your post. I’m composing this reply so that you’ll be notified…

Thanks,
F

Hi @garberfc,

You are correct. The upload function is indeed missing here:

I’ll look into it and get back to you.

Thanks,

Hi @jess,

Did you have any luck getting information on the missing upload() function?

Thanks in advance,
F

Hi @garberfc,

I’m afraid this was never implemented in the JS/AJAX client.
We put it on our TODO list but there’s no ETA at the moment.
In the meantime, if you’re most comfortable with JS, you may want to consider using the NodeJS client for this, where this functionality is implemented.
You can obtain the client from here:
http://cdnbakmi.kaltura.com/content/clientlibs/node_22-03-2017.tar.gz

And you can see a step by step code example here:
https://developer.kaltura.com/workflows/Ingest_and_Upload_Media;step=1
Choose NodeJS in the language selectbox.

Alternatively, this may suit your needs:

Hi @jess,

We’re pursuing the use of the library you recommended. Is the code CDN deployed anywhere?

Thanks,
F

Hi @garberfc,

No, this is meant to be hosted on your servers.
As the repo notes, this is based on github.com/blueimp/jQuery-File-Upload, for which you can see a demo here:
https://blueimp.github.io/jQuery-File-Upload/

Hi @garberfc,

The upload action was implemented.
See: https://github.com/kaltura/KalturaGeneratedAPIClientsAJAX/blob/12.17.0/KalturaUploadTokenService.js#L74
To test it, please obtain: https://github.com/kaltura/KalturaGeneratedAPIClientsAJAX/archive/12.17.0.zip

The online Kaltura API Console at Upload_token.upload is a little vague. For instance,

  • What is expected in the fileData object?
  • Is the user of the API supposed to open the file with a browser supported file reader and repeatedly call the upload method with chunks?

Thanks for all your help,
F

Hi @garberfc ,

The chunked upload library does the upload flow for you; https://github.com/kaltura/chunked-file-upload-jquery .
It will get the file from the user browse dialog, then chunk the file and upload it in chunks until the file completes upload to Kaltura. Then your app will need to call the Kaltura media.addContent API to connect the uploaded file to your desired KalturaMediaEntry object.
You can see a reference implementation here; https://github.com/kaltura/chunked-file-upload-jquery/blob/master/index.php