Can I launch AirPlay from my custom app and then display the custom app screen on the external monitor? I found a solution to display videos.
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
if (@available(iOS 11.0, *)) {
AVRoutePickerView *routerPickerView = [[AVRoutePickerView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
routerPickerView.activeTintColor = [UIColor clearColor];
routerPickerView.delegate = self;
[self.view addSubview:routerPickerView];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:routerPickerView.bounds];
imageView.image = [UIImage imageNamed:@"Zubehoer.jpg"];
[routerPickerView addSubview:imageView];
} else {
// Fallback on earlier versions
}
AVAsset *asset = [AVAsset assetWithURL:[NSURL URLWithString:@"https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8"]];
AVPlayerItem *playerItem = [[AVPlayerItem alloc] initWithAsset:asset];
AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];
AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
[playerLayer setFrame:CGRectMake(0.0f, 40.0f, self.view.frame.size.width, self.view.frame.size.height - 40.0f)];
[self.view.layer addSublayer:playerLayer];
[player seekToTime:kCMTimeZero];
[player play];
}
But is it also possible to mirror the screen from within the app?