Implement sound without stoping background music

1,030 views
Skip to first unread message

Marc Andrew

unread,
Feb 3, 2020, 9:45:51 AM2/3/20
to Flutter Development (flutter-dev)
Hi all,

my App needs to play a "beep" sound on certain actions. I'm using audioplayers to play the local audio file.
Everything is working fine, however I've noticed it will stop the background music once the sound is playing.
For instance if I have a music running from Spotify it will stop the music.
Ideally it should lower the the volume for the Spotify music during the "beep" sound and increase it again after the sound has stopped.
I've looked into audioplayers documentation, but can't find the options for this.
Does anyone know how to achieve this? Or does anyone have another package recommendation?


Kind regards,
Marc

Larpoux

unread,
Feb 3, 2020, 12:15:57 PM2/3/20
to Flutter Development (flutter-dev), Marc Andrew
Hi Marc,

I really need this feature for my own app.
I am actually using https://github.com/dooboolab/flutter_sound and I am happy with it. Except with this feature missing.


My plan is to look to this problem soon and implement this feature if it is possible in flutter_sound.
I will take you inform.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/446714fc-d5d0-44a9-b24e-e767365aa946%40googlegroups.com.

Larpoux

unread,
Feb 4, 2020, 9:57:36 AM2/4/20
to Flutter Development (flutter-dev), Marc Andrew
Marc,
Is your problem with Android or iOS ? Or both ?

Marc Andrew

unread,
Feb 4, 2020, 10:21:08 AM2/4/20
to Flutter Development (flutter-dev)
Hi Larpoux,

Thank you so much for looking into this.
I'm only able to test it on iOS as I don't have an Android device. 
But I would assume it would be the same on Android.
I also did some further research.
There is another package "Soundpool" where they are discussing this issue on GitHub issue #16.


Thank you,
Marc




On Tuesday, February 4, 2020 at 2:57:36 PM UTC, Larpoux wrote:
Marc,
Is your problem with Android or iOS ? Or both ?
On 3 Feb 2020 at 18:15 +0100, Larpoux <lar...@gmail.com>, wrote:
Hi Marc,

I really need this feature for my own app.
I am actually using https://github.com/dooboolab/flutter_sound and I am happy with it. Except with this feature missing.


My plan is to look to this problem soon and implement this feature if it is possible in flutter_sound.
I will take you inform.

On 3 Feb 2020 at 15:45 +0100, Marc Andrew <marc4...@gmail.com>, wrote:
Hi all,

my App needs to play a "beep" sound on certain actions. I'm using audioplayers to play the local audio file.
Everything is working fine, however I've noticed it will stop the background music once the sound is playing.
For instance if I have a music running from Spotify it will stop the music.
Ideally it should lower the the volume for the Spotify music during the "beep" sound and increase it again after the sound has stopped.
I've looked into audioplayers documentation, but can't find the options for this.
Does anyone know how to achieve this? Or does anyone have another package recommendation?


Kind regards,
Marc

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.

Marc Andrew

unread,
Feb 15, 2020, 7:49:58 AM2/15/20
to Flutter Development (flutter-dev)
Hi Larpoux,

any luck on this?


Thank you,
Marc

Şükriye Ludwig

unread,
Feb 15, 2020, 8:24:05 AM2/15/20
to Marc Andrew, Flutter Development (flutter-dev)

Hi, have you tried foreground services? It might work like the way you described. I have been spplied foreground service plugin to my project but it only works for Android. 

So but if the user cancels / quits the app from the app bar so the app will be terminated. In this case the foreground service will not work too. 

Cheers, 
-sue  

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/54dab1f6-d7c2-4cc1-a127-49d3910565fe%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages