AudioSource stops when bluetooth speaker is connected to Android tablet
I'm testing my game on Android and I'm getting two problems related with the music.
Unity version: 5.5.0f3. Device: Nvidia Shield K1 and JBL bluetooth speaker.
Here are the two scenarios of this bug:
I have my bluetooth speaker connected to the tablet, and I launch the game (it goes directly to play a test stage). The music doesn't play (or maybe it started playing and stopped due to the bluetooth speaker.
I start playing and then I connect the bluetooth speaker. The music stops.
In both cases, all sound effects play normally.
My current solution is to check every frame if music is playing, and play it if it's stopped. Not bad, but it's a bit weird in the second scenario, as the music starts from the beginning.
This is the function I have for playing the music and any sfx:
// playSfx
public static void playSfx(string sfx, bool checkIfPlaying) {
if (!checkIfPlaying || ( checkIfPlaying && !GameObject.Find (sfx).GetComponent<AudioSource> ().isPlaying) ) {
GameObject.Find (sfx).GetComponent<AudioSource>().Play() ;
}
}
Am I doing it wrong? Is it a known problem in my Unity version?
Thanks in advance.
I know this is old, but I have the same problem.
I have the game running with music, connect to any Bluetooth device (speaker, car, etc) and the music in the app just stops. But other audio sources (sound effects) keep working. It's as the Audio Source for the music stops and needs to be started again!