简体   繁体   中英

Can you stream videos from s3 in Flutter?

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?

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');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM