tus-js-client: Resume vimeo video not working
Question Hi all,
I am trying to enable resuming a video on page refresh/connection lost. Right now, when I refresh a page, it restarts from the beginning instead of resuming.
Here is the code snippet:
 this.upload = new Upload(this.videoFile, {
      endpoint: undefined,
      uploadUrl: this.model.video.uploadUrl,
      resume: true,
      retryDelays: [0, threeSeconds, fiveSeconds, tenSeconds, twentySeconds],
      onError: (error: Error): void => {
        this.onError(error.message);
      },
      onProgress: (bytesUploaded: number, bytesTotal: number): void => {
        this.progress = Math.round((bytesUploaded / bytesTotal) * percent);
      },
      onSuccess: (): void => {
        console.log('success');
      }
    });
- The videoFile here is saved in localStorage so that on refresh, we can retrieve it.
- The uploadUrl is always the same. It is saved in the database.
- When I do not provide an uploadUrl, I get a 405 error saying that POST is not an allowed method for https://us-files.tus.vimeo.com/files/…
Please let me know what I am not seeing. Thank you again in advance!
Setup details Please provide following details, if applicable to your situation:
- Runtime environment: Browser, Angular 9
- Used tus-js-client version: 1.8.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (14 by maintainers)
Ran into this issue myself (well, just being unable to have a working pause/resume button without it restarting from 0) and thought I’d share how I fixed it for anyone else who stumbles across this page in future. I had to set the chunkSize variable within my ‘new tus.Upload()’. By default, chunkSize is infinite, and it seems Vimeo’s ‘upload-offset’ response is only for completed chunks, and so there’s no completed chunks until the upload has completed. By setting it to 5000000 (5mb), I’m able to pause and resume the upload successfully. Upon resuming, it restarts at the last completed chunk, so for a small file (e.g. 30mb), there may be a noticeable drop of a few percentage after resuming. This would be less noticeable for a larger file where 5mb accounts for a smaller percentage, or you could set the chunkSize to 1mb, though the smaller the chunkSize, the slower the upload due to the increased number of http requests. Hope this helps someone.
It was necessary for me to set the chunkSize to 1mb in order to get it to work for me uploading to Vimeo. The issue seems to be limited to Chrome. I had success in FireFox and Safari without setting a chunkSize.
Safari Version 14.0.3 (16610.4.3.1.7) - OK FireFox 88.0 - OK Chrome Version 90.0.4430.85 (Official Build) (x86_64) - ERROR (failed) net::ERR_HTTP2_PING_FAILED