My iOS app uses the MPMusicPlayerController.applicationMusicPlayer
to play music and it can also play other sounds via AVAudioPlayer simultaneously.
It works fine playing through either the device speakers or bluetooth earphones / headsets.
When it comes to AirPlay to devices like Apple TV or HomePod, the music is sent but the AVAudioPlayer stuff remains on the device. I want everything over AirPlay!
Note: the audio session is initialized like so:
try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [.allowAirPlay, .mixWithOthers])
I cannot use the longForm
policy because that would stop the music. I've tried different things here but no luck so far.