I have an application for video streaming. It has ability to make mirroring AirPlay (Apple Tv). Now I'm trying to add Google Chromecast connection. I added button and everything working just I expected. Here is my case: I want user only be able to connect 1 device at the moment. For example if user already conneceted to AirPlay when user tap on Chromecast, I want to disable AirPlay programmatically.
Here's how I checked external playback status:
self.videoPlayer.isExternalPlaybackActive
Here's how I checked is AirPlay connected:
- (BOOL)isAirPlayConnected {
return self.airPlayButton.isWirelessRouteActive;
}
I know this is how I disabled all external display:
self.videoPlayer.allowsExternalPlayback = NO;
self.videoPlayer.usesExternalPlaybackWhileExternalScreenIsActive = NO;
I already listening:
MPVolumeViewWirelessRoutesAvailableDidChangeNotification
and MPVolumeViewWirelessRouteActiveDidChangeNotification
notifications.
Bu couldn't find solution for programatically disconnect before switching the other.
Any help would be appreciated.