zmxv / react-native-sound

React Native module for playing sound clips
MIT License
2.78k stars 748 forks source link

[iOS] Possibility to play sound while listening to Spotify with phone locked #781

Closed pedpess closed 2 years ago

pedpess commented 2 years ago

:clipboard: Description

I have a use case where I would like to play sound with the app in the following state:

  1. App is in the background
  2. Spotify is playing music
  3. Phone is locked
  4. Sound from the app would stop Spotify, or duck the Spotify music in favor of the app sound

:microphone: Motivation

This would allow users to listen to more urgent sounds from the app even with other streaming audio players in the background. This is only an issue on iOS. For Android, the sound works as expected.

ucheNkadiCode commented 2 years ago

Check out the solution in https://github.com/zmxv/react-native-sound/issues/788, I layed out the steps of how I solved it with the OP's help

pedpess commented 2 years ago

Cheers @ucheNkadiCode! That's really what was needed. Thank you very much 🙏🏻