Here are my $0.02. I've implemented the AirPlay service on MythTV, and I've spent extensive amount of time looking into the issue (haven't found a good 100% reliable solution yet)
From what I've investigated:
- the iOS device will only show the screen device if RAOP and AirPlay advertises matches
- AirPlay and RAOP versioning must match if version > 120.x. Before that they could be different and it would work.
- If you use a version > 120 in your advertisement, FairPlay will be used, even if you make the RAOP service advertise that it only supports RSA or no encryption
The only way to have the service show up as a full screen (rather than just an audio device) with 100% success rate, you must advertise that your RAOP service supports FairPlay. IF you don't, it works but not reliably. I'd say about 2/3rd of the time the device will show as a speaker only, and not a screen.
If you use version < 120, and only advertise RAOP as supporting RSA, you can get audio to work easily. But then video and photo sharing is a hit and miss.
If you advertise RAOP to support fairplay, then for video and photo sharing that will work better.
However, while the device will show in the airplay device list, you're not guaranteed that it will work 100% of the time.
When you attempt to play a video, if it tries to connect only to the video service, it will work just fine.
However, I've found that sometimes, before connecting to the AirPlay video service, it will first connect to RAOP which if it succeeds will then drop RAOP connection and switch to AirPlay video.
But if you have advertise FairPlay *or* use version >= 120, the iOS device will attempt to establish a FairPlay handshake, this fails and then playback on the iOS device drops back to the default iphone screen.
So from what I've gathered, there's no way to have it working 100% of the time, every time.
Either it will not advertise as a full device and will show up from time to time as an audio device, but then if it does happen to show as a full device it will work 100% of the time and audio works fine.
You can get the custom airplay device to show 100% of the time in the list, but then actual playback/audio or photo sharing may not work from time to time.
My guess is that the iPhone device when it browse for devices, doesn't always behave the same way; either a bug in their code, or done on purpose. My guess is that their code being implemented to only work with a genuine Apple TV, so there's no handling of mismatching Audio & Video server.
Note that I have access to the MFi internal documentation, there's nothing documented on this matter, it expects that you use their FairPlay key, but that's unique to your MFi account and as such not usable in an OpenSource .
Now if you guy find a solution, I would *love* to know... Many sleepless night on this topic is driving me insane...
You add: we have a similar ticket opened in mythtv bug tracking:
https://code.mythtv.org/trac/ticket/11901#comment:4
In there I mentioned a few Apple TV official device from different version. Apple TV 2 running a very old iOS 4
And Apple TV running iOS 5 and iOS 6
The iOS 4 version itself doesn't reliably show in the iPhone list. So the problem isn't just with our code (or xbmc), Apple device itself has this problem. I've lodged a bug at Apple on this, the answer was "upgrade your Apple TV"
I should also add that AirServer, a commercial solution has *exactly* the same problem I mentioned earlier.
AirServer will 100% reliably show in the device list, but it *will* fail just the same under some circumstances: when the iphone attempts to first connect via RAOP but that fail and so the connection is dropped.
AirServer advertises as supporting FairPlay, but they don't.
They don't do audio nor HLS so they don't care much. They only support video and mirroring. But it will fail just as much.
The difference is that you pay for the privilege.