Upload to Vimeo

Hi, I’m new to tus and I’m using tus-js-client. I’m following the example in this link tus-js-client/usage.md at master · tus/tus-js-client · GitHub.

I was able to successfully upload a video on Vimeo but I would like to set the title and description in advance. And also the optional onSuccess function is not returning anything. I would like to get the video details that I’ve uploaded successfully like the clipid.

Are these things something possible to do on tus-js-client? Below is my code for reference.

function UploadVideoTusJs(uploadUrl, videoFile) {
    var upload = new tus.Upload(videoFile.files[0], {
        uploadUrl: uploadUrl,
        metadata: {
            name: videoFile.files[0].name, // not working
            description: "Test", // not working
        },
        onError: function (error) {
            console.log("Failed because: " + error);
        },
        onProgress: function (bytesUploaded, bytesTotal) {
            var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2)
            console.log(bytesUploaded, bytesTotal, percentage + "%")
        },
        onSuccess: function (data) {
            console.log(data); //returns undefined
            console.log("Download %s from %s", upload.file.name, upload.url);
        },
        onAfterResponse: function (req, res) {
            var url = req.getURL()
            var value = res.getHeader("X-My-Header")
            console.log(`Request for ${url} responded with ${value}`)
        }
    });

    // Start the upload by default
    upload.start();
}

Thanks for your help,
Dan

Hi Dan,

setting the video title and obtaining details about the video can be done using the Vimeo API. tus-js-client is not a Vimeo API client and is only concerned about uploading files. Therefore, tus-js-client does not have any special options to set the video title and does not return any Vimeo API-specific information in the onSuccess callback. These things should be done with the Vimeo API. I haven’t used it for myself, so I cannot point you in any direction directly but please look at their documentation or contact their support for more help.

Hi Marius,

I see. Thanks for confirming. Appreciate it.

I want to get response body after upload. Nothing to do with vimeo api.
How to get response body after upload?

You can use the onAfterResponse option to add a callback which is invoked for every completed request. The arguments to this call includes the request object where you can access the body.