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

泄露秘密 提交于 2019-11-29 21:05:32

问题


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


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/8786080/how-can-i-turn-on-airplay-screen-mirroring-on-the-iphone-4s-programmatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!