• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by molul · Apr 29, 2017 at 05:49 PM · androidnetworkingmusicbluetoothspeaker

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:

  1. 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.

  2. 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.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image aorata · Jun 15, 2018 at 09:42 PM 0
Share

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!

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

183 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Local Mobile Multiplayer 0 Answers

connecting 2 android devices without Internet 2 Answers

How to access the android api from unity 1 Answer

Android app stops background music 5 Answers

Unity Networking Connection (local Server) | EnglishGerman 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges