MPVolume view showing different options

312 Views Asked by At

I am using bluetooth sound in my app. I've used MPVolumeview to route between different options. Sometimes it shows 2 options like Bluetooth and iPhone and sometimes showing 3 options like Bluetooth,iPHone,Speaker without doing anything specific or particular. Any help?

Sometimes only iphone and bluetooth device appears, speaker is missing.

enter image description here

1

There are 1 best solutions below

2
objective-d On

You can check if the AVAudioSession category has been changed. When the category is PlayAndRecord, the MPVolumeView shows "iphone"(it is receiver) and "speaker". When the category is not PlayAndRecord such as PlayBack, the MPVolumeView shows "iphone" which means speaker. Also, the option "DefaultToSpeaker" in PlayAndRecord category will "hide" the "speaker"