title: Airplay, Apple TV and Remote Events - is it only for streaming audio/video?
body: <p>My iPad app presents a second UI to an Apple TV using the techniques discussed here - that is, be detecting and drawing to a UIScreen that represents the Apple TV:</p>
  
  <p><a href="http://developer.apple.com/library/IOs/#documentation/AudioVideo/Conceptual/AirPlayGuide/EnrichYourAppforAirPlay/EnrichYourAppforAirPlay.html" rel="noreferrer">http://developer.apple.com/library/IOs/#documentation/AudioVideo/Conceptual/AirPlayGuide/EnrichYourAppforAirPlay/EnrichYourAppforAirPlay.html</a></p>
  
  <p>That document also discusses receiving Remote Control Events:</p>
  
  <p><em>When AirPlay is in use, <strong>your media</strong> may be playing in another room from your host device. The AirPlay output device may have its own controls or respond to an Apple remote control. For the best user experience, your app should listen for and respond to remote events, such as play, pause, and fast-forward requests. Enabling remote events also allows your app to respond to the controls on headphones or earbuds that are plugged into the host device physically.</em></p>
  
  <p>I have implemented the approach they describe to begin receiving remote control events, both in my app and in a simple test project, but I'm unable to detect any events. I do not receive events when I use a headphone plugged directly into an iPad and I do not receive events when I am sending a view to the Apple TV.</p>
  
  <p>I am coming to the conclusion that, in fact, the only way you can intercept remote control events is if <strong>you are streaming media to the Apple TV</strong>, rather than simply present an app UI or mirroring.  </p>
  
  <p>This hypothesis seems to be supported by testing with the following steps using the MixerHost sample app (<a href="http://developer.apple.com/library/ios/#samplecode/MixerHost/Introduction/Intro.html" rel="noreferrer">http://developer.apple.com/library/ios/#samplecode/MixerHost/Introduction/Intro.html</a>):</p>
  
  <ol>
  <li>Launch app on iPad with mirroring to Apple TV turned on.</li>
  <li>Press "Play" button on remote - nothing happens.</li>
  <li>Press "Play" button on the app UI and music starts playing through Apple TV.</li>
  <li>Press "Play" button on remote to stop music, but the music does not stop.</li>
  <li>Change the Airplay routing on the iPad so that it is no longer mirroring and just sending audio to the Apple TV.  If you set a break point on "remoteControlReceivedWithEvent", and press the Play/Pause button the remote, you may catch the event.  It is inconsistent - after receiving one or two events, it stops working.</li>
  </ol>
  
  <p>Has anyone else had better luck with Airplay and Remote Control Events?  Suggestions?</p>