Pause video controller only if it has not been unmounted

This commit is contained in:
Vishnu Mohandas 2020-08-14 05:34:12 +05:30
parent 1ac16347bd
commit f645e00b4e

View file

@ -49,7 +49,6 @@ class _VideoWidgetState extends State<VideoWidget> {
}
});
} else {
showToast("Downloading video...", toastLength: Toast.LENGTH_SHORT);
getFileFromServer(
widget.file,
progressCallback: (count, total) {
@ -102,7 +101,9 @@ class _VideoWidgetState extends State<VideoWidget> {
key: Key(widget.file.tag()),
onVisibilityChanged: (info) {
if (info.visibleFraction < 1) {
_chewieController.pause();
if (mounted) {
_chewieController.pause();
}
}
},
child: Hero(