React-native-sound: Creating a playlist that works in background and ducks other sounds

Created on 18 Oct 2017  路  2Comments  路  Source: zmxv/react-native-sound

I've been trying to use this library to create a playlist that plays in the background and ducks other sounds.

I was able to implement ducking just fine. However, the only way I could get it to play as a playlist was to "cheat" by looping an inaudible sound and then, through JS, loading the next file after the currently playing one finishes. The looped inaudible sound keeps my in control of the system audio. If I do not loop the inaudible sound then the current file will continue playing in the background, but the app will not advance to the next item on the playlist.

This can't be the right way to do it. Music players (Spotify etc.) are easily able to advance to the next sound while in the background.

Any ideas how this should be done with react-native sound?

Thanks

Most helpful comment

How did you implement ducking? You manually lowered the system sounds?

All 2 comments

How did you implement ducking? You manually lowered the system sounds?

I've been trying to use this library to create a playlist that plays in the background and ducks other sounds.

I was able to implement ducking just fine. However, the only way I could get it to play as a playlist was to "cheat" by looping an inaudible sound and then, through JS, loading the next file after the currently playing one finishes. The looped inaudible sound keeps my in control of the system audio. If I do not loop the inaudible sound then the current file will continue playing in the background, but the app will not advance to the next item on the playlist.

This can't be the right way to do it. Music players (Spotify etc.) are easily able to advance to the next sound while in the background.

Any ideas how this should be done with react-native sound?

Thanks

You said you were able to implement ducking. I tried multiple solutions with :

    Sound.setCategory('Playback');
    Sound.setMode('SpokenAudio');

However the duck is not working and the audios are at the same volume.
Do you have the solution ?
Thx.

Was this page helpful?
0 / 5 - 0 ratings