2016-11-15 49 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) 

}