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.
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' \
"title": "Test upload steps",
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:
"title": "test uploaded VOD",
The most important thing to note is that you should add the following metadata values in your TUS client:
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.
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.