Can I upload a video's data directly or do I have to provide it's path in order for the upload request to work?

Hello,

I’m currently trying to implement video playback with Video API in my website and I was wondering if when I want to upload a video, do I have to give the path to the video or can I directly send the video’s buffer or something similar? I’m currently sending a video from my frontend to my backend, so I don’t actually have the video saved when I make the request

Hi Michael,

You can upload from the buffer. Check out record.a.video - where the video is saved by the browser into a buffer and uploaded from the buffer to api.video.

Uploading to your server, and then to api.video works - but you suffer latency due to the double upload. You can use a delegated token, and have your users just upload from the website. delegated token docs

Hi Doug,

Thanks for the response. I was wondering, is the source code available somewhere? I’ve tried replacing the file option of the upload request with my buffer and a FormData created with that buffer, but I can’t seem to get it working. I’m probably missing something but I can’t seem to figure out what it is

Yes the source code for record.a.video is available here:

Hi @michael.fabrie

at a.video, there are two examples to look at:

Here is the description page for upload.a.video: with links to the blog post, and the Github repo:

I do a similar thing in record.a.video, so here is the description page (again with links to blog and Github:

Hi everyone,

Thanks for all the replies, I found out what was wrong with my request. In the options, the ‘Content-Type’: ‘multipart/form-data’ transformed my FormData into a request payload, which I only saw in the network tab after losing my mind for 2 days trying to find what caused the problem. Thanks for all the help!

It sounds like you’re using python. If you’re doing a big upload in python, yes that header is a pain! We have a couple of write ups about it but if you’ve already figured it out, that’s great to hear.

I’ll leave this for reference in case it’s useful:

1 Like