views:

354

answers:

4

Is there a way to let the user select which device they use for audio output?

In the docs I have found that you can select which route to use by setting kAudioSessionProperty_OverrideAudioRoute to either:

  • kAudioSessionOverrideAudioRoute_None, or
  • kAudioSessionOverrideAudioRoute_Speaker

However I would like to let the user to use their Bluetooth headset to hear the audio.

If you look in Apple's own 'Voice memos' app, in the playback menu there is a button in the top left which lets you choose which audio device to use. When a Bluetooth headset is attached, pressing the button brings up a menu which makes it possible to select between:

  • Bluetooth headset
  • iPhone
  • Speaker

Is there a way to achieve this functionality using standard Apple APIs in my own app?

A: 

The same question with me. Mark!

arthur_hu
this isn't an answer.
Alan Rogers
+3  A: 

In 3.1 there are two protocols that support outputting audio to bluetooth devices and the use depends on the accessory. The first is A2DP which is used with accessores that support recieving stereo music, and the other is hands free for all handfree accesories. To activate the first option, you need to use the MPVolumeView class which has a volume slider and a audio device selection button, when this view is added to any of the views in the app, it provides a way for the user to set the volume and select a BT device if connected ( this is the only way I found) On the other hand, the second option can be activated using the call

 UInt32 bt = TRUE;
 result = AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryEnableBluetoothInput , sizeof(UInt32), &bt);

The appliction must initialize the audio session and use the corect catagory ( it must support recoding for this to work). After the EnableBluetoothInput is set all Input and output audio will be routed through the handsfree device ( if connected of course :) )

Kyle Browning
A: 

I did it as Kyle said. but didn't saw the device selection button.only have a volume slider.

arthur_hu
please write these as comments to someone's question or answer, not as answers (since this is not an answer)
iWasRobbed
Can you please learn how to use the site properly - COMMENT on others' answers to make it clear what the text relates to and to avoid having answers posted that answer nothing!
jrtc27