Mitesh Khatri
Mitesh Khatri

Reputation: 3955

enable MPMoviePlayerViewController airplay

I am trying to enable airplay in my application using setAllowAirplay but its showing below warning.

MPMoviePlayerViewController may not respond to 'setAllowsAirPlay'

So please suggest how can I enable airplay in my application.

Upvotes: 0

Views: 526

Answers (1)

Rob VS
Rob VS

Reputation: 722

The warning is there because not all iOS versions and devices include the allowsAirPlay property. The safe way to call it would be like this:

if ([moviePlayerVC.moviePlayer respondsToSelector:@selector(setAllowsAirPlay:)]) {
    [moviePlayerVC.moviePlayer setAllowsAirPlay:YES];
}

I'm pretty sure that this selector will exist on any modern iOS device.

Upvotes: 2

Related Questions