I have a sequence of AVMutableCompositions that I am playing with AVPlayer. Everything works great when I am playing via speaker, headphones, or bluetooth. However, as soon as I connect to AirPlay, everything falls apart.
I can play one asset, and I try to switch to a new asset, I get an AVAudioSessionMediaServicesWereResetNotification and the device disconnects from AirPlay. I tried exporting the AVMutableCompositions to files and then using AVURLAssets, but this didn't seem to change anything.
Does anyone know what is going on here? It looks like I won't be able to support AirPlay...
I get the feeling that I could switch to AVAudioPlayer and this would fix the problem, but I am generating dozens of AVMutableCompositions and don't want to be reading and writing them to disk.
This is counter-intuitive, but try setting
myPlayer.allowsExternalPlayback = NO;
The documentation is not completely clear on this, but it seems that this will disallow video playback only. When I do this in my app (which uses AVPlayer), Airplay with an AVComposition works. Even the artwork shows up nicely (via an MPNowPlayingInfoCenter).