zmxv / react-native-sound

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

how to make it just like the system sound, don't interrupt the music playback #480

Open 12343954 opened 6 years ago

12343954 commented 6 years ago

i listen the music app,then i jump into ‘react-native-sound’ code, it interrupt the player immediately.

i just use ‘react-native-sound’ to make a beep sound,i don't want to interrupt the music player.

what can i do ? thank you !

johntitus commented 6 years ago

If you're on iOS: Sound.setCategory("Playback", true);

Be sure to edit Info.plist, as described in the wiki: https://github.com/zmxv/react-native-sound/wiki/API#soundsetcategoryvalue-mixwithothers-ios-only

12343954 commented 6 years ago

@johntitus thank you so much !

12343954 commented 5 years ago
if(isIOS){
    // Sound.setCategory('Playback', false);
    Sound.setCategory('Ambient', false);
}

this is the correct effect! app won't interrupt other music session!

johanschram commented 5 years ago

Works fine on IOS, it doesn't on android. Any ideas ?

(react-native 0.57.1)

12343954 commented 5 years ago

have no idea on android!

parisasafari commented 5 years ago

I need this feature for android, any ideas yet ?

hoppergee commented 4 years ago

Just search keyword mixWithOthers in below two place:

And found the mixWithOthers option is working under android

12343954 commented 4 years ago

@wokenqingtian thank you, i'll try.