I am using the package just_audio and audio_service in my Flutter app. To simplify: I have 5 buttons; each one has an audio file associated with it. When a button is pressed the corresponding audio starts and a popup opens. If the user closes the popup the audio stops.
When this line of code is executed:
audioManager.stop();
In the notification bar, the player remains and from there the user can play again.
I do not want the user to be able to do this.
The moment the user closes the popup, he must stop listening to music. He can only listen to it again after clicking on one of the 5 buttons.
How can I do this? Thank you