0

I'm creating iPhone app for kids which they can play with alphabets and numbers.
I want to providing the option for airplay so that playing on bigger screen will be more fun.

I'm using the following code to show the airplay button:

MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(0, 0, 105, 40)];
[bottomPanel addSubview:volumeView];

I'm able to see the volume view, but not the airplay button. Can some one help me how to show the airplay button for my app?

Satyam
  • 15,493
  • 31
  • 131
  • 244
  • The MPVolumeView routing button (the one you call AirPlay button) AFAIK is only visible for movie and audio content (when using MPMoviePlayerController etc.). What you seem to aim for is the AirPlay mirroring feature and I am entirely unsure if it is possible to embed that in your app as it is a global system setting. – Till Aug 04 '12 at 10:25

1 Answers1

1

Your code fragment should show the AirPlay button, if run on a device, and with AirPlay devices on your local network.

It worked for me, in an otherwise empty test application. When I switched Wi-Fi off (and therefore there were no AirPlay devices), the button disappeared.

As for interacting with external screens, have a look at the UIScreen class, and the AirPlay and External Displays in iOS apps session from the 2011 WWDC. However, as @Till mentions, your users may have to enable screen mirroring from the UI in the multi-tasking bar.

Martin Kenny
  • 2,468
  • 1
  • 19
  • 16
  • I'm testing it on iPhone4 which has the airplay option. But i don't have any air play devices to test. Is it the reason for now showing "air play" button in my app? – Satyam Aug 06 '12 at 08:40
  • Yes. You'll probably want a real Apple TV, to check compatibility with, at some point, but in the meantime you can download a copy of [AirServer](http://www.airserverapp.com/), which will pretend to be an Apple TV. – Martin Kenny Aug 06 '12 at 08:51