1

I am trying to detect when an AirPlay device is available on the network and if there is one, I'd like to display a list.

For example, the app "Dailymotion" does exactly what I want : when I connect my iPhone to a network with an Apple TV, an "AirPlay" icon appears : https://dl.dropbox.com/u/4534662/Photo%2004-03-13%2010%2007%2014.png (just next the HD)

And then, when clicking on the AirPlay icon, a picker shows up with the available AirPlay devices : https://dl.dropbox.com/u/4534662/Photo%2004-03-13%2010%2007%2018.png

I didn't find a way to do that with Apple Documentation. So, how can I do that programmatically?

MartinMoizard
  • 6,600
  • 12
  • 45
  • 75

1 Answers1

3

You can display an AirPlay picker view (if AirPlay is available) like so:

MPVolumeView *volumeView = [ [MPVolumeView alloc] init] ;
[volumeView setShowsVolumeSlider:NO];
[volumeView sizeToFit];
[view addSubview:volumeView];

The MPVolumeView displays all the available AirPlay devices. The code above disables the volume slider, which you may or may not want to do. What you can't do is get programatic access to AirPlay device information.

lxt
  • 31,146
  • 5
  • 78
  • 83
  • @lxt:actually i am also working on the airplay. But that is airplay from the iOS device to the android device . I searched a lot. Current state of my application is my android device is recognized in the iOS device. for more information see my question on SO:http://stackoverflow.com/questions/15128124/implementing-android-as-a-server-receiver-in-airplay. Can you help me ? – V-Xtreme Mar 04 '13 at 09:29
  • Is it possible to select multiple Airplay devices from the list? – AloSwift Aug 28 '14 at 09:47
  • As in stream to multiple airplay devices at once? No, unfortunately not. – lxt Aug 29 '14 at 20:30