2016-11-15 44 views
1

我正在开发一个voip应用程序,并希望将音频路由到蓝牙。我了解到唯一的方法就是使用MPVolumeView调出airplay菜单。 MPVolumeView的不足之处在于它不是非常可定制的。我查看了facebook并发现了outlook应用程序,发现它们都定制了它比MPVolumeView API提供的更多。我想知道他们是真的使用MPVOlumeView还是具有自定义视图并以编程方式将轻击事件发送到MPVolumeView中的按钮?Facebook,Spotify(iOS)使用MPVolumeView或自定义视图来播放airplay?

+0

你有什么想法吗?我处于一种我一直在寻找答案的情况。 – Anders

回答

0

这可能会有帮助:您可以通过检查当前的音频会话路由并在MPVolumeView上使用routeButtonImage定制程序API来更改Spotify应用执行的按钮图像。

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) 

}