johnsonsu/react-native-sound-player

[BUG] iOS silence mode doesn't play on .playUrl

Stephane-Parent opened this issue · 1 comments

Describe the bug
When playing a sound from SoundPlayer.playUrl, no sound comes out if the Silence mode is ON (little switch on iPhone side).

To Reproduce
Steps to reproduce the behavior:

  1. Boot your app
  2. Play a sound with SoundPlayer.playUrl()
  3. Hear the sound
  4. Switch to silence mode
  5. No more sound

Expected behavior
Expose a function to enable sound on silence mode. It would be more convenient to manage when to respect silence mode.

Platform (please complete the following information):

  • OS: iOS
  • lib version 0.13.2

Additional context
I bypass it by calling SoundPlayer.setSpeaker(false) before seeking. Seems like [session setActive:true error:nil]; is needed to bypass the Silence Mode. Once this function is called, Silence mode won't be respected anymore.

Check this. #128