I am working on a project where I am using flutter chewie player for playing videos. But when there is no network (or when I turned off the internet), it is showing an error as:
VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null
Instead of this error, I want to show a circular indicator on network loss and want to resume playing when network is restored. How to implement this?
My chewie controller is below:
chewieController = ChewieController(
videoPlayerController: _videoPlayerController,
aspectRatio: 16 / 9,
autoPlay: true,
looping: false,
startAt: Duration(seconds: timeWatched),
errorBuilder: (context, errorMessage) {
return Center(
child: Text(
errorMessage,
style: TextStyle(color: Colors.white),
),
);
},
showControls: true,
allowFullScreen: true,
fullScreenByDefault: false,
customControls: CupertinoControls(
backgroundColor: Colors.black,
iconColor: COLORS['PRIMARY_COLOR'],
));```