I have media uploading working from the web, and can upload images as Base64 encoded strings from the API I wrote, but am trying to figure out how to encode videos to upload them from an API. As an example, here is how I upload photos:
{
"story": {
"title": "Some story",
"cover_image":"data:image/jpeg;base64,/9j/4gv4SUN...TEfyT/Pry+f/Z"
}
}
But what is the best practice for uploading videos though a JSON API? I've read a lot of different suggestions, and an equal number of people saying not to do each of the suggestions, but there doesn't seem to be a common best practice for what's clearly a common thing to do.
After some research and talking to other developers, and looking at libraries like Alamofire for iOS, I've decided using multipart form uploading of video AND images is the best approach to take. So I'm going to change things a bit so my API will no longer accept Base64 encoded strings.