Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Airplay, Apple TV and Remote Events - is it only for streaming audio/video?

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:

http://developer.apple.com/library/IOs/#documentation/AudioVideo/Conceptual/AirPlayGuide/EnrichYourAppforAirPlay/EnrichYourAppforAirPlay.html

That document also discusses receiving Remote Control Events:

When AirPlay is in use, your media 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.

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.

I am coming to the conclusion that, in fact, the only way you can intercept remote control events is if you are streaming media to the Apple TV, rather than simply present an app UI or mirroring.

This hypothesis seems to be supported by testing with the following steps using the MixerHost sample app (http://developer.apple.com/library/ios/#samplecode/MixerHost/Introduction/Intro.html):

  1. Launch app on iPad with mirroring to Apple TV turned on.
  2. Press "Play" button on remote - nothing happens.
  3. Press "Play" button on the app UI and music starts playing through Apple TV.
  4. Press "Play" button on remote to stop music, but the music does not stop.
  5. 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.

Has anyone else had better luck with Airplay and Remote Control Events? Suggestions?

like image 566
Rob Reuss Avatar asked Dec 10 '11 22:12

Rob Reuss


People also ask

Is AirPlay audio or video?

The original Apple AirPlay is a proprietary system for streaming audio or video from one Apple source -- typically an iPhone, iPad or a Mac computer -- to another device over a home network.

Is AirPlay only for video?

AirPlay allows you to wirelessly cast audio or video from your iPhone, iPad, or Mac to an Apple TV or an AirPlay 2-compatible smart TV, as long as your device is connected to the same Wi-Fi as the TV. You can stream videos from any iPhone, iPad, iPod touch, or Mac.

Does Apple AirPlay stream video?

AirPlay lets you do it all. AirPlay lets you share videos, photos, music, and more from Apple devices to your Apple TV, favorite speakers, and popular smart TVs.

Can you stream anything on AirPlay?

Apple AirPlay lets you stream, control, and share content from your iPhone, iPad, or Mac to your compatible Roku streaming device. You can watch movies, TV shows, and family videos, listen to popular music, or browse vacation photos.


1 Answers

I've also been experimenting with a second screen UI via AirPlay Mirroring, and I can confirm that Apple remote events are not forwarded from the Apple TV to the iOS device during Mirroring.

In my own test application, I can receive headphone remote control events consistently and remote control events from the "Now Playing Controls" -- the media controls available in the bottom toolbar after a double-tap on the home button.

But no events ever show up from the Apple TV remote.

Just another item to add to the Apple / AirPlay wishlist...

like image 124
Mark Johnson Avatar answered Sep 20 '22 13:09

Mark Johnson