I can't get the AirPlay option to show up in my MPMoviePlayerController. It shows up in the command center but I can't get it to show up within my app. I do get an "iPhone Speaker" option (why??) and an "iPhone" option instead of the usual "iPhone" and "AirPlay" options.
This is how I'm initializing my media player:
filePath = [s objectForKey:kStrMergeFileKeyString];
NSURL *movieString = [NSURL fileURLWithPath:filePath];
NSLog(@"filepath %@", filePath);
NSLog(@"fileurl %@", movieString);
// Now set up the movie player controller and play the movie.
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: movieString];
self.moviePlayer = player;
if (self.moviePlayer) {
[[self.moviePlayer view] setFrame:[self.view bounds]]; // frame must match parent view
[self.view addSubview: [self.moviePlayer view]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerWillExitFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayStateDidChange:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:nil];
if ([moviePlayer respondsToSelector:@selector(setAllowsAirPlay:)]) {
[moviePlayer setAllowsAirPlay:YES];
}
self.moviePlayer.controlStyle = MPMovieControlStyleDefault;
self.moviePlayer.shouldAutoplay = YES;
[self.moviePlayer play];
[self.moviePlayer setFullscreen:YES];
} else {
NSLog(@"Invalid file path");
}
What is going on? Is this a bug?