MyCujoo LiveServices logo
HomeProductsPricingHelp Center
Create your accountSign in
Sign In

Home

Products

Pricing

Help Center

Welcome

Product & Features

Getting started

Glossary

API Documentation

VOD upload guide (API)

In order to create programmatic uploads to the MCLS platform you will need to do the following:

  • Create a stream of type static

  • Create an upload ID using information form the file

  • Upload the file using the TUS protocol. See: https://tus.io/

  • A valid bearer token, please consult the “Getting started with the API” guide if you don’t currently have one.

In this guide we will walk you through the required steps. As a base we will be using the example that can be found here: https://github.com/tus/tus-js-client

Any TUS client that respects the TUS protocol *should* work here. Please read the quick start guide for how to get started with the API here before proceeding.

Creating the stream

First, we have to create a stream of type static. This tells the system that we won’t be receiving a live feed for this stream but we will be uploading a static asset. In this example we will be using cURL to create this stream.

1. Create `static` stream:

curl --location --request POST 'https://mls-api.mycujoo.tv/streaming/v1/streams' \ --header 'Authorization: Bearer <TOKEN>' \ --header 'Content-Type: application/json' \ --data-raw '{ "config_id": "<config_id>", "region": "REGION_EUROPE_WEST", "title": "Test upload steps", "type": "TYPE_STATIC" }'

This will return a Stream object. The full payload description can be found here but for now we are really interested in the Stream ID:

{ "id": "ckp6pfwpc01kl0124d9xxxxx", "title": "test uploaded VOD", "config_id": "cko4wy76800000192q6xxxxx", "type": "TYPE_STATIC", "region": "REGION_EUROPE_WEST", "key": "", ...

Uploading the VOD

We created a jsfiddle which is an example of using the tus-javascript-client.

https://jsfiddle.net/thecodeassassin/8hnLcb43/13/

The most important thing to note is that you should add the following metadata values in your TUS client:

metadata: { filename: file.name, stream_id: xxx }

In the example jsfiddle shown above we get the stream_id value from the textbox. The tus-js-client library takes care of base64 encoding the values and sending the proper requests to our upload server.

Any TUS compatible client should work here, there are many tus libraries available. A full list can be found here: https://tus.io/implementations.html.

Events

If you wish to attach this new VOD to an existing event you can simply do that with the following API call:

curl 'https://mls-api.mycujoo.tv/events/v1/<event id>/stream/<stream id>' \ -X 'POST' \ -H 'authorization: Bearer <TOKEN>'

That API call is described in detail here.