Pause video controller only if it has not been unmounted
This commit is contained in:
parent
1ac16347bd
commit
f645e00b4e
1 changed files with 3 additions and 2 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue