How to catch and handle video processing errors (and unsupported files)?

Hello,

what is the best way to catch and handle video processing errors when uploading (unsupported) files using the JS VideoUploader and a delegated token?

VideoUploader.upload() happily accepts and uploads anything you throw at it. Uploading, for example, a PDF does not generate a catchable error i.e. VideoUploader.upload().catch() is not called.

Playing a broken/unsupported/unprocessed file does throw an error but I’d like to inform users that there’s an issue before they try to play the video i.e. right after their upload completes.

I’m currently polling https://ws.api.video/videos/{videoId}/status and checking for encoding.playable === true.

Is this the correct/best approach? How long should I wait for playable === true before concluding that there was a processing error?

Or should I rather look at ingest.status? If so, what status does a failed video get? missing?

I’m looking for the best way to handle API/processing errors in general (vs. unsupported files only).

Hello Simeon,

Unfortunately at the moment we don’t yet provide a proper way do determine if video encoding has failed through the API. We plan to work on this.

The best way you have at the moment to verify that the encoding has not failed is to call the status API endpoint and to check that the encoding.qualities array is not empty.

The lowest qualities should be encoded pretty fastly so the array shouldn’t remain empty a long time.

We are aware that this is not an optimal solution and we hope to be able to offer something better soon.

Regards,

Olivier

1 Like

Ok, thanks for comprehensive reply.

It would be really handy if .upload() rejects when the file can’t be processed so we can .catch() the error right away.

Hi Simeon

Yes, totally agree. We are aware that this would be a real improvement. Once the required changes on our backend side have been made we’ll update the uploader to integrate such feature.

1 Like