you can use flutter_cache_manager
or use cached_video_player
A flutter plugin that has been forked from the official video_player package except that it supports caching.
CachedVideoPlayerController controller;
@override
void initState() {
controller = CachedVideoPlayerController.network(
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4");
controller.initialize().then((_) {
setState(() {});
controller.play();
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: controller.value != null && controller.value.initialized
? AspectRatio(
child: CachedVideoPlayer(controller),
aspectRatio: controller.value.aspectRatio,
)
: Center(
child: CircularProgressIndicator(),
)),
);
}
}