How to download video from online(api response) and store it in local device and play that video using video player in flutter app. Eg : Amazon Prime, Youtube, Netflix...
Asked
Active
Viewed 174 times
-2
-
you can play video from api with this package https://pub.dev/packages/youtube_player_flutter – Abhijith Aug 28 '21 at 13:54
-
to save data locally refer this https://pusher.com/tutorials/local-data-flutter/ – Abhijith Aug 28 '21 at 13:54
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Sep 01 '21 at 00:31
1 Answers
1
On an outline to give you an idea, you would need to consider
- Download video, use dio to download your video files to your local path.
ex.
try {
var dir = await getApplicationDocumentsDirectory();
await dio.download(url, "${dir.path}/myFile.mp4", onProgress: (rec, total) {
print("Rec: $rec , Total: $total");
});
} catch (e) {
We could use path_provider to get the applicationDocumentDirectory to save the files to local dir.

epynic
- 1,124
- 2
- 14
- 26