flutter_sound icon indicating copy to clipboard operation
flutter_sound copied to clipboard

[HELP]: Stop Audio when app goes to Background

Open Mateis opened this issue 4 years ago • 3 comments

Is there a way to stop audio playing when the user leaves the app?

A clue how to achieve it is that i read in this issue that Android API as a parameter that can be set: https://github.com/Canardoux/tau/issues/341

Mateis avatar Feb 25 '21 14:02 Mateis

I also see mentions about background audio playback here https://github.com/Canardoux/tau/issues/525 and here https://github.com/Canardoux/tau/issues/600 yet I cant find how to turn it off

Mateis avatar Feb 25 '21 14:02 Mateis

You could use the WidgetsBindingObserver mixin and override the didChangeAppLifecycleState method and check if the app has switched to the background, and pause/stop playback when desired.

mhstoller avatar May 24 '21 20:05 mhstoller

This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.

github-actions[bot] avatar Dec 19 '23 01:12 github-actions[bot]