1

I am working on a voip app and want to route audio to bluetooth. I learned that the only way to do is to bring up airplay menu using MPVolumeView. The downside of the MPVolumeView is that it is not very customizeable. I looked at facebook and spotify outlook app and find that they both have customized it more than what is provided by the MPVolumeView API. I am wondering if they are really using the MPVOlumeView or that have a custom view and programatically send tap event to the button inside MPVolumeView?

Rizwan
  • 29
  • 4
  • Did you figure anything out? I'm in a situation myself where I've been looking for an answer to this. – anders Dec 14 '16 at 08:16

1 Answers1

0

This may be helpful: you can change the image of the button as the Spotify app does by inspecting the current audio session route, and using the routeButtonImage customizer API on MPVolumeView.

let audioSession = AVAudioSession.sharedInstance( )
if let output = audioSession.currentRoute.outputs.first
{
    let myCustomImage = <#Use information from the output (AVAudioSessionPortDescription) to set a custom image #>
    myVolumeView.setRouteButtonImage( myCustomImage, for: .normal )

}
Chris Hinkle
  • 4,304
  • 1
  • 16
  • 11