Get remote provider video duration

Hi everyone!
We have set a restriction for some users according to video duration. This is easy to check when the video is uploaded from the device and on file-added we check it, show a notification and remove the file.

However, we can’t seem to find the proper way of doing the same thing for videos coming from providers. Google Drive has the info in a custom parameter but Dropbox, for instance, doesn’t. Has anyone come across this and found a solution? My last resource would be waiting for the upload-success event and then blocking the user from using the file but this is a waste of time and not very UX friendly.

Any ideas?
Thanks for your time

Hi, video duration is not a restriction we have. Max file size is and that should also prevent people from selecting files from Google Drive that are too big.

Hi! Thanks for the fast response.

I understand that this is not something available out of the box. We’ve implemented it ourselves for device uploads. My question is if someone has done it for provider uploads or if someone knows a reliable way of doing it without having uploaded the file already.

The only way without any changes to Uppy/Companion is indeed waiting for upload-success, which is unfortunate and inefficient but I’m not sure there is another way.

You could fork Companion and try to adjust the response send to Uppy with a video duration:

As this only relates to videos and users can upload any file from a drive, I’m not sure if we want to add it to Companion.

Note that if you were to use Transloadit, you could filter files with your custom scripts and reject them there with error_on_decline and show it in Uppy with waitForEncoding

Thank you for that info, @Merlijn!

I saw that Drive already sends that information. However, the other providers don’t.
So we’ll evaluate the options and choose one.

Thanks again for your help