-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there way to cancel/abort upload request? #126
Comments
Even I am looking for an answer for this! |
Hey I actually managed to solve this problem a while ago, so here's my solution. import axios from 'axios';
import * as tus from 'tus-js-client';
const handleUploadClicked = async () => {
setUploading(true);
const api = 'https://api.vimeo.com/me/videos';
const body = {
name: file.name,
upload: {
approach: 'tus',
size: file.size,
},
};
const headers = {
'Content-Type': 'application/json',
Accept: 'application/vnd.vimeo.*+json;version=3.4',
Authorization: `bearer ${process.env.REACT_APP_VIMEO_ACCESS_TOKEN}`,
};
const response = await axios.post(api, body, { headers });
const uri = response.data.uri;
const endpoint = response.data.upload.upload_link;
const upload = new tus.Upload(file, {
uploadUrl: endpoint,
retryDelays: [0, 1000, 3000, 5000],
onError,
onProgress,
onSuccess: () => onSuccess(uri),
});
upload.start();
upload.pause();
upload.strop();
}; |
Hope it helps :D |
2 days too late. The way I did it was I forked the vimeo.js library and made changes to support pausing and resuming a video. I am planning on cleaning it up and making it open source for everyone who stumbles upon this issue. |
any solution for cancelling an upload ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: