Skip to content

Instantly share code, notes, and snippets.

@akhenakh
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akhenakh/458edbacbd768ab9d205 to your computer and use it in GitHub Desktop.
Save akhenakh/458edbacbd768ab9d205 to your computer and use it in GitHub Desktop.
airPlayVideoActive property returns false while between two streams, here is a way to detect airplay in all condition from: http://www.ask-coder.com/3162230/how-to-customize-the-airplay-button-when-airplay-is-active
- (BOOL)isAirPlayActive{
CFDictionaryRef currentRouteDescriptionDictionary = nil;
UInt32 dataSize = sizeof(currentRouteDescriptionDictionary);
AudioSessionGetProperty(kAudioSessionProperty_AudioRouteDescription, &dataSize, &currentRouteDescriptionDictionary);
if (currentRouteDescriptionDictionary) {
CFArrayRef outputs = CFDictionaryGetValue(currentRouteDescriptionDictionary, kAudioSession_AudioRouteKey_Outputs);
if(outputs && CFArrayGetCount(outputs) > 0) {
CFDictionaryRef currentOutput = CFArrayGetValueAtIndex(outputs, 0);
CFStringRef outputType = CFDictionaryGetValue(currentOutput, kAudioSession_AudioRouteKey_Type);
return (CFStringCompare(outputType, kAudioSessionOutputRoute_AirPlay, 0) == kCFCompareEqualTo);
}
}
return NO;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment