Why are video file uploads problematic with gql API?

Why are video file uploads problematic with gql API?

lucianmanescu
Tourist
5 1 1

I am using the gql api to handle images and videos in one of shops and while handling images work like a charm (create/update/name update/orig src update/etc.) videos are a nightmare to work with.

 

In short, I am using the stagedUploadsCreate and the the file(Create|Update|Delete) mutations to upload videos and to create files out of the uploaded content.

 

Encountered problems:

0. 2-3 seconds response time is not what I was expecting when uploading 2-5MB videos but we can learn to live with it.

 

1. Creating a video file with a custom name is not possible due to a bug most probably.

Whenever I use the filename attribute in the fileCreate mutation (to custom name my videos as I do with my images) I always get an error saying "Provided filename extension must match original source."  It does not really matter if the filename matches exactly the one used in stagedUploadsCreate or if only the extension does, it still does not work. So the only way to have the desired File name in Shopify is to make sure it is properly set up during the staging phase.

 

2. Changing just the name of the file (a trivial action already implemented for images) it's just impossible as the API does not support it. There is no documentation regarding this or if it is is well hidden cause I couldn't find it.

 

3. Changing just the video content it's not supported. This is already working for images when using originalSource and it's a life saver.

If I want to update a video do I really need to upload a video + create a new file + update all references + delete the old video file? Really?

 

Making the videos work similarly to images would be a super improvement, at least from my point of view. Can it be done?

 

Reply 1 (1)

Ken_weaverse
Shopify Partner
1 0 0

For video upload, try removing filename from fileInput variable