Open fiixed opened 4 years ago
I tried putting a SetState before I pop and it improved it a little but I can break it soon enough by going between screens quickly.
onPressed: () {
setState(() {
_videoPlayerController.dispose();
_videoPlayerController = null;
_chewieController.dispose();
_chewieController = null;
});
Navigator.of(context).pop();
},
I solved this issue by using the VisibilityDetector to pause the player when it's not on the screen.
` VisibilityDetector(
key: Key('someUniqueString'),
onVisibilityChanged: (VisibilityInfo info) {
if (info.visibleFraction == 0 && mounted) {
//checks if the player is visible and it hasn't been disposed as yet(mounted) and
//pause the chewie player, you could dispose here too');
_chewieController.pause();
}
},
child:Chewie(
controller: _chewieController,
),
);
`
Hi,
when I pop off the videoplayer screen, it seems neither the videoplayer controller or the chewie controller are being disposed (I can still hear the video playing from the new screen).
Here is my code: