3

I am working on a simple program to allow users to send system audio to multiple bluetooth speakers very easily. I really want to know if it is possible, given the current and upcoming APIs, to do this. I want to be able to make the app connect to at least two or three different bluetooth speakers, and make the system send all audio to the speakers somehow. This may be through the app, or the app could make the two speakers mirror each other as one. I guess I would like to know if any approach to getting this functionality is possible. Just to clarify, I am not quite looking to select audio and play it, but have any and all audio from the system be routed to the speakers.

I have looked here, but it does not quite answer my question.

Community
  • 1
  • 1
Jake3231
  • 703
  • 8
  • 22

1 Answers1

1

You can route audio output to a Bluetooth device, such as a speaker, using setOutputDataSource

A change to the system audio route will replace any existing route, so you cannot direct output to multiple Bluetooth devices simultaneously.

Your app can create a multi-route audio session to enable it to send different audio streams to different devices, but you can't direct all system audio to multiple devices.

It seems unlikely that this will ever change.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
  • Thanks! That is exactly what I'm looking to hear. I understand that by nature of iOS, it would be a bit of a stretch, but I thought that I'd make sure. Is it possible that I could pull from Apple Music or the local music library to play to multiple Bluetooth outputs, when in the app? – Jake3231 Jul 30 '16 at 04:00
  • Sorry to comment twice, but I also thought; Could I split system audio into two streams and then route it to the speakers? – Jake3231 Jul 30 '16 at 04:04
  • 1
    No, I don't believe that you can intercept the audio that is being sent and redirect it. You can do all of these things on OS X but not on ios – Paulw11 Jul 30 '16 at 04:17
  • I have [since opened another thread for this](http://stackoverflow.com/questions/38810339/programmatically-create-aggregate-devices-in-swift-using-coreaudio), but I found out you can use CoreAudio to do this on OS X. I would appreciate a little help on that if anyone knows how to do that. – Jake3231 Aug 07 '16 at 15:41
  • @Paulw11, unfortunately, it appears that while the `multiRoute` option allows you to stream to multiple devices, those devices cannot be bluetooth. https://developer.apple.com/documentation/avfoundation/avaudiosession/categoryoptions/1616518-allowbluetooth – Winston Du Jul 16 '20 at 03:21