颤抖:无法打开内部下载的视频

问题描述

我想让用户能够在Flutter应用程序中下载视频(从Firebase存储中)

我尝试了缓存,但是我需要让用户一次下载(或缓存)所有视频,而不必观看整个视频。

此外,我尝试使用以下代码下载视频:

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");
}

我将此路径保存在(app_Flutter)中,但无法使视频播放器使用此资产来播放视频!

我试图将此路径作为资产,但是出现了一个错误,尽管我在Android Studio的“设备文件资源管理器”标签中看到了该目录中的文件,却找不到它。

那么下载该视频后我该怎么办?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)