flutter_sound icon indicating copy to clipboard operation
flutter_sound copied to clipboard

[HELP]: Is there a way to play sound without stopping background music like Spotify?

Open OrKahila opened this issue 4 years ago • 4 comments

Perhaps it is not the good place to request for help, here ?

Perhaps you could consider using one of the sharing channels ?

For example the Element τ room ?


I need Help for : Hey, I'm trying to play a short audio for a button click on my app, the problem is that when the user presses the button the background music just disappears. the ideal scenario would be that when playing button sound it will lower the background music volume and when completed get back to normal volume. any help on that please?

  • Using the API ?

  • Generate an iOS or Android App ? both iOS and Android

  • Debugging my App ?

  • Other ?


Here is my question :

OrKahila avatar Feb 26 '21 08:02 OrKahila

When you open your audio session, specify

focus: AudioFocus.requestFocusAndDuckOthers

Larpoux avatar Feb 26 '21 08:02 Larpoux

have a look, here is the solution: https://youtu.be/tFYfVimZdHs

BenEppers avatar Jul 25 '24 12:07 BenEppers

Thank you @BenEppers for the link. This seems very interesting. Do not hesitate to do a Pull Request, I will be very glad to look to it very carefully.

Larpoux avatar Jul 25 '24 15:07 Larpoux

Btw: by the past, Flutter Sound tried to manage itself the audio session. But we stopped doing that, because some Flutter Sound users complained that Flutter Sound was incompatible with other Sounds plugins.

Flutter Sound users must manage their audio sessions with another plugin like Audio Session. This plugin federates in one central point the sessions used by all the other plugins. You should look to this plugin. It has many useful parameters. And if this solves your issue, don’t forget to post something here, so that others Flutter Sound users will know how to do it.

Larpoux avatar Jul 25 '24 15:07 Larpoux