is it possible to change from Bluetooth to iPhone speaker in iOS 14? All I want is real-time control of where the audio comes from
Change from Bluetooth to iPhone speaker
Basically something to the effect of this would show the AVRoutePicker's view and hide it behind a custom button. the AVRoutePicker button was available in iOS 13, and before that we used the MPVolumeView to do about the same. There is no direct way to select the routes, only show the system UI to show the view.
var button: UIButton?
var picker: AVRoutePickerView = AVRoutePickerView()
var detector: AVRouteDetector = AVRouteDetector()
detector.isRouteDetectionEnabled = true
addSubview(picker)
picker.frame = CGRect.zero
picker.isHidden = true
button = picker.subviews.filter({$0 is UIButton}).first as? UIButton
button?.sendActions(for: .touchUpInside)