-
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 it possible to track the % of the video transcoded #104
Comments
@poussy Sorry, it's not yet possible to track a video's transcode progress. |
Workaround (automatic upload from backend)For an automatic upload from the backend (eg. when a user visits a page, without uploading a video of their own), what we do is recursively call the import { Vimeo } from '@vimeo/vimeo';
const client = new Vimeo(
config.VIMEO_CLIENT_ID,
config.VIMEO_CLIENT_SECRET,
config.VIMEO_ACCESS_TOKEN,
);
/**
* Continually request a Vimeo uploaded video URI,
* pausing for 3 seconds between each request
* (transcoding can take a while and we don't want
* to send too many API requests if we can avoid
* it) until the files array contains greater
* than 0 elements
*/
async function getFilesByUriRecursive(uri: string): Promise<
(
| {
quality: 'sd';
rendition: '240p' | '360p';
type: 'video/mp4';
width: number;
height: number;
link: string;
created_time: string;
fps: number;
size: number;
md5: string;
public_name: '240p' | '360p';
}
| {
quality: 'hd';
rendition: '720p' | '1080p';
type: 'video/mp4';
width: number;
height: number;
link: string;
created_time: string;
fps: number;
size: number;
md5: string;
public_name: '720p' | '1080p';
}
| {
quality: 'hls';
rendition: 'adaptive';
type: 'video/mp4';
width: number;
height: number;
link: string;
created_time: string;
fps: number;
size: number;
md5: string;
public_name: '240p';
}
)[]
> {
const response = await client.request(uri);
if (!('files' in response.body)) {
throw new Error('No files in response');
}
if (response.body.files.length < 1) {
await new Promise((resolve) => { setTimeout(resolve, 3000); });
return getFilesByUriRecursive(uri);
}
return response.body.files;
} Example usage: let uri: string;
try {
uri = await client.upload(
filePath,
{ name: 'example-video-name', folder_uri: '/folders/<folder_id>' },
// Progress callback doesn't track transcoding progress, which takes most time
() => {},
);
} catch (error) {
return {
errors: [{ message: (error as Error).message }],
};
}
const files = await getFilesByUriRecursive(uri); |
Workaround (active upload from user)For a user upload from the frontend over our backend (eg. a user uploads a video of their own to our backend, and then our backend uploads to Vimeo), what we do is:
|
After uploading , the video is being transcoded , can we track the % .
How can we create the progress circle while transcoding seen at vimeo official website after upload?
The text was updated successfully, but these errors were encountered: