Upload Video to Vimeo using tus, in Ionic 3

820 views Asked by At

I am trying to upload a video file to vimeo using tus (as explained in link Video Uploads on Vimeo developers API

I am able to create a video file by adding authorization, accept and content-type field in header and also recommended body body. (as mentioned in link). e.g.

const header = {
      headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/vnd.vimeo.*+json;version=3.4',
        'Authorization': 'bearer ' + this.token
      }
    };

Body:

 const body = {
      "upload" : {
        "approach" : "tus",
        "size" : videoObj.size
      },
      "name" : videoObj.name
    };

Now I want to upload video file. I am using a simple method to open a video file. In the link, one line is making me confuse "PATCH the binary data of the video file to the URL from upload.upload_link, along with some custom tus headers:" . What does it mean?

upload.upload_link is what i get from a response while creating video object. Now I am trying to build a header and body object as shown.

 const header = {
      headers: {
        'Content-Type': 'application/offset+octet-stream',
        'Upload-Offset': 0,
        'Tus-Resumable': '1.0.0'
      }
    };

Now where to put upload.upload_link and make an api call again?

1

There are 1 answers

2
Tommy Penner On

upload.upload_link is the uri you want to make that PATCH request to. Be aware that the upload_link will have a different path than the API uris (api.vimeo.com), usually along the lines of upload.tus.vimeo.com.