Apple better not provide a way to detect AirPlay, because the first thing media companies will want to do is block it. They're still laboring under the outdated idea that TVs are separate from every other kind of display.
Basically, you can subscribe to a notification when a second screen is connected and display there whatever you want. The French TV channels M6 and Canal+ have blocked it for a few months now. (which is absolutely stupid obviously)
As far as AirPlay from inside the default media player object, I'm not sure if it's notified to the app and I don't have an iPhone 4S or iPad2+ to check.
edit: the paragraphe "Provide Audio Metadata" from the link above seems to say that the app also knows when it's "plain" AirPlay.
> Apple better not provide a way to detect AirPlay, because the first thing media companies will want to do is block it.
They do provide a way, of course, and developers are free to disable it, and some do. On my iPad I have apps for RTE (Irish state broadcaster), TV3 (Irish private broadcaster), BBC (UK state broadcaster) and Channel 4 (UK pseudo-private broadcaster). RTE and BBC allow you to use AirPlay, TV3 and Channel 4 do not, and Channel 4 specifically mentions the fact that they don't in their FAQ, and imply that they never will.
Far weirder, the NetFlix app doesn't do AirPlay, even though they provide an AppleTV app.
Lovefilm already block AirPlay for their streaming app (I'm not sure if screen mirroring helps) On the iPad 1, the AirPlay icon shows up, but selecting the AppleTV as the output only plays the audio. Video stays on the iPad.
They "block" it by reimplementing the entire videoplayer UI. This is unfortunate because it's inferior to the system provided videoplayer UI, and not just due to lack of AirPlay support.
Notice how touching the screen causes the UI to appear immediately, instead of the delay you'd normally expect. Also, the seek bar is much more sensitive and difficult to use.
I've been wondering why they went through the trouble of trying to make a nearly identical video player UI, but I suppose blocking AirPlay seems like a good explanation.
I think a better explanation would be that they used the same video decoding for all devices and tried to implement a UI for that rather than re-encoding their entire library.