API to upload video without using KMC?

Upload Token is just an “handle” that enables you to upload the content in chunks.
You get a new one from the server using the add method, and then each upload action is returning a new token.

1 Like

Thanks Ofer,

Is there a sample of real code handling uploading to refer to? :smile:

BTW, for “each upload action”, for each upload action, do you mean an action to upload a chunk of a part of a file, or the action of upload the whole file?

regards,
Lin

BTW, Ofer, if you could help to comment on this question, it will be great. :smile:

regards,
Lin

Very high level, upload of a file: (in C# syntax)

                tok = kaltura.getClient().UploadTokenService.Add(tok);
                Loop
                         tok = kaltura.getClient().UploadTokenService.Upload(tok.Id, fileToLoad,.....)
                End Loop

               kaltura.getClient().MediaService.AddFromUploadedFile(mediaEntry, tok.Id);

Thanks Ofer,

Two quick questions,

  1. In your sample, you are using one token to upload multiple files?
  2. Will backend transcoding service automatically be invoked?

regards,
Lin

See: http://knowledge.kaltura.com/node/1280 and http://knowledge.kaltura.com/node/468 .
KMC uses the same API you’ll use, so you can also just use a network monitor to see the API calls it makes.

Generally speaking, upload follows these steps:

  1. Create a session ( http://knowledge.kaltura.com/node/461 )
  2. Create an upload token (uploadToken.add)
  3. Upload a file (uploadToken.upload)
  4. Create an Entry (entry.add)
  5. Associate the uploadToken with the Entry (entry.setContent)

When you’ll associate the entry with the uploaded file, that’s when the batch process in Kaltura will kick in automatically.

You may also want to check out this project if you’re looking for uploading via JS UI:

Or this project if you’re looking to submit a bulk upload (ingesting many files at once from accessible server):

Cheers

Fantastic, thanks ZoharBabin! Have a great weekend.

regards,
Lin

Hi ZoharBabin,

Report an issue, it seems the images in the guide below cannot be displayed – I tried multiple browsers and computers. It is hard for me to follow without an image. :smile:

It will be great if anyone could fix.

http://knowledge.kaltura.com/uploading-media-using-kaltura-api-console

Hello Lin, here at Panda O.S. we’ve developed an application layer on top of the Kaltura API. It’s called Bamboo.
You can check it out here http://demo.bamboo-video.com
To upload a video go to the Media Management section “http://demo.dev.bamboo-video.com/my-media

Hello Lin,
The images in that document do load for me.
Can you run a sniffer and report exactly what resources fail to load?

Works for me too. Should be something on your side.

Works for me now, thanks Jess and Ofer.

regards,
Lin

Hi ZoharBabin, Jess and Ofer,

After reading the 5 steps below, a bit lost why we need a concept of token here. We have uploaded file (entry) and session to upload, and wondering what is the logical meaning of token here? Does token mean/represent credential of the user who is uploading?

Create a session ( http://knowledge.kaltura.com/node/461 )
Create an upload token (uploadToken.add)
Upload a file (uploadToken.upload)
Create an Entry (entry.add)
Associate the uploadToken with the Entry (entry.setContent)

regards,
Lin

Hi lelikg1,

Panda OS sounds cool, wondering what is the relationship between Panda OS and Kaltura? Is Panda OS just an UI layer, and bound to Kaltura only? Thanks.

regards,
Lin

Hey Lin,
We are a software development company and a Kaltura integrator.
We also have our own application layer and products.
Our Bamboo product is a UI layer + API layer on top of Kaltura API but can also be used for purposes other than Kaltura, such as dynamic websites, or connect with other Video platforms.
Our API simplifies many of the common tasks while working with the Kaltura API. You can connect Bamboo API and web/application to any Kaltura service (SaaS or On-Prem)

Thanks lelikg1 for the details, for “other Video platforms” any more details what do you mean? My confusion is, for Youtube, I can manage my own channel on Youtube, and why need Bamboo platform? If you mean something else, please feel free to correct me. Have a good weekend.

regards,
Lin

Hello everybody!

I’m also having a problem with the upload implementation (but i’m working in javascript).
The steps provided by ZoharBabin work fine as long as I’m using the API Test Console, but when I try to do the same in js I have problem with the upload token creation. Namely, the result the function returns is undefined.
I copied and pasted the code directly from the Test Console where everything runs smoothly, so I have no idea what the problem is. Can somebody help me out?

Thanks in advance.
Best

Take a look at:
http://kaltura.github.io/jQuery-File-Upload/

Thank you Jess.

I checked the github page, but looks like there are some open issues (as reported by zoharbabin). Do you/does somebody know if it’s working or it’s still under development?
Also, does it mean that it’s not possible to implement the upload by js only? Are there other API calls that wouldn’t work with js only and need external scripts to work properly?

Thanks again.
Best

Hello @reckoner,

The README in the repo has this simple example which should work for you:

<script src="/js/vendor/jquery.ui.widget.js"></script>
<script src="/js/jquery.fileupload.js"></script>
<script src="/js/jquery.fileupload-kaltura.js"></script>
<script type="text/javascript">
  var setupUpload = function() {
    file = $('input[name="fileData"]').fileupload({
      apiURL:'http://www.kaltura.com/api_v3/',
      url: 'http://www.kaltura.com/api_v3/?service=uploadToken&action=upload&format=1',
      ks: client.ks,
      singleFileUploads:true,
      dataType: 'json',
      autoUpload: true,
      done: function(e, data) {
        console.log('fileupload done', e, data);
      },
    });
  };
  $(document).ready(setupUpload);
</script>
<label>Video to Upload</label>
<input type="file" name="fileData">

Let me know if you’re having issues.

The demo as presented in http://kaltura.github.io/jQuery-File-Upload/ is functional. I myself am able to upload using it.