Video Questions: Get contents of video/picture rather than path

Hi guys/gals, I have a couple of questions for anyone that can answer:

  1. I’m trying to upload video files to S3. I’ve got it all working through the rest api except that when I try to send the video file it’s sending the local file path rather than the data. Is there a way for me to send the data, like we do to MediaDB/Cloudinary?

I realize that I can send it to the MediaDB and then to S3, but that seems like a really costly way to get it to S3.

  1. The front video camera on my Android device looks like it’s kind of got a filter on it. Everything is elongated. Anyone else experiencing this?

Everything looks normal on IOS.

  1. Are there any controls to change the recording quality on the video recorder?

  2. Do we have a way to delete recordings from the cache? Or is there some type of size limit? I want to delete them when the upload is finished.

Thanks in advance!

Are you uploading photos to s3 with the api also? I didn’t realize we could send photos this way. If so, could you show what blocks you’re using to accomplish this?

Right now you have to upload to MediaDB and then you can upload that link to S3. I’m using an AWS Lambda script in Python. The script is super simple. Just spool up a new Lambda script and send your url to the lambda event from Thunkable as follows:

Here’s the python script:

import boto3
import json

def lambda_handler(event, context):
        bodyData=event['body']
        if isinstance(bodyData,str):
             bodyData=json.loads(bodyData)

        cloudinaryUrl=bodyData.get('cloudinaryUrl')

        #Upload to S3
        url=cloudinaryUrl # put your url here
        bucket = 'yourBucket' #your s3 bucket
        key = 'yourVideoOrPictureName' #your desired s3 path or filename
        s3.upload_fileobj(http.request('GET', url, preload_content=False), bucket, key)

Make sure your picture or video name (the “key”) has the proper ending ie. .jpg or .mov or whatever file type it is.

Unfortunately setting up your lambda rights to write to S3 can be a little more complicated, though AWS has simplified it recently. There’s lots of documentation out there on that. Plan on spending a day or two getting familiar with AWS systems if you’re not already.

1 Like

Once there’s a way to get the contents of the photo or video file rather than just the path reference I can show you how to go directly to S3 using an pre-signed url from s3 rather than uploading to Cloudinary first.

1 Like

I am waiting for a file api!! Thanks for sharing!!

I have taken similar approaches in the past. Solid work!

1 Like