Flutter how to stop playing video on background state?

Viewed 1275

I'm developing app with video player using video_player 0.10.11+1 package.

while video player is playing i put my app in background. On AppLifecycleState.paused or AppLifecycleState.inactive state after some time it was started playing in background.i was not getting how it started playing on background.so i have tried with didChangeAppLifecycleState method on AppLifecycleState.paused i made video controller pause. still after that also same it was happening.

This issue was happens in Redmi & OnePlus mobiles

Case,

step 1 : while video player is playing i put my app background.

step 2 : then i opened whatsapp,facebook other apps in my phone.

step 3 : after some time video player of my app which is in background mode started playing without opening it.

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
    super.didChangeAppLifecycleState(state);
    if (state == AppLifecycleState.paused) {
      print("Video Player AppLifecycleState Paused");
      if (_controller != null) {
       _controller.pause().then((_) {});
      }
    }
}

so,help me out to slove this issue.

Thanks in advance.

0 Answers
Related