Firebase 颤振:无法打开我内部下载的视频
我想让用户能够在Flatter应用程序中下载视频(从firebase存储) 我尝试了缓存,但我需要让用户一次下载(或缓存)所有视频,而不看整个视频 此外,我尝试使用以下代码下载视频:Firebase 颤振:无法打开我内部下载的视频,firebase,flutter,dart,video,Firebase,Flutter,Dart,Video,我想让用户能够在Flatter应用程序中下载视频(从firebase存储) 我尝试了缓存,但我需要让用户一次下载(或缓存)所有视频,而不看整个视频 此外,我尝试使用以下代码下载视频: Future<void> downloadFile() async { Dio dio = Dio(); try { var dir = await getApplicationDocumentsDirectory(); print("path ${dir.path}");
Future<void> downloadFile() async {
Dio dio = Dio();
try {
var dir = await getApplicationDocumentsDirectory();
print("path ${dir.path}");
await dio.download(imgUrl, "${dir.path}/demo.mp4",
onReceiveProgress: (rec, total) {
print("Rec: $rec , Total: $total");
setState(() {
downloading = true;
progressString = ((rec / total) * 100).toStringAsFixed(0) + "%";
});
});
} catch (e) {
print(e);
}
setState(() {
downloading = false;
progressString = "Completed";
});
print("Download completed");
}
Future downloadFile()异步{
Dio Dio=Dio();
试一试{
var dir=等待getApplicationDocumentsDirectory();
打印(“路径${dir.path}”);
等待dio.download(imgUrl,“${dir.path}/demo.mp4”,
收到进度:(记录,总计){
打印(“记录:$Rec,总计:$Total”);
设置状态(){
下载=真;
progressString=(记录/总计)*100.ToStringsFixed(0)+“%”;
});
});
}捕获(e){
印刷品(e);
}
设置状态(){
下载=假;
progressString=“已完成”;
});
打印(“下载完成”);
}
我在里面保存了这个路径(app_flatter),但是我无法让它让视频播放器使用这个资源播放视频
我试图将此路径作为资源,但出现错误,无法找到,尽管我在Android Studio的设备文件资源管理器选项卡中看到了此目录中的文件
那么,在下载视频后,我可以做些什么来播放它呢