Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I turn on AirPlay Screen Mirroring on the iPhone 4S programmatically

I have written an app for iPhones and for the 4S I want to support screen mirroring of the application over AirPlay.

Using the System AirPlay picker the and with Mirroring turned on it will mirror the app without any issues.

I would like to offer this picker in the app and have used the following basic code:

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

This provides an AirPlay picker and I can select the Apple TV. However it does not mirror the content over AirPlay. When I go to the system picker it shows that the AppleTV is selected, and to enable mirroring I have to use the switch here.

So the question is, how can I turn on mirroring in the app when a user selects AirPlay using the app picker?

Thanks

like image 719
Mike Ullrich Avatar asked Jan 09 '12 09:01

Mike Ullrich


2 Answers

The only way to programmatically enable mirroring is to use private APIs. See here

like image 54
justice Avatar answered Oct 04 '22 22:10

justice


I am pretty sure mirroring can only be enabled from the system supplied menu in the multitasking bar.

like image 31
Ross Kimes Avatar answered Oct 04 '22 22:10

Ross Kimes