Closed matiastucci closed 3 months ago
Hi,
are you referring to iOS? Usually, we're not setting / starting an audio session unless you've registered a listener or manually called an audio session, but I'll take a look at it soon, as I need to prepare some updates for RN 0.73.
Meanwhile you could try to set a category and specially have a look for the mixWithOthers bool?
I tried this on a fresh react native app and the bug doesn't happen. I noticed that in my actual app, I have react-native-track-player installed and having both libraries causes this. Specifically when calling setupPlayer
. I tried passing a mixWithOthers
option but no luck. Any ideas what could be happening? Thanks!
Unfortunately, things start to get tricky when you use third-party modules that also require an audio session. In the past, I encountered similar issues with expo-av and react-native-video. I had to patch out the audio session management from these libraries and ensure that the audio session was registered with the React Native Volume Manager.
RNTP is actually a pretty decent library and also has plenty of the same functions that this library has. https://rntp.dev/docs/3.2/api/constants/ios-category-options
You should setupPlayer with the correct Category and allow mixWithOthers or make sure to use the ambient category when calling setupPlayer: https://rntp.dev/docs/3.2/api/constants/ios-category
Oh, I didn't try with ambient
before. Apparently, that did the trick! Thanks!
I have music playing on Spotify, and when I open my react native app it stops. I debugged my code and ended up realizing that by just importing this library it happens: e.g
import { setVolume } from 'react-native-volume-manager'