Skip to main content

Using custom domain for delivery

Get TUS' Parameters for Direct Upload

Tus Client is available for JavaScript, React Native, Flutter, PHP, .NET, and many other platforms. View the full list here.

Use this method to get TUS' session parameters: the hostname of the server to upload to, and a secure token.

The general sequence of actions for a direct upload of a video is as follows:

  1. Create a video entity via the POST method.
  2. Get TUS' session parameters (you are here now): https://api.teyuto.tv/v2/videos/{idVideo}/signed/upload
    API Documentation
  3. Upload the file via the TUS client. Choose your implementation from the list of available clients.

The final endpoint for uploading is constructed using the following template: https://{hostname}/upload/. You also need to provide the token, client_id, and video_id as metadata.

A short JavaScript example is shown below, based on tus-js-client. The variable data below is the result of this API request.

Please note that we support only version 2.x of tus-js-client.

<script src="https://cdn.jsdelivr.net/npm/tus-js-client@latest/dist/tus.min.js"></script>
uploads[data.video.id] = new tus.Upload(file, {
endpoint: `https://${data.hostname}/upload/`,
autoRetry: true, // optional
retryDelays: [0, 3000, 5000, 10000, 20000], // optional
chunkSize: 10000000, // mandatory if uploading files greater than 10 GB
metadata: {
filename: data.video_name,
token: data.token,
video_id: data.video_id,
client_id: data.client_id
},
onSuccess: function() {
// Handle success
}
});
uploads[data.video.id].start();