简体   繁体   English

你能从 Flutter 中的 s3 中获得 stream 视频吗?

[英]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.所以我想弄清楚我是否可以使用 Flutter 到 stream 直接来自 S3 的视频。

Currently what I have working is to send a get request to an EC2 machine with a Flask server.目前我的工作是将获取请求发送到具有 Flask 服务器的 EC2 机器。 This retrieves the S3 link from a database, which holds a base64 encoded string that is the video.这将从数据库中检索 S3 链接,该数据库包含一个 base64 编码字符串,即视频。

The string retrieved by the server, and sent to the flutter app, where it then has to be decoded, and turned into video.服务器检索到的字符串,并发送到 flutter 应用程序,然后必须在该应用程序中对其进行解码并转换为视频。

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! S3 有一个加速端点,可以让视频流更快! I just use some Regex to replace the part of the url pointing to the endpoint我只是使用一些正则表达式来替换 url 指向端点的部分

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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