zmxv / react-native-sound

React Native module for playing sound clips
MIT License
2.79k stars 749 forks source link

Music in any player on IOS stops after playing sounds from react-native-sound #431

Open leannaweller opened 6 years ago

leannaweller commented 6 years ago

"react-native": "0.50.4", "react-native-sound": "^0.9.0",

Platform: iOS

Hi there! Have you encountered such problem when the music in any player on IOS stops after playing sounds from this library in your react-native app? Thanks!

jekirl commented 6 years ago

This has happened to me before. Digging around now...How/when did you set the category/session settings?

jekirl commented 6 years ago

Have you tried doing

    Sound.setCategory('PlayAndRecord', true);
    Sound.setActive(true);

(in that order!) before constructing any sounds?

danleveille commented 5 years ago

@jekirl Any chance you could add some documentation about these two commands and their possible values?

It's not my area of expertise, but if I figure it out a bit more, I'll give it a shot myself. :)

jekirl commented 5 years ago

@danleveille I haven't done anything with react native for > 1 year, much less anything on iOS in 2019, so sadly I can't be of much help. My memory is that it had to do with the shared AV instance that this lib was utilizing...

ammichael commented 5 years ago

Actually using @jekirl suggestion the music didn't stop but got "muffled". To me the correct sound category use was "Ambient".

Sound.setCategory('Ambient', true)

I'm not sure if all sound categories are available on react-native-sound, but here are the supported categories on iOS: https://developer.apple.com/documentation/avfoundation/avaudiosession/audio_session_categories