I am using the MPVolumeview in my video overlay to use the route button and connect to airplay. I hide the MPVolume's volume slider. I trying to resize the overlay to include a frame for the route button only if airplay is available. Previously I had been using an observer on the route button in the MPVolumeView like this :
for (UIView *view in volumeButton.subviews) {
if ([view isKindOfClass:[UIButton class]]) {
airplayButton = [view retain];
[airplayButton addObserver:self forKeyPath:@"alpha" options:NSKeyValueObservingOptionNew context:nil];
}
}
I then set a boolean property that keeps track of whether the button is visible or not. Recently however I have found on the iPhone 6 that the route button is not consistently showing on videos. I looked back at MPVolumeView and found that there is a property now called areWirelessRoutesAvailable so I've stepped through the code and found that this property is not consistently true. I am setting the MPVolumeView in awakeFromNib and the check on MPVolumeView is in layoutsubviews. Is there a better way to check for airplay availability, is the route button consistently showing a problem with MPVolumeView or am I missing something?