Can you stream videos from s3 in Flutter?

Viewed 1266

So I am trying to figure out if I can use Flutter to stream a video directly from S3.

Currently what I have working is to send a get request to an EC2 machine with a Flask server. This retrieves the S3 link from a database, which holds a base64 encoded string that is the video.

The string retrieved by the server, and sent to the flutter app, where it then has to be decoded, and turned into video.

This technique works fine for small pictures and audio, but for longer video, it's painful.

Is there another way to do this?

1 Answers

S3 has an accelerated endpoint that makes the streaming of videos so much faster! I just use some Regex to replace the part of the url pointing to the endpoint

String heroUrl =
    https://strapi-zzzz.s3.ap-southeast-2.amazonaws.com/my_Audio_05eb4c9073.mp4;
var newHeroUrl = heroUrl.replaceAll(
    RegExp('s3.ap-southeast-2.amazonaws.com'),
    's3-accelerate.amazonaws.com');
Related